aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs60
1 files changed, 57 insertions, 3 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;