From 8061edbed030890da691a113bba4fa16b596b071 Mon Sep 17 00:00:00 2001 From: Jak Daniels Date: Fri, 2 Jan 2015 13:32:46 +0000 Subject: [PATCH] Added more verbose info on console when commands are issued. Fixed in-world commands not working unless console region matched in-world region. Remove birds from scene on region shutdown. --- Module/BirdsModule/FlockingModule.cs | 30 ++++++++++++++++------------ Module/BirdsModule/FlockingView.cs | 3 ++- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Module/BirdsModule/FlockingModule.cs b/Module/BirdsModule/FlockingModule.cs index db8a66e..b27be40 100644 --- a/Module/BirdsModule/FlockingModule.cs +++ b/Module/BirdsModule/FlockingModule.cs @@ -152,7 +152,8 @@ namespace Flocking public void RemoveRegion (Scene scene) { m_log.InfoFormat("[{0}]: Removing region '{1}' from this module", m_name, scene.RegionInfo.RegionName); - if (m_enabled) { + if (m_enabled) { + m_view.Clear(); m_ready = false; scene.EventManager.OnFrame -= FlockUpdate; scene.EventManager.OnChatFromClient -= SimChatSent; @@ -209,7 +210,7 @@ namespace Flocking protected void SimChatSent (Object x, OSChatMessage msg) { - if (m_scene.ConsoleScene () != m_scene || msg.Channel != m_chatChannel) + if (msg.Channel != m_chatChannel) return; // not for us // try and parse a valid cmd from this msg @@ -297,8 +298,8 @@ namespace Flocking public void HandleDisableCmd(string module, string[] args) { - if (m_ready && ShouldHandleCmd ()) { - m_log.InfoFormat("[{0}]: Bird flocking is disabled.", m_name); + if (m_ready && ShouldHandleCmd ()) { + m_log.InfoFormat("[{0}]: Bird flocking is disabled in region {1}.", m_name, m_scene.RegionInfo.RegionName); m_enabled = false; m_ready = false; m_view.Clear(); @@ -308,8 +309,8 @@ namespace Flocking public void HandleEnableCmd(string module, string[] args) { if (!m_ready && ShouldHandleCmd()) - { - m_log.InfoFormat("[{0}]: Bird flocking is enabled.", m_name); + { + m_log.InfoFormat("[{0}]: Bird flocking is enabled in region {1}.", m_name, m_scene.RegionInfo.RegionName); m_enabled = true; m_ready = true; } @@ -318,8 +319,8 @@ namespace Flocking public void HandleStopCmd (string module, string[] args) { if (m_enabled && m_ready && ShouldHandleCmd()) - { - m_log.InfoFormat("[{0}]: Bird flocking is stopped.", m_name); + { + m_log.InfoFormat("[{0}]: Bird flocking is stopped in region {1}.", m_name, m_scene.RegionInfo.RegionName); m_enabled = false; } } @@ -327,8 +328,8 @@ namespace Flocking public void HandleStartCmd(string module, string[] args) { if (!m_enabled && m_ready && ShouldHandleCmd()) - { - m_log.InfoFormat("[{0}]: Bird flocking is started.", m_name); + { + m_log.InfoFormat("[{0}]: Bird flocking is started in region {1}.", m_name, m_scene.RegionInfo.RegionName); m_enabled = true; FlockUpdate(); } @@ -338,7 +339,8 @@ namespace Flocking { if (ShouldHandleCmd ()) { int frameRate = Convert.ToInt32( args[1] ); - m_frameUpdateRate = frameRate; + m_frameUpdateRate = frameRate; + m_log.InfoFormat("[{0}]: Bird updates set to every {1} frames in region {2}.", m_name, frameRate, m_scene.RegionInfo.RegionName); } } @@ -347,7 +349,8 @@ namespace Flocking if (ShouldHandleCmd ()) { lock( m_sync ) { int newSize = Convert.ToInt32(args[1]); - m_model.Size = newSize; + m_model.Size = newSize; + m_log.InfoFormat("[{0}]: Bird flock size is set to {1} in region {2}.", m_name, newSize, m_scene.RegionInfo.RegionName); m_view.Clear(); } } @@ -366,7 +369,8 @@ namespace Flocking if (ShouldHandleCmd ()) { string primName = args[1]; lock(m_sync) { - m_view.BirdPrim = primName; + m_view.BirdPrim = primName; + m_log.InfoFormat("[{0}]: Bird prim is set to {1} in region {2}.", m_name, primName, m_scene.RegionInfo.RegionName); m_view.Clear(); } } diff --git a/Module/BirdsModule/FlockingView.cs b/Module/BirdsModule/FlockingView.cs index e4701f6..7021eba 100644 --- a/Module/BirdsModule/FlockingView.cs +++ b/Module/BirdsModule/FlockingView.cs @@ -98,7 +98,8 @@ namespace Flocking m_scene.AddNewSceneObject (sog, false); } else { sog = existing.ParentGroup; - m_sogMap[bird.Id] = sog; + m_sogMap[bird.Id] = sog; + m_log.InfoFormat("[{0}]: Reusing prim {1} from region {2}", m_name, bird.Id, m_scene.RegionInfo.RegionName); rootPart = sog.RootPart; //set prim to phantom sog.UpdatePrimFlags(rootPart.LocalId, false, false, true, false);