aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-04-24 00:03:57 +0100
committerJustin Clark-Casey (justincc)2012-04-24 00:03:57 +0100
commit40e37d8b78379db08de541c8c7a9fed1d22ec5ef (patch)
tree99881c116648c2347c9c5951cd2734b5f5c1c09f /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-40e37d8b78379db08de541c8c7a9fed1d22ec5ef.zip
opensim-SC_OLD-40e37d8b78379db08de541c8c7a9fed1d22ec5ef.tar.gz
opensim-SC_OLD-40e37d8b78379db08de541c8c7a9fed1d22ec5ef.tar.bz2
opensim-SC_OLD-40e37d8b78379db08de541c8c7a9fed1d22ec5ef.tar.xz
Add osForceAttachToAvatar() and osForceDetachFromAvatar()
These behave identically to llAttachToAvatar() and llDetachFromAvatar() except that they do not enforce the PERMISSION_ATTACH check Intended for use in completely controlled dedicated environments where these checks are more a UI hinderance than a help. Threat level high.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs73
1 files changed, 45 insertions, 28 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 9cb97f9..d4c872c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2994,7 +2994,49 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2994 m_UrlModule.ReleaseURL(url); 2994 m_UrlModule.ReleaseURL(url);
2995 } 2995 }
2996 2996
2997 public void llAttachToAvatar(int attachment) 2997 /// <summary>
2998 /// Attach the object containing this script to the avatar that owns it.
2999 /// </summary>
3000 /// <param name='attachment'>The attachment point (e.g. ATTACH_CHEST)</param>
3001 /// <returns>true if the attach suceeded, false if it did not</returns>
3002 public bool AttachToAvatar(int attachmentPoint)
3003 {
3004 SceneObjectGroup grp = m_host.ParentGroup;
3005 ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
3006
3007 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3008
3009 if (attachmentsModule != null)
3010 return attachmentsModule.AttachObject(presence, grp, (uint)attachmentPoint, false);
3011 else
3012 return false;
3013 }
3014
3015 /// <summary>
3016 /// Detach the object containing this script from the avatar it is attached to.
3017 /// </summary>
3018 /// <remarks>
3019 /// Nothing happens if the object is not attached.
3020 /// </remarks>
3021 public void DetachFromAvatar()
3022 {
3023 Util.FireAndForget(DetachWrapper, m_host);
3024 }
3025
3026 private void DetachWrapper(object o)
3027 {
3028 SceneObjectPart host = (SceneObjectPart)o;
3029
3030 SceneObjectGroup grp = host.ParentGroup;
3031 UUID itemID = grp.FromItemID;
3032 ScenePresence presence = World.GetScenePresence(host.OwnerID);
3033
3034 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3035 if (attachmentsModule != null)
3036 attachmentsModule.DetachSingleAttachmentToInv(presence, itemID);
3037 }
3038
3039 public void llAttachToAvatar(int attachmentPoint)
2998 { 3040 {
2999 m_host.AddScriptLPS(1); 3041 m_host.AddScriptLPS(1);
3000 3042
@@ -3007,15 +3049,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3007 return; 3049 return;
3008 3050
3009 if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) 3051 if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0)
3010 { 3052 AttachToAvatar(attachmentPoint);
3011 SceneObjectGroup grp = m_host.ParentGroup;
3012
3013 ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
3014
3015 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3016 if (attachmentsModule != null)
3017 attachmentsModule.AttachObject(presence, grp, (uint)attachment, false);
3018 }
3019 } 3053 }
3020 3054
3021 public void llDetachFromAvatar() 3055 public void llDetachFromAvatar()
@@ -3031,24 +3065,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3031 return; 3065 return;
3032 3066
3033 if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) 3067 if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0)
3034 { 3068 DetachFromAvatar();
3035 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3036 if (attachmentsModule != null)
3037 Util.FireAndForget(DetachWrapper, m_host);
3038 }
3039 }
3040
3041 private void DetachWrapper(object o)
3042 {
3043 SceneObjectPart host = (SceneObjectPart)o;
3044
3045 SceneObjectGroup grp = host.ParentGroup;
3046 UUID itemID = grp.FromItemID;
3047 ScenePresence presence = World.GetScenePresence(host.OwnerID);
3048
3049 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3050 if (attachmentsModule != null)
3051 attachmentsModule.DetachSingleAttachmentToInv(presence, itemID);
3052 } 3069 }
3053 3070
3054 public void llTakeCamera(string avatar) 3071 public void llTakeCamera(string avatar)