diff options
author | Talun | 2012-07-03 11:10:09 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-07-06 22:37:19 +0100 |
commit | 1b1f841c6aaf2453b3aca0eade84855ae658e655 (patch) | |
tree | 895b5f5bec7f0ae737e74017809e8762c05518b2 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | Pull prim crossing/teleport checks up into Scene.IncomingCreateObject() from ... (diff) | |
download | opensim-SC_OLD-1b1f841c6aaf2453b3aca0eade84855ae658e655.zip opensim-SC_OLD-1b1f841c6aaf2453b3aca0eade84855ae658e655.tar.gz opensim-SC_OLD-1b1f841c6aaf2453b3aca0eade84855ae658e655.tar.bz2 opensim-SC_OLD-1b1f841c6aaf2453b3aca0eade84855ae658e655.tar.xz |
Mantis 6063 osNpcTouch.
Allow NPCS to touch obects.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7385dd9..61394af 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2677,6 +2677,41 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2677 | } | 2677 | } |
2678 | } | 2678 | } |
2679 | 2679 | ||
2680 | public void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num) | ||
2681 | { | ||
2682 | CheckThreatLevel(ThreatLevel.High, "osNpcTouch"); | ||
2683 | m_host.AddScriptLPS(1); | ||
2684 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2685 | int linkNum = link_num.value; | ||
2686 | if (module != null || (linkNum < 0 && linkNum != ScriptBaseClass.LINK_THIS)) | ||
2687 | { | ||
2688 | UUID npcId; | ||
2689 | if (!UUID.TryParse(npcLSL_Key, out npcId) || !module.CheckPermissions(npcId, m_host.OwnerID)) | ||
2690 | return; | ||
2691 | SceneObjectPart part = null; | ||
2692 | UUID objectId; | ||
2693 | if (UUID.TryParse(LSL_String.ToString(object_key), out objectId)) | ||
2694 | part = World.GetSceneObjectPart(objectId); | ||
2695 | if (part == null) | ||
2696 | return; | ||
2697 | if (linkNum != ScriptBaseClass.LINK_THIS) | ||
2698 | { | ||
2699 | if (linkNum == 0 || linkNum == ScriptBaseClass.LINK_ROOT) | ||
2700 | { // 0 and 1 are treated as root, find the root if the current part isnt it | ||
2701 | if (!part.IsRoot) | ||
2702 | part = part.ParentGroup.RootPart; | ||
2703 | } | ||
2704 | else | ||
2705 | { // Find the prim with the given link number if not found then fail silently | ||
2706 | part = part.ParentGroup.GetLinkNumPart(linkNum); | ||
2707 | if (part == null) | ||
2708 | return; | ||
2709 | } | ||
2710 | } | ||
2711 | module.Touch(npcId, part.UUID); | ||
2712 | } | ||
2713 | } | ||
2714 | |||
2680 | /// <summary> | 2715 | /// <summary> |
2681 | /// Save the current appearance of the script owner permanently to the named notecard. | 2716 | /// Save the current appearance of the script owner permanently to the named notecard. |
2682 | /// </summary> | 2717 | /// </summary> |