diff --git a/Module/BirdsModule/FlockingModel.cs b/Module/BirdsModule/FlockingModel.cs index 3ba8494..1a05488 100644 --- a/Module/BirdsModule/FlockingModel.cs +++ b/Module/BirdsModule/FlockingModel.cs @@ -48,9 +48,11 @@ namespace Flocking public int Size { get {return m_flock.Count;} set { - if( value < m_flock.Count ) { - m_flock.RemoveRange( 0, m_flock.Count - value ); - } else while( value > m_flock.Count ) { + //if( value < m_flock.Count ) { + // m_flock.RemoveRange( 0, m_flock.Count - value ); + //} else + m_flock = new List(); + while( value > m_flock.Count ) { AddBird(m_name + m_flock.Count); } } diff --git a/Module/BirdsModule/FlockingModule.cs b/Module/BirdsModule/FlockingModule.cs index ebccb0e..cf76216 100644 --- a/Module/BirdsModule/FlockingModule.cs +++ b/Module/BirdsModule/FlockingModule.cs @@ -136,7 +136,7 @@ namespace Flocking m_model = new FlockingModel(m_name, m_maxSpeed, m_maxForce, m_neighbourDistance, m_desiredSeparation, m_tolerance, m_borderSize); m_view = new FlockingView(m_name, m_scene); m_view.BirdPrim = m_birdPrim; - m_frame = 0; + m_frame = 0; FlockInitialise(); @@ -144,9 +144,9 @@ namespace Flocking } public void RegionLoaded (Scene scene) - { - //m_scene = scene; - if (m_enabled) { + { + if (m_enabled) + { // Mark Module Ready for duty m_ready = true; } @@ -191,8 +191,8 @@ namespace Flocking // who is the owner for the flock in this region m_owner = m_scene.RegionInfo.EstateSettings.EstateOwner; m_view.PostInitialize(m_owner); - } - + } + #endregion #region EventHandlers @@ -354,10 +354,11 @@ namespace Flocking if (ShouldHandleCmd ()) { lock( m_sync ) { int newSize = Convert.ToInt32(args[1]); - if (newSize > m_maxFlockSize) newSize = m_maxFlockSize; - m_model.Size = newSize; + if (newSize > m_maxFlockSize) newSize = m_maxFlockSize; + m_view.Clear(); + 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(); + } } } diff --git a/Module/BirdsModule/FlockingView.cs b/Module/BirdsModule/FlockingView.cs index 2434ebe..612bef7 100644 --- a/Module/BirdsModule/FlockingView.cs +++ b/Module/BirdsModule/FlockingView.cs @@ -70,9 +70,9 @@ namespace Flocking } m_sogMap.Clear(); m_scene.ForceClientUpdate(); - } - - public void Render (List birds) + } + + public void Render(List birds) { foreach (Bird bird in birds) { DrawBird (bird); @@ -93,7 +93,7 @@ namespace Flocking sog = CopyPrim (group, bird.Id); rootPart = sog.RootPart; //set prim to phantom - sog.UpdatePrimFlags(rootPart.LocalId, false, false, true, false); + sog.UpdatePrimFlags(rootPart.LocalId, false, true, true, false); m_sogMap [bird.Id] = sog; m_scene.AddNewSceneObject (sog, false); // Fire script on_rez diff --git a/Module/BirdsModule/FlowMap.cs b/Module/BirdsModule/FlowMap.cs index 3c4b6c7..da258b7 100644 --- a/Module/BirdsModule/FlowMap.cs +++ b/Module/BirdsModule/FlowMap.cs @@ -181,10 +181,13 @@ namespace Flocking } public bool IsWithinObstacle( int x, int y, int z ) { - bool retVal = false; - if( x >= LengthX || y >= LengthY || z >= LengthZ ) { - retVal = true; - } else if( x < 0 || y < 0 || z < 0 ) { + bool retVal = false; + if (x >= LengthX || y >= LengthY || z >= LengthZ) + { + retVal = true; + } + else if (x < 0 || y < 0 || z < 0) + { retVal = true; } else if (m_flowMap[x,y,z] > 50f) { retVal = true;