Merge branch 'master' into careminster

avinationmerge
Melanie 2012-08-14 21:43:23 +01:00
commit 9ec35d09f8
2 changed files with 49 additions and 38 deletions

View File

@ -177,8 +177,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
if (m_avatars.ContainsKey(agentID)) if (m_avatars.ContainsKey(agentID))
{ {
ScenePresence sp; ScenePresence sp;
scene.TryGetScenePresence(agentID, out sp); if (scene.TryGetScenePresence(agentID, out sp))
{
m_log.DebugFormat( m_log.DebugFormat(
"[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}", "[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}",
sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget); sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget);
@ -189,6 +189,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
return true; return true;
} }
} }
}
return false; return false;
} }
@ -200,14 +201,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC
if (m_avatars.ContainsKey(agentID)) if (m_avatars.ContainsKey(agentID))
{ {
ScenePresence sp; ScenePresence sp;
scene.TryGetScenePresence(agentID, out sp); if (scene.TryGetScenePresence(agentID, out sp))
{
sp.Velocity = Vector3.Zero; sp.Velocity = Vector3.Zero;
sp.ResetMoveToTarget(); sp.ResetMoveToTarget();
return true; return true;
} }
} }
}
return false; return false;
} }
@ -223,9 +225,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{ {
if (m_avatars.ContainsKey(agentID)) if (m_avatars.ContainsKey(agentID))
{ {
ScenePresence sp;
scene.TryGetScenePresence(agentID, out sp);
m_avatars[agentID].Say(channel, text); m_avatars[agentID].Say(channel, text);
return true; return true;
@ -241,9 +240,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{ {
if (m_avatars.ContainsKey(agentID)) if (m_avatars.ContainsKey(agentID))
{ {
ScenePresence sp;
scene.TryGetScenePresence(agentID, out sp);
m_avatars[agentID].Shout(channel, text); m_avatars[agentID].Shout(channel, text);
return true; return true;
@ -260,13 +256,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC
if (m_avatars.ContainsKey(agentID)) if (m_avatars.ContainsKey(agentID))
{ {
ScenePresence sp; ScenePresence sp;
scene.TryGetScenePresence(agentID, out sp); if (scene.TryGetScenePresence(agentID, out sp))
{
sp.HandleAgentRequestSit(m_avatars[agentID], agentID, partID, Vector3.Zero); sp.HandleAgentRequestSit(m_avatars[agentID], agentID, partID, Vector3.Zero);
// sp.HandleAgentSit(m_avatars[agentID], agentID); // sp.HandleAgentSit(m_avatars[agentID], agentID);
return true; return true;
} }
} }
}
return false; return false;
} }
@ -277,9 +275,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{ {
if (m_avatars.ContainsKey(agentID)) if (m_avatars.ContainsKey(agentID))
{ {
ScenePresence sp;
scene.TryGetScenePresence(agentID, out sp);
m_avatars[agentID].Whisper(channel, text); m_avatars[agentID].Whisper(channel, text);
return true; return true;
@ -296,12 +291,14 @@ namespace OpenSim.Region.OptionalModules.World.NPC
if (m_avatars.ContainsKey(agentID)) if (m_avatars.ContainsKey(agentID))
{ {
ScenePresence sp; ScenePresence sp;
scene.TryGetScenePresence(agentID, out sp); if (scene.TryGetScenePresence(agentID, out sp))
{
sp.StandUp(); sp.StandUp();
return true; return true;
} }
} }
}
return false; return false;
} }
@ -312,6 +309,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{ {
if (m_avatars.ContainsKey(agentID)) if (m_avatars.ContainsKey(agentID))
return m_avatars[agentID].Touch(objectID); return m_avatars[agentID].Touch(objectID);
return false; return false;
} }
} }
@ -322,10 +320,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
{ {
NPCAvatar av; NPCAvatar av;
if (m_avatars.TryGetValue(agentID, out av)) if (m_avatars.TryGetValue(agentID, out av))
{
return av.OwnerID; return av.OwnerID;
} }
}
return UUID.Zero; return UUID.Zero;
} }

View File

@ -2466,9 +2466,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (!npcModule.CheckPermissions(npcId, m_host.OwnerID)) if (!npcModule.CheckPermissions(npcId, m_host.OwnerID))
return new LSL_Vector(0, 0, 0); return new LSL_Vector(0, 0, 0);
Vector3 pos = World.GetScenePresence(npcId).AbsolutePosition; ScenePresence sp = World.GetScenePresence(npcId);
if (sp != null)
{
Vector3 pos = sp.AbsolutePosition;
return new LSL_Vector(pos.X, pos.Y, pos.Z); return new LSL_Vector(pos.X, pos.Y, pos.Z);
} }
}
return new LSL_Vector(0, 0, 0); return new LSL_Vector(0, 0, 0);
} }
@ -2535,10 +2540,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W);
ScenePresence sp = World.GetScenePresence(npcId); ScenePresence sp = World.GetScenePresence(npcId);
Quaternion rot = sp.Rotation;
if (sp != null)
{
Quaternion rot = sp.Rotation;
return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
} }
}
return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W); return new LSL_Rotation(Quaternion.Identity.X, Quaternion.Identity.Y, Quaternion.Identity.Z, Quaternion.Identity.W);
} }
@ -2559,6 +2567,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
ScenePresence sp = World.GetScenePresence(npcId); ScenePresence sp = World.GetScenePresence(npcId);
if (sp != null)
sp.Rotation = LSL_Api.Rot2Quaternion(rotation); sp.Rotation = LSL_Api.Rot2Quaternion(rotation);
} }
} }
@ -2737,6 +2747,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
CheckThreatLevel(ThreatLevel.High, "osNpcTouch"); CheckThreatLevel(ThreatLevel.High, "osNpcTouch");
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
INPCModule module = World.RequestModuleInterface<INPCModule>(); INPCModule module = World.RequestModuleInterface<INPCModule>();
int linkNum = link_num.value; int linkNum = link_num.value;
if (module != null || (linkNum < 0 && linkNum != ScriptBaseClass.LINK_THIS)) if (module != null || (linkNum < 0 && linkNum != ScriptBaseClass.LINK_THIS))
@ -2744,12 +2755,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
UUID npcId; UUID npcId;
if (!UUID.TryParse(npcLSL_Key, out npcId) || !module.CheckPermissions(npcId, m_host.OwnerID)) if (!UUID.TryParse(npcLSL_Key, out npcId) || !module.CheckPermissions(npcId, m_host.OwnerID))
return; return;
SceneObjectPart part = null; SceneObjectPart part = null;
UUID objectId; UUID objectId;
if (UUID.TryParse(LSL_String.ToString(object_key), out objectId)) if (UUID.TryParse(LSL_String.ToString(object_key), out objectId))
part = World.GetSceneObjectPart(objectId); part = World.GetSceneObjectPart(objectId);
if (part == null) if (part == null)
return; return;
if (linkNum != ScriptBaseClass.LINK_THIS) if (linkNum != ScriptBaseClass.LINK_THIS)
{ {
if (linkNum == 0 || linkNum == ScriptBaseClass.LINK_ROOT) if (linkNum == 0 || linkNum == ScriptBaseClass.LINK_ROOT)
@ -2764,6 +2778,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return; return;
} }
} }
module.Touch(npcId, part.UUID); module.Touch(npcId, part.UUID);
} }
} }