aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-01-27 23:05:48 +0000
committerJustin Clark-Casey (justincc)2012-01-27 23:05:48 +0000
commit9939f94f08b33e3dd9eeea65b730f0ddc80275a5 (patch)
treeaa1fc79d0a8a64f9b3d30dc383b049c5b5bf353c /OpenSim/Region/ScriptEngine/Shared/Api/Implementation
parentAdd basic TestAddScript() regression test (diff)
downloadopensim-SC_OLD-9939f94f08b33e3dd9eeea65b730f0ddc80275a5.zip
opensim-SC_OLD-9939f94f08b33e3dd9eeea65b730f0ddc80275a5.tar.gz
opensim-SC_OLD-9939f94f08b33e3dd9eeea65b730f0ddc80275a5.tar.bz2
opensim-SC_OLD-9939f94f08b33e3dd9eeea65b730f0ddc80275a5.tar.xz
Implement osNpcGetOwner(key npc):key. This returns the owner for an 'owned' NPC, the npc's own key for an 'unowned' NPC and NULL_KEY is the input key was not an npc.
llGetOwnerKey() could also be extended but this does not allow one to distinguish between an unowned NPC and some other result (e.g. 'no such object' if NULL_KEY is the return. Also, any future extensions to LSL functions by Linden Lab are unpredictable and OpenSim-specific extensions could clash.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs21
1 files changed, 21 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 7792ab5..ba96ad8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -2313,6 +2313,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2313 } 2313 }
2314 } 2314 }
2315 2315
2316 public LSL_Key osNpcGetOwner(LSL_Key npc)
2317 {
2318 CheckThreatLevel(ThreatLevel.None, "osNpcGetOwner");
2319
2320 INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
2321 if (npcModule != null)
2322 {
2323 UUID npcId;
2324 if (UUID.TryParse(npc.m_string, out npcId))
2325 {
2326 UUID owner = npcModule.GetOwner(npcId);
2327 if (owner != UUID.Zero)
2328 return new LSL_Key(owner.ToString());
2329 else
2330 return npc;
2331 }
2332 }
2333
2334 return new LSL_Key(UUID.Zero.ToString());
2335 }
2336
2316 public LSL_Vector osNpcGetPos(LSL_Key npc) 2337 public LSL_Vector osNpcGetPos(LSL_Key npc)
2317 { 2338 {
2318 CheckThreatLevel(ThreatLevel.High, "osNpcGetPos"); 2339 CheckThreatLevel(ThreatLevel.High, "osNpcGetPos");