aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
authorMelanie2012-08-14 21:43:23 +0100
committerMelanie2012-08-14 21:43:23 +0100
commit9ec35d09f8b4bf29356364ae0f18bdadfc9092c4 (patch)
tree45f4b687ce48c0cb9edef3c94de9cb86d7ce47f4 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation
parentMerge branch 'master' into careminster (diff)
parentPrevent race conditions when one thread removes an NPC SP before another thre... (diff)
downloadopensim-SC-9ec35d09f8b4bf29356364ae0f18bdadfc9092c4.zip
opensim-SC-9ec35d09f8b4bf29356364ae0f18bdadfc9092c4.tar.gz
opensim-SC-9ec35d09f8b4bf29356364ae0f18bdadfc9092c4.tar.bz2
opensim-SC-9ec35d09f8b4bf29356364ae0f18bdadfc9092c4.tar.xz
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs25
1 files changed, 20 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 0bb933c..2f02f1f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2466,8 +2466,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2466 if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) 2466 if (!npcModule.CheckPermissions(npcId, m_host.OwnerID))
2467 return new LSL_Vector(0, 0, 0); 2467 return new LSL_Vector(0, 0, 0);
2468 2468
2469 Vector3 pos = World.GetScenePresence(npcId).AbsolutePosition; 2469 ScenePresence sp = World.GetScenePresence(npcId);
2470 return new LSL_Vector(pos.X, pos.Y, pos.Z); 2470
2471 if (sp != null)
2472 {
2473 Vector3 pos = sp.AbsolutePosition;
2474 return new LSL_Vector(pos.X, pos.Y, pos.Z);
2475 }
2471 } 2476 }
2472 2477
2473 return new LSL_Vector(0, 0, 0); 2478 return new LSL_Vector(0, 0, 0);
@@ -2535,9 +2540,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2535 return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); 2540 return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W);
2536 2541
2537 ScenePresence sp = World.GetScenePresence(npcId); 2542 ScenePresence sp = World.GetScenePresence(npcId);
2538 Quaternion rot = sp.Rotation;
2539 2543
2540 return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); 2544 if (sp != null)
2545 {
2546 Quaternion rot = sp.Rotation;
2547 return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
2548 }
2541 } 2549 }
2542 2550
2543 return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); 2551 return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W);
@@ -2559,7 +2567,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2559 return; 2567 return;
2560 2568
2561 ScenePresence sp = World.GetScenePresence(npcId); 2569 ScenePresence sp = World.GetScenePresence(npcId);
2562 sp.Rotation = LSL_Api.Rot2Quaternion(rotation); 2570
2571 if (sp != null)
2572 sp.Rotation = LSL_Api.Rot2Quaternion(rotation);
2563 } 2573 }
2564 } 2574 }
2565 2575
@@ -2737,6 +2747,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2737 { 2747 {
2738 CheckThreatLevel(ThreatLevel.High, "osNpcTouch"); 2748 CheckThreatLevel(ThreatLevel.High, "osNpcTouch");
2739 m_host.AddScriptLPS(1); 2749 m_host.AddScriptLPS(1);
2750
2740 INPCModule module = World.RequestModuleInterface<INPCModule>(); 2751 INPCModule module = World.RequestModuleInterface<INPCModule>();
2741 int linkNum = link_num.value; 2752 int linkNum = link_num.value;
2742 if (module != null || (linkNum < 0 && linkNum != ScriptBaseClass.LINK_THIS)) 2753 if (module != null || (linkNum < 0 && linkNum != ScriptBaseClass.LINK_THIS))
@@ -2744,12 +2755,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2744 UUID npcId; 2755 UUID npcId;
2745 if (!UUID.TryParse(npcLSL_Key, out npcId) || !module.CheckPermissions(npcId, m_host.OwnerID)) 2756 if (!UUID.TryParse(npcLSL_Key, out npcId) || !module.CheckPermissions(npcId, m_host.OwnerID))
2746 return; 2757 return;
2758
2747 SceneObjectPart part = null; 2759 SceneObjectPart part = null;
2748 UUID objectId; 2760 UUID objectId;
2749 if (UUID.TryParse(LSL_String.ToString(object_key), out objectId)) 2761 if (UUID.TryParse(LSL_String.ToString(object_key), out objectId))
2750 part = World.GetSceneObjectPart(objectId); 2762 part = World.GetSceneObjectPart(objectId);
2763
2751 if (part == null) 2764 if (part == null)
2752 return; 2765 return;
2766
2753 if (linkNum != ScriptBaseClass.LINK_THIS) 2767 if (linkNum != ScriptBaseClass.LINK_THIS)
2754 { 2768 {
2755 if (linkNum == 0 || linkNum == ScriptBaseClass.LINK_ROOT) 2769 if (linkNum == 0 || linkNum == ScriptBaseClass.LINK_ROOT)
@@ -2764,6 +2778,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2764 return; 2778 return;
2765 } 2779 }
2766 } 2780 }
2781
2767 module.Touch(npcId, part.UUID); 2782 module.Touch(npcId, part.UUID);
2768 } 2783 }
2769 } 2784 }