aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-09-16 17:48:57 +0000
committerJustin Clarke Casey2008-09-16 17:48:57 +0000
commitc6dfc99f22efb5d8644819e38c8e6f59cf59768f (patch)
treeeeb5ae7603bedc5a566f4bd5ba5a3f97749ebdcf /OpenSim/Region/ScriptEngine/Shared/Api
parent* Add Y. Nitta to OpenSim contributors (diff)
downloadopensim-SC_OLD-c6dfc99f22efb5d8644819e38c8e6f59cf59768f.zip
opensim-SC_OLD-c6dfc99f22efb5d8644819e38c8e6f59cf59768f.tar.gz
opensim-SC_OLD-c6dfc99f22efb5d8644819e38c8e6f59cf59768f.tar.bz2
opensim-SC_OLD-c6dfc99f22efb5d8644819e38c8e6f59cf59768f.tar.xz
* Apply http://opensimulator.org/mantis/view.php?id=2203
* Implementation of LSL llBreakLink and llBreakAllLinks * Thanks Y. Nitta!
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs70
1 files changed, 68 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index d5fc9a6..249b4dd 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2830,13 +2830,79 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2830 public void llBreakLink(int linknum) 2830 public void llBreakLink(int linknum)
2831 { 2831 {
2832 m_host.AddScriptLPS(1); 2832 m_host.AddScriptLPS(1);
2833 NotImplemented("llBreakLink"); 2833 UUID invItemID = InventorySelf();
2834 if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_CHANGE_LINKS) == 0)
2835 {
2836 ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
2837 return;
2838 }
2839 if (linknum < ScriptBaseClass.LINK_THIS)
2840 return;
2841 SceneObjectGroup parentPrim = m_host.ParentGroup;
2842 SceneObjectPart childPrim = null;
2843 switch(linknum)
2844 {
2845 case ScriptBaseClass.LINK_ROOT:
2846 break;
2847 case ScriptBaseClass.LINK_SET:
2848 case ScriptBaseClass.LINK_ALL_OTHERS:
2849 case ScriptBaseClass.LINK_ALL_CHILDREN:
2850 case ScriptBaseClass.LINK_THIS:
2851 foreach(SceneObjectPart part in parentPrim.Children.Values)
2852 {
2853 if (part.UUID != m_host.UUID)
2854 {
2855 childPrim = part;
2856 break;
2857 }
2858 }
2859 break;
2860 default:
2861 childPrim = parentPrim.GetLinkNumPart(linknum);
2862 if (childPrim.UUID == m_host.UUID)
2863 childPrim = null;
2864 break;
2865 }
2866 if (linknum == ScriptBaseClass.LINK_ROOT)
2867 {
2868 // Restructuring Multiple Prims.
2869 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values);
2870 parts.Remove(parentPrim.RootPart);
2871 foreach (SceneObjectPart part in parts)
2872 {
2873 parentPrim.DelinkFromGroup(part.LocalId, true);
2874 }
2875 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
2876 if (parts.Count > 0) {
2877 SceneObjectPart newRoot = parts[0];
2878 parts.Remove(newRoot);
2879 foreach (SceneObjectPart part in parts)
2880 {
2881 part.UpdateFlag = 0;
2882 newRoot.ParentGroup.LinkToGroup(part.ParentGroup);
2883 }
2884 }
2885 }
2886 else
2887 {
2888 if (childPrim == null)
2889 return;
2890 parentPrim.DelinkFromGroup(childPrim.LocalId, true);
2891 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
2892 }
2834 } 2893 }
2835 2894
2836 public void llBreakAllLinks() 2895 public void llBreakAllLinks()
2837 { 2896 {
2838 m_host.AddScriptLPS(1); 2897 m_host.AddScriptLPS(1);
2839 NotImplemented("llBreakAllLinks"); 2898 SceneObjectGroup parentPrim = m_host.ParentGroup;
2899 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values);
2900 parts.Remove(parentPrim.RootPart);
2901 foreach (SceneObjectPart part in parts)
2902 {
2903 parentPrim.DelinkFromGroup(part.LocalId, true);
2904 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
2905 }
2840 } 2906 }
2841 2907
2842 public LSL_Types.LSLString llGetLinkKey(int linknum) 2908 public LSL_Types.LSLString llGetLinkKey(int linknum)