aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Common
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/Common
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/Common')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs69
1 files changed, 67 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 76b88bc..a74f304 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -2986,13 +2986,78 @@ namespace OpenSim.Region.ScriptEngine.Common
2986 public void llBreakLink(int linknum) 2986 public void llBreakLink(int linknum)
2987 { 2987 {
2988 m_host.AddScriptLPS(1); 2988 m_host.AddScriptLPS(1);
2989 NotImplemented("llBreakLink"); 2989 UUID invItemID = InventorySelf();
2990 if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_CHANGE_LINKS) == 0)
2991 {
2992 ShoutError("Script trying to link but PERMISSION_CHANGE_LINKS permission not set!");
2993 return;
2994 }
2995 if (linknum < BuiltIn_Commands_BaseClass.LINK_THIS)
2996 return;
2997 SceneObjectGroup parentPrim = m_host.ParentGroup;
2998 SceneObjectPart childPrim = null;
2999 switch(linknum)
3000 {
3001 case BuiltIn_Commands_BaseClass.LINK_ROOT:
3002 break;
3003 case BuiltIn_Commands_BaseClass.LINK_SET:
3004 case BuiltIn_Commands_BaseClass.LINK_ALL_OTHERS:
3005 case BuiltIn_Commands_BaseClass.LINK_ALL_CHILDREN:
3006 case BuiltIn_Commands_BaseClass.LINK_THIS:
3007 foreach(SceneObjectPart part in parentPrim.Children.Values)
3008 {
3009 if (part.UUID != m_host.UUID)
3010 {
3011 childPrim = part;
3012 break;
3013 }
3014 }
3015 break;
3016 default:
3017 childPrim = parentPrim.GetLinkNumPart(linknum);
3018 if (childPrim.UUID == m_host.UUID)
3019 childPrim = null;
3020 break;
3021 }
3022 if (linknum == BuiltIn_Commands_BaseClass.LINK_ROOT)
3023 {
3024 // Restructuring Multiple Prims.
3025 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values);
3026 parts.Remove(parentPrim.RootPart);
3027 foreach (SceneObjectPart part in parts)
3028 {
3029 parentPrim.DelinkFromGroup(part.LocalId, true);
3030 }
3031 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
3032 if (parts.Count > 0) {
3033 SceneObjectPart newRoot = parts[0];
3034 parts.Remove(newRoot);
3035 foreach (SceneObjectPart part in parts)
3036 {
3037 part.UpdateFlag = 0;
3038 newRoot.ParentGroup.LinkToGroup(part.ParentGroup);
3039 }
3040 }
3041 }
3042 else
3043 {
3044 if (childPrim == null)
3045 return;
3046 parentPrim.DelinkFromGroup(childPrim.LocalId, true);
3047 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
3048 }
2990 } 3049 }
2991 3050
2992 public void llBreakAllLinks() 3051 public void llBreakAllLinks()
2993 { 3052 {
2994 m_host.AddScriptLPS(1); 3053 m_host.AddScriptLPS(1);
2995 NotImplemented("llBreakAllLinks"); 3054 SceneObjectGroup parentPrim = m_host.ParentGroup;
3055 List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values);
3056 parts.Remove(parentPrim.RootPart);
3057 foreach (SceneObjectPart part in parts) {
3058 parentPrim.DelinkFromGroup(part.LocalId, true);
3059 parentPrim.TriggerScriptChangedEvent(Changed.LINK);
3060 }
2996 } 3061 }
2997 3062
2998 public string llGetLinkKey(int linknum) 3063 public string llGetLinkKey(int linknum)