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.
pull/1/merge
Jak Daniels 2015-01-02 13:32:46 +00:00
parent 9dc171e731
commit 8061edbed0
2 changed files with 19 additions and 14 deletions

View File

@ -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();
}
}

View File

@ -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);