Added BirdsMaxFlockSize ini setting to keep max number of birds sane.

Updated documentation.
pull/1/merge
Jak Daniels 2015-01-02 15:45:17 +00:00
parent 42e7f6af6f
commit 4187440a4c
2 changed files with 9 additions and 4 deletions

View File

@ -63,7 +63,8 @@ namespace Flocking
private int m_frameUpdateRate = 1; private int m_frameUpdateRate = 1;
private int m_chatChannel = 118; private int m_chatChannel = 118;
private string m_birdPrim; 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_maxSpeed;
private float m_maxForce; private float m_maxForce;
private float m_neighbourDistance; private float m_neighbourDistance;
@ -107,7 +108,8 @@ namespace Flocking
{ {
m_chatChannel = cnf.GetInt("BirdsChatChannel", 118); m_chatChannel = cnf.GetInt("BirdsChatChannel", 118);
m_birdPrim = cnf.GetString("BirdsPrim", "birdPrim"); 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_maxSpeed = cnf.GetFloat("BirdsMaxSpeed", 3f);
m_maxForce = cnf.GetFloat("BirdsMaxForce", 0.25f); m_maxForce = cnf.GetFloat("BirdsMaxForce", 0.25f);
m_neighbourDistance = cnf.GetFloat("BirdsNeighbourDistance", 25f); m_neighbourDistance = cnf.GetFloat("BirdsNeighbourDistance", 25f);
@ -348,7 +350,8 @@ namespace Flocking
{ {
if (ShouldHandleCmd ()) { if (ShouldHandleCmd ()) {
lock( m_sync ) { 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_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_log.InfoFormat("[{0}]: Bird flock size is set to {1} in region {2}.", m_name, newSize, m_scene.RegionInfo.RegionName);
m_view.Clear(); m_view.Clear();

View File

@ -34,7 +34,8 @@ Here is an example config:
[Test Region 1] [Test Region 1]
BirdsEnabled = True ;set to false to disable the module in this region 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 BirdsMaxSpeed = 3 ;how far each bird can travel per update
BirdsMaxForce = 0.25 ;the maximum acceleration allowed to the current velocity of the bird 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 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 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? BirdsBorderSize = 5 ;how close to the edge of a region can we get?
BirdsMaxHeight = 256 ;how high are we allowed to flock 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, 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 ;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. ;needs to already exist in the scene - i.e. be rezzed in the region.