Fix removeing object from scene and using existing objects
parent
ca41de0286
commit
80dfa5a0d6
|
@ -220,17 +220,21 @@ namespace Flocking
|
|||
string[] args = (cmd + " <ui>").Split (" ".ToCharArray ());
|
||||
|
||||
if (cmd.StartsWith ("stop")) {
|
||||
HandleStopCmd ("flock", args);
|
||||
HandleStopCmd (m_name, args);
|
||||
} else if (cmd.StartsWith ("start")) {
|
||||
HandleStartCmd ("flock", args);
|
||||
HandleStartCmd (m_name, args);
|
||||
} else if (cmd.StartsWith("enable")) {
|
||||
HandleEnableCmd(m_name, args);
|
||||
} else if (cmd.StartsWith("disable")) {
|
||||
HandleDisableCmd(m_name, args);
|
||||
} else if (cmd.StartsWith ("size")) {
|
||||
HandleSetSizeCmd ("flock", args);
|
||||
HandleSetSizeCmd (m_name, args);
|
||||
} else if (cmd.StartsWith ("stats")) {
|
||||
HandleShowStatsCmd ("flock", args);
|
||||
HandleShowStatsCmd (m_name, args);
|
||||
} else if (cmd.StartsWith ("prim")) {
|
||||
HandleSetPrimCmd ("flock", args);
|
||||
HandleSetPrimCmd (m_name, args);
|
||||
} else if (cmd.StartsWith ("framerate")) {
|
||||
HandleSetFrameRateCmd ("flock", args);
|
||||
HandleSetFrameRateCmd (m_name, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -264,24 +268,19 @@ namespace Flocking
|
|||
|
||||
private bool ShouldHandleCmd ()
|
||||
{
|
||||
if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
|
||||
{
|
||||
m_log.InfoFormat("[{0}]: Command Ignored!", m_name);
|
||||
if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) {
|
||||
return false;
|
||||
} else {
|
||||
m_log.InfoFormat("[{0}]: Command Executed!", m_name);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool IsInWorldCmd (ref string [] args)
|
||||
{
|
||||
bool retVal = false;
|
||||
|
||||
if (args.Length > 0 && args [args.Length - 1].Equals ("<ui>")) {
|
||||
retVal = true;
|
||||
m_log.InfoFormat("[{0}]: Inworld command detected in region {1}", m_name, m_scene.RegionInfo.RegionName);
|
||||
return true;
|
||||
}
|
||||
return retVal;
|
||||
return false;
|
||||
}
|
||||
|
||||
private void ShowResponse (string response, bool inWorld)
|
||||
|
@ -311,7 +310,6 @@ namespace Flocking
|
|||
if (!m_ready && ShouldHandleCmd())
|
||||
{
|
||||
m_log.InfoFormat("[{0}]: Bird flocking is enabled.", m_name);
|
||||
FlockInitialise();
|
||||
m_enabled = true;
|
||||
m_ready = true;
|
||||
}
|
||||
|
|
|
@ -65,9 +65,11 @@ namespace Flocking
|
|||
foreach (string name in m_sogMap.Keys)
|
||||
{
|
||||
m_log.InfoFormat("[{0}]: Removing prim {1} from region {2}", m_name, name, m_scene.RegionInfo.RegionName);
|
||||
RemoveSOGFromScene(name);
|
||||
SceneObjectGroup sog = m_sogMap[name];
|
||||
m_scene.DeleteSceneObject(sog, false);
|
||||
}
|
||||
m_sogMap.Clear();
|
||||
m_scene.ForceClientUpdate();
|
||||
}
|
||||
|
||||
public void Render (List<Bird> birds)
|
||||
|
@ -96,6 +98,7 @@ namespace Flocking
|
|||
m_scene.AddNewSceneObject (sog, false);
|
||||
} else {
|
||||
sog = existing.ParentGroup;
|
||||
m_sogMap[bird.Id] = sog;
|
||||
rootPart = sog.RootPart;
|
||||
//set prim to phantom
|
||||
sog.UpdatePrimFlags(rootPart.LocalId, false, false, true, false);
|
||||
|
@ -162,14 +165,6 @@ namespace Flocking
|
|||
return prim;
|
||||
}
|
||||
|
||||
private void RemoveSOGFromScene(string sogName)
|
||||
{
|
||||
SceneObjectGroup sog = m_sogMap[sogName];
|
||||
m_scene.DeleteSceneObject(sog, false);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue