implement osNpcGetPos()

bulletsim
Justin Clark-Casey (justincc) 2011-08-11 23:36:22 +01:00
parent a21e98ae1a
commit d23d37d2aa
3 changed files with 27 additions and 0 deletions

View File

@ -2202,6 +2202,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
}
public LSL_Vector osNpcGetPos(LSL_Key npc)
{
CheckThreatLevel(ThreatLevel.High, "osNpcGetPos");
INPCModule npcModule = World.RequestModuleInterface<INPCModule>();
if (npcModule != null)
{
UUID npcId;
if (!UUID.TryParse(npc.m_string, out npcId))
return new LSL_Vector(0, 0, 0);
if (!npcModule.IsNPC(npcId, m_host.ParentGroup.Scene))
return new LSL_Vector(0, 0, 0);
Vector3 pos = World.GetScenePresence(npcId).AbsolutePosition;
return new LSL_Vector(pos.X, pos.Y, pos.Z);
}
return new LSL_Vector(0, 0, 0);
}
public void osNpcMoveTo(LSL_Key npc, LSL_Vector position)
{
CheckThreatLevel(ThreatLevel.High, "osNpcMoveTo");

View File

@ -171,6 +171,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
key osNpcCreate(string user, string name, vector position, key cloneFrom);
LSL_Key osNpcSaveAppearance(key npc, string notecardName);
void osNpcLoadAppearance(key npc, string notecardNameOrUuid);
vector osNpcGetPos(key npc);
void osNpcMoveTo(key npc, vector position);
void osNpcMoveToTarget(key npc, vector position, int options);
rotation osNpcGetRot(key npc);

View File

@ -493,6 +493,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osNpcLoadAppearance(npc, notecardNameOrUuid);
}
public vector osNpcGetPos(LSL_Key npc)
{
return m_OSSL_Functions.osNpcGetPos(npc);
}
public void osNpcMoveTo(key npc, vector position)
{
m_OSSL_Functions.osNpcMoveTo(npc, position);