Change Bird prims to temporary as well as phantom to stop them persisting in the database

pull/1/merge
Jak Daniels 2015-01-03 12:52:46 +00:00
parent 51cb61fb29
commit 173e046aba
4 changed files with 26 additions and 20 deletions

View File

@ -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<Bird>();
while( value > m_flock.Count ) {
AddBird(m_name + m_flock.Count);
}
}

View File

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

View File

@ -70,9 +70,9 @@ namespace Flocking
}
m_sogMap.Clear();
m_scene.ForceClientUpdate();
}
public void Render (List<Bird> birds)
}
public void Render(List<Bird> 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

View File

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