diff --git a/Module/BirdsModule/FlockingModule.cs b/Module/BirdsModule/FlockingModule.cs index b27be40..e82925a 100644 --- a/Module/BirdsModule/FlockingModule.cs +++ b/Module/BirdsModule/FlockingModule.cs @@ -63,7 +63,8 @@ namespace Flocking private int m_frameUpdateRate = 1; private int m_chatChannel = 118; private string m_birdPrim; - private int m_flockSize = 100; + private int m_flockSize = 50; + private int m_maxFlockSize = 100; private float m_maxSpeed; private float m_maxForce; private float m_neighbourDistance; @@ -107,7 +108,8 @@ namespace Flocking { m_chatChannel = cnf.GetInt("BirdsChatChannel", 118); m_birdPrim = cnf.GetString("BirdsPrim", "birdPrim"); - m_flockSize = cnf.GetInt("BirdsFlockSize", 100); + m_flockSize = cnf.GetInt("BirdsFlockSize", 50); + m_maxFlockSize = cnf.GetInt("BirdsMaxFlockSize", 100); m_maxSpeed = cnf.GetFloat("BirdsMaxSpeed", 3f); m_maxForce = cnf.GetFloat("BirdsMaxForce", 0.25f); m_neighbourDistance = cnf.GetFloat("BirdsNeighbourDistance", 25f); @@ -348,7 +350,8 @@ namespace Flocking { if (ShouldHandleCmd ()) { lock( m_sync ) { - int newSize = Convert.ToInt32(args[1]); + int newSize = Convert.ToInt32(args[1]); + if (newSize > m_maxFlockSize) newSize = m_maxFlockSize; 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/README.md b/README.md index e694b8f..d73de75 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,8 @@ Here is an example config: [Test Region 1] BirdsEnabled = True ;set to false to disable the module in this region - BirdsFlockSize = 100 ;the number of birds to flock + BirdsFlockSize = 50 ;the number of birds to flock + BirdsMaxFlockSize = 100 ;the maximum flock size that can be created (keeps things sane) BirdsMaxSpeed = 3 ;how far each bird can travel per update BirdsMaxForce = 0.25 ;the maximum acceleration allowed to the current velocity of the bird BirdsNeighbourDistance = 25 ;max distance for other birds to be considered in the same flock as us @@ -42,6 +43,7 @@ Here is an example config: BirdsTolerance = 5 ;how close to the edges of things can we get without being worried BirdsBorderSize = 5 ;how close to the edge of a region can we get? BirdsMaxHeight = 256 ;how high are we allowed to flock + BirdsUpdateEveryNFrames = 1 ;update bird positions every N simulator frames BirdsPrim = seagull01 ;By default the module will create a flock of plain wooden spheres, ;however this can be overridden to the name of an existing prim that ;needs to already exist in the scene - i.e. be rezzed in the region.