* Adding the Tree module configuration options to OpenSim.ini.example

* Adding an option to use the tree module to manage the trees in the simulator (grow/reproduce/die)
* Setting it to off by default in an effort to reduce the number of threads in use by default
* You can also turn it on in a 'one off' way with 'tree active true' on the console. To 'one off' turn it off, it's 'tree active false'.  The permanent way to do that, however is in the opensim.ini.
0.6.3-post-fixes
Teravus Ovares 2009-02-02 06:04:03 +00:00
parent dee6ad7154
commit aabaa35af7
2 changed files with 65 additions and 9 deletions

View File

@ -48,7 +48,9 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
public double m_tree_density = 50.0; // Aim for this many per region
public double m_tree_updates = 1000.0; // MS between updates
private bool m_active_trees = false;
private List<UUID> m_trees;
Timer CalculateTrees;
#region IRegionModule Members
@ -57,6 +59,7 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
try
{
m_tree_density = config.Configs["Trees"].GetDouble("tree_density", m_tree_density);
m_active_trees = config.Configs["Trees"].GetBoolean("active_trees", m_active_trees);
}
catch (Exception)
{
@ -67,9 +70,9 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
Timer CalculateTrees = new Timer(m_tree_updates);
CalculateTrees.Elapsed += CalculateTrees_Elapsed;
CalculateTrees.Start();
if (m_active_trees)
activeizeTreeze(true);
m_log.Debug("[TREES]: Initialised tree module");
}
@ -95,16 +98,61 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
private void EventManager_OnPluginConsole(string[] args)
{
if (args[0] == "tree")
if (args.Length == 1)
{
UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner;
if (uuid == UUID.Zero)
uuid = m_scene.RegionInfo.MasterAvatarAssignedUUID;
m_log.Debug("[TREES]: New tree planting");
CreateTree(uuid, new Vector3(128.0f, 128.0f, 0.0f));
if (args[0] == "tree")
{
UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner;
if (uuid == UUID.Zero)
uuid = m_scene.RegionInfo.MasterAvatarAssignedUUID;
m_log.Debug("[TREES]: New tree planting");
CreateTree(uuid, new Vector3(128.0f, 128.0f, 0.0f));
}
}
if (args.Length == 2 || args.Length == 3)
{
if (args[1] == "active")
{
if (args.Length >= 3)
{
if (args[2] == "true" && !m_active_trees)
{
m_active_trees = true;
activeizeTreeze(m_active_trees);
m_log.Info("[TREES]: Activizing Trees");
}
if (args[2] == "false" && m_active_trees)
{
m_active_trees = false;
activeizeTreeze(m_active_trees);
m_log.Info("[TREES]: Trees no longer Active, for now...");
}
}
else
{
m_log.Info("[TREES]: When setting the tree module active via the console, you must specify true or false");
}
}
}
}
private void activeizeTreeze(bool activeYN)
{
if (activeYN)
{
CalculateTrees = new Timer(m_tree_updates);
CalculateTrees.Elapsed += CalculateTrees_Elapsed;
CalculateTrees.Start();
}
else
{
CalculateTrees.Stop();
}
}
private void growTrees()
{
foreach (UUID tree in m_trees)

View File

@ -981,3 +981,11 @@ InterregionComms = "RESTComms"
; {0} is replaced with the region's name
; {1} is replaced with the region's UUID
broker = "http://broker.place.com/{1}"
[Trees]
; Enable this to allow the tree module to manage your sim trees, including growing, reproducing and dying
active_trees = false
; Density of tree population
tree_density = 1000.0