diff options
author | Justin Clark-Casey (justincc) | 2012-01-27 23:17:13 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-01-27 23:17:13 +0000 |
commit | 7c1d075a5a72dd9411e40676054b648b26f116a6 (patch) | |
tree | 438ec6b7db3ddd594c80dcbc6ce0e5087486f7ae /OpenSim/Region | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-7c1d075a5a72dd9411e40676054b648b26f116a6.zip opensim-SC-7c1d075a5a72dd9411e40676054b648b26f116a6.tar.gz opensim-SC-7c1d075a5a72dd9411e40676054b648b26f116a6.tar.bz2 opensim-SC-7c1d075a5a72dd9411e40676054b648b26f116a6.tar.xz |
Implement osIsNpc(key npc):integer. This return TRUE if the given key belongs to an NPC in the region. FALSE if not or if the NPC module isn't present.
Diffstat (limited to '')
3 files changed, 29 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 ba96ad8..034d545 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2202,6 +2202,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2202 | return retVal; | 2202 | return retVal; |
2203 | } | 2203 | } |
2204 | 2204 | ||
2205 | public LSL_Integer osIsNpc(LSL_Key npc) | ||
2206 | { | ||
2207 | CheckThreatLevel(ThreatLevel.None, "osIsNpc"); | ||
2208 | m_host.AddScriptLPS(1); | ||
2209 | |||
2210 | INPCModule module = World.RequestModuleInterface<INPCModule>(); | ||
2211 | if (module != null) | ||
2212 | { | ||
2213 | UUID npcId; | ||
2214 | if (UUID.TryParse(npc.m_string, out npcId)) | ||
2215 | if (module.IsNPC(npcId, World)) | ||
2216 | return ScriptBaseClass.TRUE; | ||
2217 | } | ||
2218 | |||
2219 | return ScriptBaseClass.FALSE; | ||
2220 | } | ||
2221 | |||
2205 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) | 2222 | public LSL_Key osNpcCreate(string firstname, string lastname, LSL_Vector position, string notecard) |
2206 | { | 2223 | { |
2207 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); | 2224 | CheckThreatLevel(ThreatLevel.High, "osNpcCreate"); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index ee48ec4..dbc1dfc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -173,6 +173,13 @@ 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 | /// <summary> | ||
177 | /// Check if the given key is an npc | ||
178 | /// </summary> | ||
179 | /// <param name="npc"></param> | ||
180 | /// <returns>TRUE if the key belongs to an npc in the scene. FALSE otherwise.</returns> | ||
181 | LSL_Integer osIsNpc(LSL_Key npc); | ||
182 | |||
176 | key osNpcCreate(string user, string name, vector position, string notecard); | 183 | key osNpcCreate(string user, string name, vector position, string notecard); |
177 | key osNpcCreate(string user, string name, vector position, string notecard, int options); | 184 | key osNpcCreate(string user, string name, vector position, string notecard, int options); |
178 | LSL_Key osNpcSaveAppearance(key npc, string notecard); | 185 | LSL_Key osNpcSaveAppearance(key npc, 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 38a814d..cc8d417 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -493,6 +493,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
493 | return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules); | 493 | return m_OSSL_Functions.osGetLinkPrimitiveParams(linknumber, rules); |
494 | } | 494 | } |
495 | 495 | ||
496 | public LSL_Integer osIsNpc(LSL_Key npc) | ||
497 | { | ||
498 | return m_OSSL_Functions.osIsNpc(npc); | ||
499 | } | ||
500 | |||
496 | public key osNpcCreate(string user, string name, vector position, key cloneFrom) | 501 | public key osNpcCreate(string user, string name, vector position, key cloneFrom) |
497 | { | 502 | { |
498 | return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom); | 503 | return m_OSSL_Functions.osNpcCreate(user, name, position, cloneFrom); |