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/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |
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 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 17 |
1 files changed, 17 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"); |