Implement osNpcStand(<npc-id>)
Allows you to stand an NPC that has sat.0.7.2-post-fixes
parent
1c66e08964
commit
380f2a1719
|
@ -103,6 +103,14 @@ namespace OpenSim.Region.Framework.Interfaces
|
||||||
/// <returns>true if the sit succeeded, false if not</returns>
|
/// <returns>true if the sit succeeded, false if not</returns>
|
||||||
bool Sit(UUID agentID, UUID partID, Scene scene);
|
bool Sit(UUID agentID, UUID partID, Scene scene);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stand a sitting NPC.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="agentID"></param>
|
||||||
|
/// <param name="scene"></param>
|
||||||
|
/// <returns>true if the stand succeeded, false if not</returns>
|
||||||
|
bool Stand(UUID agentID, Scene scene);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete an NPC.
|
/// Delete an NPC.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -217,6 +217,23 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool Stand(UUID agentID, Scene scene)
|
||||||
|
{
|
||||||
|
lock (m_avatars)
|
||||||
|
{
|
||||||
|
if (m_avatars.ContainsKey(agentID))
|
||||||
|
{
|
||||||
|
ScenePresence sp;
|
||||||
|
scene.TryGetScenePresence(agentID, out sp);
|
||||||
|
sp.StandUp();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public bool DeleteNPC(UUID agentID, Scene scene)
|
public bool DeleteNPC(UUID agentID, Scene scene)
|
||||||
{
|
{
|
||||||
lock (m_avatars)
|
lock (m_avatars)
|
||||||
|
|
|
@ -233,7 +233,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestSit()
|
public void TestSitAndStand()
|
||||||
{
|
{
|
||||||
TestHelpers.InMethod();
|
TestHelpers.InMethod();
|
||||||
// log4net.Config.XmlConfigurator.Configure();
|
// log4net.Config.XmlConfigurator.Configure();
|
||||||
|
@ -251,9 +251,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
|
||||||
part.SitTargetPosition = new Vector3(0, 0, 1);
|
part.SitTargetPosition = new Vector3(0, 0, 1);
|
||||||
npcModule.Sit(npc.UUID, part.UUID, scene);
|
npcModule.Sit(npc.UUID, part.UUID, scene);
|
||||||
|
|
||||||
// Assertions?
|
|
||||||
Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId));
|
Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId));
|
||||||
Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
|
Assert.That(npc.ParentID, Is.EqualTo(part.LocalId));
|
||||||
|
|
||||||
|
npcModule.Stand(npc.UUID, scene);
|
||||||
|
|
||||||
|
Assert.That(part.SitTargetAvatar, Is.EqualTo(UUID.Zero));
|
||||||
|
Assert.That(npc.ParentID, Is.EqualTo(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2355,6 +2355,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void osNpcStand(LSL_Key npc)
|
||||||
|
{
|
||||||
|
CheckThreatLevel(ThreatLevel.High, "osNpcStand");
|
||||||
|
|
||||||
|
INPCModule module = World.RequestModuleInterface<INPCModule>();
|
||||||
|
if (module != null)
|
||||||
|
{
|
||||||
|
module.Stand(new UUID(npc.m_string), World);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void osNpcRemove(LSL_Key npc)
|
public void osNpcRemove(LSL_Key npc)
|
||||||
{
|
{
|
||||||
CheckThreatLevel(ThreatLevel.High, "osNpcRemove");
|
CheckThreatLevel(ThreatLevel.High, "osNpcRemove");
|
||||||
|
|
|
@ -179,6 +179,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
|
||||||
void osNpcStopMoveToTarget(LSL_Key npc);
|
void osNpcStopMoveToTarget(LSL_Key npc);
|
||||||
void osNpcSay(key npc, string message);
|
void osNpcSay(key npc, string message);
|
||||||
void osNpcSit(key npc, key target, int options);
|
void osNpcSit(key npc, key target, int options);
|
||||||
|
void osNpcStand(LSL_Key npc);
|
||||||
void osNpcRemove(key npc);
|
void osNpcRemove(key npc);
|
||||||
|
|
||||||
LSL_Key osOwnerSaveAppearance(string notecard);
|
LSL_Key osOwnerSaveAppearance(string notecard);
|
||||||
|
|
|
@ -533,6 +533,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
|
||||||
m_OSSL_Functions.osNpcSit(npc, target, options);
|
m_OSSL_Functions.osNpcSit(npc, target, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void osNpcStand(LSL_Key npc)
|
||||||
|
{
|
||||||
|
m_OSSL_Functions.osNpcStand(npc);
|
||||||
|
}
|
||||||
|
|
||||||
public void osNpcRemove(key npc)
|
public void osNpcRemove(key npc)
|
||||||
{
|
{
|
||||||
m_OSSL_Functions.osNpcRemove(npc);
|
m_OSSL_Functions.osNpcRemove(npc);
|
||||||
|
|
Loading…
Reference in New Issue