* 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
parent
dee6ad7154
commit
aabaa35af7
|
@ -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_density = 50.0; // Aim for this many per region
|
||||||
public double m_tree_updates = 1000.0; // MS between updates
|
public double m_tree_updates = 1000.0; // MS between updates
|
||||||
|
private bool m_active_trees = false;
|
||||||
private List<UUID> m_trees;
|
private List<UUID> m_trees;
|
||||||
|
Timer CalculateTrees;
|
||||||
|
|
||||||
#region IRegionModule Members
|
#region IRegionModule Members
|
||||||
|
|
||||||
|
@ -57,6 +59,7 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_tree_density = config.Configs["Trees"].GetDouble("tree_density", m_tree_density);
|
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)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
@ -67,9 +70,9 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
|
||||||
|
|
||||||
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
|
m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
|
||||||
|
|
||||||
Timer CalculateTrees = new Timer(m_tree_updates);
|
if (m_active_trees)
|
||||||
CalculateTrees.Elapsed += CalculateTrees_Elapsed;
|
activeizeTreeze(true);
|
||||||
CalculateTrees.Start();
|
|
||||||
m_log.Debug("[TREES]: Initialised tree module");
|
m_log.Debug("[TREES]: Initialised tree module");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,13 +98,58 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
|
||||||
|
|
||||||
private void EventManager_OnPluginConsole(string[] args)
|
private void EventManager_OnPluginConsole(string[] args)
|
||||||
{
|
{
|
||||||
if (args[0] == "tree")
|
if (args.Length == 1)
|
||||||
{
|
{
|
||||||
UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner;
|
if (args[0] == "tree")
|
||||||
if (uuid == UUID.Zero)
|
{
|
||||||
uuid = m_scene.RegionInfo.MasterAvatarAssignedUUID;
|
UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner;
|
||||||
m_log.Debug("[TREES]: New tree planting");
|
if (uuid == UUID.Zero)
|
||||||
CreateTree(uuid, new Vector3(128.0f, 128.0f, 0.0f));
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -981,3 +981,11 @@ InterregionComms = "RESTComms"
|
||||||
; {0} is replaced with the region's name
|
; {0} is replaced with the region's name
|
||||||
; {1} is replaced with the region's UUID
|
; {1} is replaced with the region's UUID
|
||||||
broker = "http://broker.place.com/{1}"
|
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
|
Loading…
Reference in New Issue