aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs60
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs19
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs10
3 files changed, 84 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 77b659b..b639d36 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2725,6 +2725,41 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2725 } 2725 }
2726 } 2726 }
2727 2727
2728 public void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num)
2729 {
2730 CheckThreatLevel(ThreatLevel.High, "osNpcTouch");
2731 m_host.AddScriptLPS(1);
2732 INPCModule module = World.RequestModuleInterface<INPCModule>();
2733 int linkNum = link_num.value;
2734 if (module != null || (linkNum < 0 && linkNum != ScriptBaseClass.LINK_THIS))
2735 {
2736 UUID npcId;
2737 if (!UUID.TryParse(npcLSL_Key, out npcId) || !module.CheckPermissions(npcId, m_host.OwnerID))
2738 return;
2739 SceneObjectPart part = null;
2740 UUID objectId;
2741 if (UUID.TryParse(LSL_String.ToString(object_key), out objectId))
2742 part = World.GetSceneObjectPart(objectId);
2743 if (part == null)
2744 return;
2745 if (linkNum != ScriptBaseClass.LINK_THIS)
2746 {
2747 if (linkNum == 0 || linkNum == ScriptBaseClass.LINK_ROOT)
2748 { // 0 and 1 are treated as root, find the root if the current part isnt it
2749 if (!part.IsRoot)
2750 part = part.ParentGroup.RootPart;
2751 }
2752 else
2753 { // Find the prim with the given link number if not found then fail silently
2754 part = part.ParentGroup.GetLinkNumPart(linkNum);
2755 if (part == null)
2756 return;
2757 }
2758 }
2759 module.Touch(npcId, part.UUID);
2760 }
2761 }
2762
2728 /// <summary> 2763 /// <summary>
2729 /// Save the current appearance of the script owner permanently to the named notecard. 2764 /// Save the current appearance of the script owner permanently to the named notecard.
2730 /// </summary> 2765 /// </summary>
@@ -3203,13 +3238,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3203 { 3238 {
3204 CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatarFromInventory"); 3239 CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatarFromInventory");
3205 3240
3241 m_host.AddScriptLPS(1);
3242
3243 ForceAttachToAvatarFromInventory(m_host.OwnerID, itemName, attachmentPoint);
3244 }
3245
3246 public void osForceAttachToOtherAvatarFromInventory(string rawAvatarId, string itemName, int attachmentPoint)
3247 {
3248 CheckThreatLevel(ThreatLevel.Severe, "osForceAttachToOtherAvatarFromInventory");
3249
3250 m_host.AddScriptLPS(1);
3251
3252 UUID avatarId;
3253
3254 if (!UUID.TryParse(rawAvatarId, out avatarId))
3255 return;
3256
3257 ForceAttachToAvatarFromInventory(avatarId, itemName, attachmentPoint);
3258 }
3259
3260 public void ForceAttachToAvatarFromInventory(UUID avatarId, string itemName, int attachmentPoint)
3261 {
3206 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; 3262 IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;
3207 3263
3208 if (attachmentsModule == null) 3264 if (attachmentsModule == null)
3209 return; 3265 return;
3210 3266
3211 m_host.AddScriptLPS(1);
3212
3213 InitLSL(); 3267 InitLSL();
3214 3268
3215 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName); 3269 TaskInventoryItem item = m_host.Inventory.GetInventoryItem(itemName);
@@ -3232,7 +3286,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3232 return; 3286 return;
3233 } 3287 }
3234 3288
3235 ScenePresence sp = World.GetScenePresence(m_host.OwnerID); 3289 ScenePresence sp = World.GetScenePresence(avatarId);
3236 3290
3237 if (sp == null) 3291 if (sp == null)
3238 return; 3292 return;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index a790cdc..1facc96 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -101,19 +101,33 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
101 // Attachment commands 101 // Attachment commands
102 102
103 /// <summary> 103 /// <summary>
104 /// Attach the object containing this script to the avatar that owns it without checking for PERMISSION_ATTACH 104 /// Attach the object containing this script to the avatar that owns it without asking for PERMISSION_ATTACH
105 /// </summary> 105 /// </summary>
106 /// <param name='attachment'>The attachment point. For example, ATTACH_CHEST</param> 106 /// <param name='attachment'>The attachment point. For example, ATTACH_CHEST</param>
107 void osForceAttachToAvatar(int attachment); 107 void osForceAttachToAvatar(int attachment);
108 108
109 /// <summary> 109 /// <summary>
110 /// Attach the inventory item in the object containing this script to the avatar that owns it without checking for PERMISSION_ATTACH 110 /// Attach an inventory item in the object containing this script to the avatar that owns it without asking for PERMISSION_ATTACH
111 /// </summary> 111 /// </summary>
112 /// <remarks>
113 /// Nothing happens if the owner is not in the region.
114 /// </remarks>
112 /// <param name='itemName'>Tha name of the item. If this is not found then a warning is said to the owner</param> 115 /// <param name='itemName'>Tha name of the item. If this is not found then a warning is said to the owner</param>
113 /// <param name='attachment'>The attachment point. For example, ATTACH_CHEST</param> 116 /// <param name='attachment'>The attachment point. For example, ATTACH_CHEST</param>
114 void osForceAttachToAvatarFromInventory(string itemName, int attachment); 117 void osForceAttachToAvatarFromInventory(string itemName, int attachment);
115 118
116 /// <summary> 119 /// <summary>
120 /// Attach an inventory item in the object containing this script to any avatar in the region without asking for PERMISSION_ATTACH
121 /// </summary>
122 /// <remarks>
123 /// Nothing happens if the avatar is not in the region.
124 /// </remarks>
125 /// <param name='rawAvatarId'>The UUID of the avatar to which to attach. Nothing happens if this is not a UUID</para>
126 /// <param name='itemName'>The name of the item. If this is not found then a warning is said to the owner</param>
127 /// <param name='attachment'>The attachment point. For example, ATTACH_CHEST</param>
128 void osForceAttachToOtherAvatarFromInventory(string rawAvatarId, string itemName, int attachmentPoint);
129
130 /// <summary>
117 /// Detach the object containing this script from the avatar it is attached to without checking for PERMISSION_ATTACH 131 /// Detach the object containing this script from the avatar it is attached to without checking for PERMISSION_ATTACH
118 /// </summary> 132 /// </summary>
119 /// <remarks>Nothing happens if the object is not attached.</remarks> 133 /// <remarks>Nothing happens if the object is not attached.</remarks>
@@ -231,6 +245,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
231 void osNpcRemove(key npc); 245 void osNpcRemove(key npc);
232 void osNpcPlayAnimation(LSL_Key npc, string animation); 246 void osNpcPlayAnimation(LSL_Key npc, string animation);
233 void osNpcStopAnimation(LSL_Key npc, string animation); 247 void osNpcStopAnimation(LSL_Key npc, string animation);
248 void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num);
234 void osNpcWhisper(key npc, int channel, string message); 249 void osNpcWhisper(key npc, int channel, string message);
235 250
236 LSL_Key osOwnerSaveAppearance(string notecard); 251 LSL_Key osOwnerSaveAppearance(string notecard);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 500ed96..b40bdf0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -301,6 +301,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
301 m_OSSL_Functions.osForceAttachToAvatarFromInventory(itemName, attachmentPoint); 301 m_OSSL_Functions.osForceAttachToAvatarFromInventory(itemName, attachmentPoint);
302 } 302 }
303 303
304 public void osForceAttachToOtherAvatarFromInventory(string rawAvatarId, string itemName, int attachmentPoint)
305 {
306 m_OSSL_Functions.osForceAttachToOtherAvatarFromInventory(rawAvatarId, itemName, attachmentPoint);
307 }
308
304 public void osForceDetachFromAvatar() 309 public void osForceDetachFromAvatar()
305 { 310 {
306 m_OSSL_Functions.osForceDetachFromAvatar(); 311 m_OSSL_Functions.osForceDetachFromAvatar();
@@ -626,6 +631,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
626 m_OSSL_Functions.osNpcWhisper(npc, channel, message); 631 m_OSSL_Functions.osNpcWhisper(npc, channel, message);
627 } 632 }
628 633
634 public void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num)
635 {
636 m_OSSL_Functions.osNpcTouch(npcLSL_Key, object_key, link_num);
637 }
638
629 public LSL_Key osOwnerSaveAppearance(string notecard) 639 public LSL_Key osOwnerSaveAppearance(string notecard)
630 { 640 {
631 return m_OSSL_Functions.osOwnerSaveAppearance(notecard); 641 return m_OSSL_Functions.osOwnerSaveAppearance(notecard);