From b8114d2b67c8ae8d7551a2ece2177f8b7e958112 Mon Sep 17 00:00:00 2001 From: Talun Date: Tue, 24 Apr 2012 21:54:13 +0100 Subject: Add a version of osNpcSay that takes a channel number Mantis 5747 osNpcSay(UUID npc, string message) left untouched New functions:- osNpcSay(UUID npc, int channel, string message) osNpcShout(UUID npc, int channel, string message) osNpcWhisper(UUID npc, int channel, string message) Signed-off-by: BlueWall --- .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 21 +++++++---- .../Region/OptionalModules/World/NPC/NPCModule.cs | 43 +++++++++++++++++++++- 2 files changed, 55 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/OptionalModules/World') diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 5ea5af7..e57e5e6 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -76,22 +76,27 @@ namespace OpenSim.Region.OptionalModules.World.NPC public void Say(string message) { - SendOnChatFromClient(message, ChatTypeEnum.Say); + SendOnChatFromClient(0, message, ChatTypeEnum.Say); } - public void Shout(string message) + public void Say(int channel, string message) { - SendOnChatFromClient(message, ChatTypeEnum.Shout); + SendOnChatFromClient(channel, message, ChatTypeEnum.Say); } - public void Whisper(string message) + public void Shout(int channel, string message) { - SendOnChatFromClient(message, ChatTypeEnum.Whisper); + SendOnChatFromClient(channel, message, ChatTypeEnum.Shout); + } + + public void Whisper(int channel, string message) + { + SendOnChatFromClient(channel, message, ChatTypeEnum.Whisper); } public void Broadcast(string message) { - SendOnChatFromClient(message, ChatTypeEnum.Broadcast); + SendOnChatFromClient(0, message, ChatTypeEnum.Broadcast); } public void GiveMoney(UUID target, int amount) @@ -146,10 +151,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC #region Internal Functions - private void SendOnChatFromClient(string message, ChatTypeEnum chatType) + private void SendOnChatFromClient(int channel, string message, ChatTypeEnum chatType) { OSChatMessage chatFromClient = new OSChatMessage(); - chatFromClient.Channel = 0; + chatFromClient.Channel = channel; chatFromClient.From = Name; chatFromClient.Message = message; chatFromClient.Position = StartPos; diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 2b8379d..adc6f9c 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -212,6 +212,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC public bool Say(UUID agentID, Scene scene, string text) { + return Say(agentID, scene, text, 0); + } + + public bool Say(UUID agentID, Scene scene, string text, int channel) + { lock (m_avatars) { if (m_avatars.ContainsKey(agentID)) @@ -219,7 +224,25 @@ namespace OpenSim.Region.OptionalModules.World.NPC ScenePresence sp; scene.TryGetScenePresence(agentID, out sp); - m_avatars[agentID].Say(text); + m_avatars[agentID].Say(channel, text); + + return true; + } + } + + return false; + } + + public bool Shout(UUID agentID, Scene scene, string text, int channel) + { + lock (m_avatars) + { + if (m_avatars.ContainsKey(agentID)) + { + ScenePresence sp; + scene.TryGetScenePresence(agentID, out sp); + + m_avatars[agentID].Shout(channel, text); return true; } @@ -246,6 +269,24 @@ namespace OpenSim.Region.OptionalModules.World.NPC return false; } + public bool Whisper(UUID agentID, Scene scene, string text, int channel) + { + lock (m_avatars) + { + if (m_avatars.ContainsKey(agentID)) + { + ScenePresence sp; + scene.TryGetScenePresence(agentID, out sp); + + m_avatars[agentID].Whisper(channel, text); + + return true; + } + } + + return false; + } + public bool Stand(UUID agentID, Scene scene) { lock (m_avatars) -- cgit v1.1 From 07e62df5582e28675275b3f5143ec37e5697d283 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 27 Apr 2012 00:58:54 +0100 Subject: Add regression test for teleporting an agent between separated regions on the same simulator. This involves a large amount of change in test scene setup code to allow test scenes to share shared modules SetupScene is now an instance method that requires an instantiation of SceneHelpers, though other SceneHelpers methods are still static May split these out into separate classes in the future. --- OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/OptionalModules/World') diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index eea0b2e..a39257e 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs @@ -85,7 +85,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests m_attMod = new AttachmentsModule(); m_npcMod = new NPCModule(); - m_scene = SceneHelpers.SetupScene(); + m_scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule()); } -- cgit v1.1