aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTeravus Ovares2009-02-02 06:04:03 +0000
committerTeravus Ovares2009-02-02 06:04:03 +0000
commitaabaa35af76cc8e8d4ec990bb451bb985ab0c7d2 (patch)
tree1bd30bb934af0f7af701f2fe88ccb038d2533869 /OpenSim
parentPutting the return back in AddCapsHandler upon attempt at adding CAPs twice. ... (diff)
downloadopensim-SC_OLD-aabaa35af76cc8e8d4ec990bb451bb985ab0c7d2.zip
opensim-SC_OLD-aabaa35af76cc8e8d4ec990bb451bb985ab0c7d2.tar.gz
opensim-SC_OLD-aabaa35af76cc8e8d4ec990bb451bb985ab0c7d2.tar.bz2
opensim-SC_OLD-aabaa35af76cc8e8d4ec990bb451bb985ab0c7d2.tar.xz
* 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.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Environment/Modules/World/TreePopulator/TreePopulatorModule.cs66
1 files changed, 57 insertions, 9 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/Environment/Modules/World/TreePopulator/TreePopulatorModule.cs
index 8061648..a1261cb 100644
--- a/OpenSim/Region/Environment/Modules/World/TreePopulator/TreePopulatorModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/TreePopulator/TreePopulatorModule.cs
@@ -48,7 +48,9 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
48 48
49 public double m_tree_density = 50.0; // Aim for this many per region 49 public double m_tree_density = 50.0; // Aim for this many per region
50 public double m_tree_updates = 1000.0; // MS between updates 50 public double m_tree_updates = 1000.0; // MS between updates
51 private bool m_active_trees = false;
51 private List<UUID> m_trees; 52 private List<UUID> m_trees;
53 Timer CalculateTrees;
52 54
53 #region IRegionModule Members 55 #region IRegionModule Members
54 56
@@ -57,6 +59,7 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
57 try 59 try
58 { 60 {
59 m_tree_density = config.Configs["Trees"].GetDouble("tree_density", m_tree_density); 61 m_tree_density = config.Configs["Trees"].GetDouble("tree_density", m_tree_density);
62 m_active_trees = config.Configs["Trees"].GetBoolean("active_trees", m_active_trees);
60 } 63 }
61 catch (Exception) 64 catch (Exception)
62 { 65 {
@@ -67,9 +70,9 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
67 70
68 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; 71 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
69 72
70 Timer CalculateTrees = new Timer(m_tree_updates); 73 if (m_active_trees)
71 CalculateTrees.Elapsed += CalculateTrees_Elapsed; 74 activeizeTreeze(true);
72 CalculateTrees.Start(); 75
73 m_log.Debug("[TREES]: Initialised tree module"); 76 m_log.Debug("[TREES]: Initialised tree module");
74 } 77 }
75 78
@@ -95,16 +98,61 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
95 98
96 private void EventManager_OnPluginConsole(string[] args) 99 private void EventManager_OnPluginConsole(string[] args)
97 { 100 {
98 if (args[0] == "tree") 101 if (args.Length == 1)
99 { 102 {
100 UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner; 103 if (args[0] == "tree")
101 if (uuid == UUID.Zero) 104 {
102 uuid = m_scene.RegionInfo.MasterAvatarAssignedUUID; 105 UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner;
103 m_log.Debug("[TREES]: New tree planting"); 106 if (uuid == UUID.Zero)
104 CreateTree(uuid, new Vector3(128.0f, 128.0f, 0.0f)); 107 uuid = m_scene.RegionInfo.MasterAvatarAssignedUUID;
108 m_log.Debug("[TREES]: New tree planting");
109 CreateTree(uuid, new Vector3(128.0f, 128.0f, 0.0f));
110
111 }
105 } 112 }
113
114 if (args.Length == 2 || args.Length == 3)
115 {
116 if (args[1] == "active")
117 {
118 if (args.Length >= 3)
119 {
120 if (args[2] == "true" && !m_active_trees)
121 {
122 m_active_trees = true;
123 activeizeTreeze(m_active_trees);
124 m_log.Info("[TREES]: Activizing Trees");
125 }
126 if (args[2] == "false" && m_active_trees)
127 {
128 m_active_trees = false;
129 activeizeTreeze(m_active_trees);
130 m_log.Info("[TREES]: Trees no longer Active, for now...");
131 }
132 }
133 else
134 {
135 m_log.Info("[TREES]: When setting the tree module active via the console, you must specify true or false");
136 }
137 }
138 }
139
106 } 140 }
107 141
142 private void activeizeTreeze(bool activeYN)
143 {
144 if (activeYN)
145 {
146 CalculateTrees = new Timer(m_tree_updates);
147 CalculateTrees.Elapsed += CalculateTrees_Elapsed;
148 CalculateTrees.Start();
149 }
150 else
151 {
152 CalculateTrees.Stop();
153 }
154 }
155
108 private void growTrees() 156 private void growTrees()
109 { 157 {
110 foreach (UUID tree in m_trees) 158 foreach (UUID tree in m_trees)