aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
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
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 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Interfaces/INPCModule.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs21
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs48
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs5
4 files changed, 56 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
index c50e734..b428c40 100644
--- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs
@@ -134,4 +134,4 @@ namespace OpenSim.Region.Framework.Interfaces
134 /// <returns>UUID of owner if the NPC exists, UUID.Zero if there was no such agent, the agent is unowned or the agent was not an NPC</returns> 134 /// <returns>UUID of owner if the NPC exists, UUID.Zero if there was no such agent, the agent is unowned or the agent was not an NPC</returns>
135 UUID GetOwner(UUID agentID); 135 UUID GetOwner(UUID agentID);
136 } 136 }
137} 137} \ No newline at end of file
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");
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
index 0f8cbdc..ee48ec4 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs
@@ -173,25 +173,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
173 173
174 LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules); 174 LSL_List osGetLinkPrimitiveParams(int linknumber, LSL_List rules);
175 175
176 key osNpcCreate(string user, string name, vector position, string notecard); 176 key osNpcCreate(string user, string name, vector position, string notecard);
177 key osNpcCreate(string user, string name, vector position, string notecard, int options); 177 key osNpcCreate(string user, string name, vector position, string notecard, int options);
178 LSL_Key osNpcSaveAppearance(key npc, string notecard); 178 LSL_Key osNpcSaveAppearance(key npc, string notecard);
179 void osNpcLoadAppearance(key npc, string notecard); 179 void osNpcLoadAppearance(key npc, string notecard);
180 vector osNpcGetPos(key npc); 180 vector osNpcGetPos(key npc);
181 void osNpcMoveTo(key npc, vector position); 181 void osNpcMoveTo(key npc, vector position);
182 void osNpcMoveToTarget(key npc, vector target, int options); 182 void osNpcMoveToTarget(key npc, vector target, int options);
183 rotation osNpcGetRot(key npc); 183
184 void osNpcSetRot(LSL_Key npc, rotation rot); 184 /// <summary>
185 void osNpcStopMoveToTarget(LSL_Key npc); 185 /// Get the owner of the NPC
186 void osNpcSay(key npc, string message); 186 /// </summary>
187 void osNpcSit(key npc, key target, int options); 187 /// <param name="npc"></param>
188 void osNpcStand(LSL_Key npc); 188 /// <returns>
189 void osNpcRemove(key npc); 189 /// The owner of the NPC for an owned NPC. The NPC's agent id for an unowned NPC. UUID.Zero if the key is not an npc.
190 void osNpcPlayAnimation(LSL_Key npc, string animation); 190 /// </returns>
191 void osNpcStopAnimation(LSL_Key npc, string animation); 191 LSL_Key osNpcGetOwner(key npc);
192 192
193 LSL_Key osOwnerSaveAppearance(string notecard); 193 rotation osNpcGetRot(key npc);
194 LSL_Key osAgentSaveAppearance(key agentId, string notecard); 194 void osNpcSetRot(LSL_Key npc, rotation rot);
195 void osNpcStopMoveToTarget(LSL_Key npc);
196 void osNpcSay(key npc, string message);
197 void osNpcSit(key npc, key target, int options);
198 void osNpcStand(LSL_Key npc);
199 void osNpcRemove(key npc);
200 void osNpcPlayAnimation(LSL_Key npc, string animation);
201 void osNpcStopAnimation(LSL_Key npc, string animation);
202
203 LSL_Key osOwnerSaveAppearance(string notecard);
204 LSL_Key osAgentSaveAppearance(key agentId, string notecard);
195 205
196 key osGetMapTexture(); 206 key osGetMapTexture();
197 key osGetRegionMapTexture(string regionName); 207 key osGetRegionMapTexture(string regionName);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
index 02efecf..38a814d 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs
@@ -513,6 +513,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
513 m_OSSL_Functions.osNpcLoadAppearance(npc, notecard); 513 m_OSSL_Functions.osNpcLoadAppearance(npc, notecard);
514 } 514 }
515 515
516 public LSL_Key osNpcGetOwner(LSL_Key npc)
517 {
518 return m_OSSL_Functions.osNpcGetOwner(npc);
519 }
520
516 public vector osNpcGetPos(LSL_Key npc) 521 public vector osNpcGetPos(LSL_Key npc)
517 { 522 {
518 return m_OSSL_Functions.osNpcGetPos(npc); 523 return m_OSSL_Functions.osNpcGetPos(npc);