diff --git a/OpenSim/Region/Framework/Interfaces/INPCModule.cs b/OpenSim/Region/Framework/Interfaces/INPCModule.cs index 9dd8c79a5f..b65f82c5ed 100644 --- a/OpenSim/Region/Framework/Interfaces/INPCModule.cs +++ b/OpenSim/Region/Framework/Interfaces/INPCModule.cs @@ -103,6 +103,14 @@ namespace OpenSim.Region.Framework.Interfaces /// true if the sit succeeded, false if not bool Sit(UUID agentID, UUID partID, Scene scene); + /// + /// Stand a sitting NPC. + /// + /// + /// + /// true if the stand succeeded, false if not + bool Stand(UUID agentID, Scene scene); + /// /// Delete an NPC. /// diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index be736393b5..e94ed85ba9 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -217,6 +217,23 @@ namespace OpenSim.Region.OptionalModules.World.NPC 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) { lock (m_avatars) diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 4fd3fc202b..b556ea232c 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -233,7 +233,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests } [Test] - public void TestSit() + public void TestSitAndStand() { TestHelpers.InMethod(); // log4net.Config.XmlConfigurator.Configure(); @@ -251,9 +251,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests part.SitTargetPosition = new Vector3(0, 0, 1); npcModule.Sit(npc.UUID, part.UUID, scene); - // Assertions? Assert.That(part.SitTargetAvatar, Is.EqualTo(npcId)); 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)); } } } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index b47ba31564..2ca5e52367 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2355,6 +2355,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + public void osNpcStand(LSL_Key npc) + { + CheckThreatLevel(ThreatLevel.High, "osNpcStand"); + + INPCModule module = World.RequestModuleInterface(); + if (module != null) + { + module.Stand(new UUID(npc.m_string), World); + } + } + public void osNpcRemove(LSL_Key npc) { CheckThreatLevel(ThreatLevel.High, "osNpcRemove"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index bb0a87099c..3221833414 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -179,6 +179,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osNpcStopMoveToTarget(LSL_Key npc); void osNpcSay(key npc, string message); void osNpcSit(key npc, key target, int options); + void osNpcStand(LSL_Key npc); void osNpcRemove(key npc); LSL_Key osOwnerSaveAppearance(string notecard); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 38391dfbb6..9e7c8da793 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -533,6 +533,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osNpcSit(npc, target, options); } + public void osNpcStand(LSL_Key npc) + { + m_OSSL_Functions.osNpcStand(npc); + } + public void osNpcRemove(key npc) { m_OSSL_Functions.osNpcRemove(npc);