diff options
author | Justin Clark-Casey (justincc) | 2011-08-11 23:36:22 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-11 23:36:22 +0100 |
commit | d23d37d2aa7c5a3d9c6ec1726aef7941d5e52519 (patch) | |
tree | ae887e5ecc536051531cb3803c0a43c03cd559be /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | implement osNpcGetRot() and osNpcSetRot() (diff) | |
download | opensim-SC_OLD-d23d37d2aa7c5a3d9c6ec1726aef7941d5e52519.zip opensim-SC_OLD-d23d37d2aa7c5a3d9c6ec1726aef7941d5e52519.tar.gz opensim-SC_OLD-d23d37d2aa7c5a3d9c6ec1726aef7941d5e52519.tar.bz2 opensim-SC_OLD-d23d37d2aa7c5a3d9c6ec1726aef7941d5e52519.tar.xz |
implement osNpcGetPos()
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 21 |
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 1874826..b1066b5 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -2202,6 +2202,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2202 | } | 2202 | } |
2203 | } | 2203 | } |
2204 | 2204 | ||
2205 | public LSL_Vector osNpcGetPos(LSL_Key npc) | ||
2206 | { | ||
2207 | CheckThreatLevel(ThreatLevel.High, "osNpcGetPos"); | ||
2208 | |||
2209 | INPCModule npcModule = World.RequestModuleInterface<INPCModule>(); | ||
2210 | if (npcModule != null) | ||
2211 | { | ||
2212 | UUID npcId; | ||
2213 | if (!UUID.TryParse(npc.m_string, out npcId)) | ||
2214 | return new LSL_Vector(0, 0, 0); | ||
2215 | |||
2216 | if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene)) | ||
2217 | return new LSL_Vector(0, 0, 0); | ||
2218 | |||
2219 | Vector3 pos = World.GetScenePresence(npcId).AbsolutePosition; | ||
2220 | return new LSL_Vector(pos.X, pos.Y, pos.Z); | ||
2221 | } | ||
2222 | |||
2223 | return new LSL_Vector(0, 0, 0); | ||
2224 | } | ||
2225 | |||
2205 | public void osNpcMoveTo(LSL_Key npc, LSL_Vector position) | 2226 | public void osNpcMoveTo(LSL_Key npc, LSL_Vector position) |
2206 | { | 2227 | { |
2207 | CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo"); | 2228 | CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo"); |