Normalise line endings (again)
parent
4b0854fcc1
commit
3ce758d96a
|
@ -77,7 +77,7 @@ namespace Flocking
|
||||||
private float m_borderSize;
|
private float m_borderSize;
|
||||||
private int m_maxHeight;
|
private int m_maxHeight;
|
||||||
private Vector3 m_shoutPos = new Vector3(128f, 128f, 30f);
|
private Vector3 m_shoutPos = new Vector3(128f, 128f, 30f);
|
||||||
static object m_sync = new object();
|
static object m_sync = new object();
|
||||||
private List<UUID> m_allowedControllers = new List<UUID>();
|
private List<UUID> m_allowedControllers = new List<UUID>();
|
||||||
|
|
||||||
public IConfigSource m_config;
|
public IConfigSource m_config;
|
||||||
|
@ -130,83 +130,83 @@ namespace Flocking
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_startup = cnf.GetBoolean("BirdsModuleStartup", true);
|
m_startup = cnf.GetBoolean("BirdsModuleStartup", true);
|
||||||
|
|
||||||
if (m_startup)
|
if (m_startup)
|
||||||
{
|
{
|
||||||
m_scene = scene;
|
m_scene = scene;
|
||||||
m_enabled = cnf.GetBoolean("BirdsEnabled", false);
|
m_enabled = cnf.GetBoolean("BirdsEnabled", false);
|
||||||
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", 20);
|
m_flockSize = cnf.GetInt("BirdsFlockSize", 20);
|
||||||
m_maxFlockSize = cnf.GetInt("BirdsMaxFlockSize", 100);
|
m_maxFlockSize = cnf.GetInt("BirdsMaxFlockSize", 100);
|
||||||
m_maxSpeed = cnf.GetFloat("BirdsMaxSpeed", 1.5f);
|
m_maxSpeed = cnf.GetFloat("BirdsMaxSpeed", 1.5f);
|
||||||
m_maxForce = cnf.GetFloat("BirdsMaxForce", 0.2f);
|
m_maxForce = cnf.GetFloat("BirdsMaxForce", 0.2f);
|
||||||
m_neighbourDistance = cnf.GetFloat("BirdsNeighbourDistance", 25f);
|
m_neighbourDistance = cnf.GetFloat("BirdsNeighbourDistance", 25f);
|
||||||
m_desiredSeparation = cnf.GetFloat("BirdsDesiredSeparation", 10f);
|
m_desiredSeparation = cnf.GetFloat("BirdsDesiredSeparation", 10f);
|
||||||
m_tolerance = cnf.GetFloat("BirdsTolerance", 5f);
|
m_tolerance = cnf.GetFloat("BirdsTolerance", 5f);
|
||||||
m_borderSize = cnf.GetFloat("BirdsRegionBorderSize", 5f);
|
m_borderSize = cnf.GetFloat("BirdsRegionBorderSize", 5f);
|
||||||
m_maxHeight = cnf.GetInt("BirdsMaxHeight", 75);
|
m_maxHeight = cnf.GetInt("BirdsMaxHeight", 75);
|
||||||
m_frameUpdateRate = cnf.GetInt("BirdsUpdateEveryNFrames", 1);
|
m_frameUpdateRate = cnf.GetInt("BirdsUpdateEveryNFrames", 1);
|
||||||
|
|
||||||
string allowedControllers = cnf.GetString("BirdsAllowedControllers", UUID.Zero.ToString());
|
string allowedControllers = cnf.GetString("BirdsAllowedControllers", UUID.Zero.ToString());
|
||||||
if (allowedControllers != UUID.Zero.ToString())
|
if (allowedControllers != UUID.Zero.ToString())
|
||||||
{
|
{
|
||||||
string[] ac = allowedControllers.Split(new char[] { ',' });
|
string[] ac = allowedControllers.Split(new char[] { ',' });
|
||||||
UUID acUUID;
|
UUID acUUID;
|
||||||
for (int i = 0; i < ac.Length; i++)
|
for (int i = 0; i < ac.Length; i++)
|
||||||
{
|
{
|
||||||
string value = ac[i].Trim();
|
string value = ac[i].Trim();
|
||||||
if (value == "ESTATE_OWNER")
|
if (value == "ESTATE_OWNER")
|
||||||
{
|
{
|
||||||
UUID eoUUID = m_scene.RegionInfo.EstateSettings.EstateOwner;
|
UUID eoUUID = m_scene.RegionInfo.EstateSettings.EstateOwner;
|
||||||
m_allowedControllers.Add(eoUUID);
|
m_allowedControllers.Add(eoUUID);
|
||||||
m_log.InfoFormat("[{0}] Added Estate Owner UUID: {1} to list of allowed users", m_name, eoUUID.ToString());
|
m_log.InfoFormat("[{0}] Added Estate Owner UUID: {1} to list of allowed users", m_name, eoUUID.ToString());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (value == "ESTATE_MANAGER")
|
if (value == "ESTATE_MANAGER")
|
||||||
{
|
{
|
||||||
foreach (UUID emUUID in m_scene.RegionInfo.EstateSettings.EstateManagers)
|
foreach (UUID emUUID in m_scene.RegionInfo.EstateSettings.EstateManagers)
|
||||||
{
|
{
|
||||||
m_allowedControllers.Add(emUUID);
|
m_allowedControllers.Add(emUUID);
|
||||||
m_log.InfoFormat("[{0}] Added Estate Manager UUID: {1} to list of allowed users", m_name, emUUID.ToString());
|
m_log.InfoFormat("[{0}] Added Estate Manager UUID: {1} to list of allowed users", m_name, emUUID.ToString());
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (UUID.TryParse(ac[i].Trim(), out acUUID))
|
if (UUID.TryParse(ac[i].Trim(), out acUUID))
|
||||||
{
|
{
|
||||||
m_allowedControllers.Add(acUUID);
|
m_allowedControllers.Add(acUUID);
|
||||||
m_log.InfoFormat("[{0}] Added UUID: {1} to list of allowed users", m_name, acUUID.ToString());
|
m_log.InfoFormat("[{0}] Added UUID: {1} to list of allowed users", m_name, acUUID.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.InfoFormat("[{0}] No command security was defined in the config. Any user may possibly configure this module from a script!", m_name);
|
m_log.InfoFormat("[{0}] No command security was defined in the config. Any user may possibly configure this module from a script!", m_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_log.InfoFormat("[{0}] Module is {1} listening for commands on channel {2} with Flock Size {3}", m_name, m_enabled ? "enabled and" : "disabled, but still", m_chatChannel, m_flockSize);
|
m_log.InfoFormat("[{0}] Module is {1} listening for commands on channel {2} with Flock Size {3}", m_name, m_enabled ? "enabled and" : "disabled, but still", m_chatChannel, m_flockSize);
|
||||||
|
|
||||||
m_console = MainConsole.Instance;
|
m_console = MainConsole.Instance;
|
||||||
//register commands with the scene
|
//register commands with the scene
|
||||||
RegisterCommands();
|
RegisterCommands();
|
||||||
|
|
||||||
//register handlers
|
//register handlers
|
||||||
m_scene.EventManager.OnFrame += FlockUpdate;
|
m_scene.EventManager.OnFrame += FlockUpdate;
|
||||||
m_scene.EventManager.OnChatFromClient += SimChatSent; //listen for commands sent from the client
|
m_scene.EventManager.OnChatFromClient += SimChatSent; //listen for commands sent from the client
|
||||||
m_scene.EventManager.OnChatFromWorld += SimChatSent;
|
m_scene.EventManager.OnChatFromWorld += SimChatSent;
|
||||||
m_scene.EventManager.OnPrimsLoaded += PrimsLoaded;
|
m_scene.EventManager.OnPrimsLoaded += PrimsLoaded;
|
||||||
|
|
||||||
// init module
|
// init module
|
||||||
m_model = new FlockingModel(m_name, m_maxSpeed, m_maxForce, m_neighbourDistance, m_desiredSeparation, m_tolerance, m_borderSize);
|
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 = new FlockingView(m_name, m_scene);
|
||||||
m_view.BirdPrim = m_birdPrim;
|
m_view.BirdPrim = m_birdPrim;
|
||||||
m_frame = 0;
|
m_frame = 0;
|
||||||
m_shoutPos = new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 30f);
|
m_shoutPos = new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 30f);
|
||||||
|
|
||||||
FlockInitialise();
|
FlockInitialise();
|
||||||
|
|
||||||
}
|
}
|
||||||
else m_log.InfoFormat("[{0}] Module is disabled in Region {1}", m_name, scene.RegionInfo.RegionName);
|
else m_log.InfoFormat("[{0}] Module is disabled in Region {1}", m_name, scene.RegionInfo.RegionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,19 +310,19 @@ namespace Flocking
|
||||||
|
|
||||||
protected void SimChatSent (Object x, OSChatMessage msg)
|
protected void SimChatSent (Object x, OSChatMessage msg)
|
||||||
{
|
{
|
||||||
if (msg.Channel != m_chatChannel) return; // not for us
|
if (msg.Channel != m_chatChannel) return; // not for us
|
||||||
if (m_allowedControllers.Count > 0)
|
if (m_allowedControllers.Count > 0)
|
||||||
{
|
{
|
||||||
bool reject = true;
|
bool reject = true;
|
||||||
if (msg.SenderObject != null)
|
if (msg.SenderObject != null)
|
||||||
{
|
{
|
||||||
UUID ooUUID = ((SceneObjectPart)msg.SenderObject).OwnerID;
|
UUID ooUUID = ((SceneObjectPart)msg.SenderObject).OwnerID;
|
||||||
//m_log.InfoFormat("[{0}]: Message from object {1} with OwnerID: {2}", m_name, msg.SenderUUID, ooUUID);
|
//m_log.InfoFormat("[{0}]: Message from object {1} with OwnerID: {2}", m_name, msg.SenderUUID, ooUUID);
|
||||||
if (m_allowedControllers.Contains(ooUUID)) reject = false;
|
if (m_allowedControllers.Contains(ooUUID)) reject = false;
|
||||||
}
|
}
|
||||||
if (m_allowedControllers.Contains(msg.SenderUUID)) reject = false;
|
if (m_allowedControllers.Contains(msg.SenderUUID)) reject = false;
|
||||||
|
|
||||||
if (reject) return; //not for us
|
if (reject) return; //not for us
|
||||||
}
|
}
|
||||||
|
|
||||||
// try and parse a valid cmd from this msg
|
// try and parse a valid cmd from this msg
|
||||||
|
|
Loading…
Reference in New Issue