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 | |
parent | Pull prim crossing/teleport checks up into Scene.IncomingCreateObject() from ... (diff) | |
download | opensim-SC-1b1f841c6aaf2453b3aca0eade84855ae658e655.zip opensim-SC-1b1f841c6aaf2453b3aca0eade84855ae658e655.tar.gz opensim-SC-1b1f841c6aaf2453b3aca0eade84855ae658e655.tar.bz2 opensim-SC-1b1f841c6aaf2453b3aca0eade84855ae658e655.tar.xz |
Mantis 6063 osNpcTouch.
Allow NPCS to touch obects.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
3 files changed, 41 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> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index a8335aa..d38709e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -231,6 +231,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
231 | void osNpcRemove(key npc); | 231 | void osNpcRemove(key npc); |
232 | void osNpcPlayAnimation(LSL_Key npc, string animation); | 232 | void osNpcPlayAnimation(LSL_Key npc, string animation); |
233 | void osNpcStopAnimation(LSL_Key npc, string animation); | 233 | void osNpcStopAnimation(LSL_Key npc, string animation); |
234 | void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num); | ||
234 | void osNpcWhisper(key npc, int channel, string message); | 235 | void osNpcWhisper(key npc, int channel, string message); |
235 | 236 | ||
236 | LSL_Key osOwnerSaveAppearance(string notecard); | 237 | 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..692bb0a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -626,6 +626,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
626 | m_OSSL_Functions.osNpcWhisper(npc, channel, message); | 626 | m_OSSL_Functions.osNpcWhisper(npc, channel, message); |
627 | } | 627 | } |
628 | 628 | ||
629 | public void osNpcTouch(LSL_Key npcLSL_Key, LSL_Key object_key, LSL_Integer link_num) | ||
630 | { | ||
631 | m_OSSL_Functions.osNpcTouch(npcLSL_Key, object_key, link_num); | ||
632 | } | ||
633 | |||
629 | public LSL_Key osOwnerSaveAppearance(string notecard) | 634 | public LSL_Key osOwnerSaveAppearance(string notecard) |
630 | { | 635 | { |
631 | return m_OSSL_Functions.osOwnerSaveAppearance(notecard); | 636 | return m_OSSL_Functions.osOwnerSaveAppearance(notecard); |