aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/World/TreePopulator
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Modules/World/TreePopulator')
-rw-r--r--OpenSim/Region/Environment/Modules/World/TreePopulator/TreePopulatorModule.cs37
1 files changed, 18 insertions, 19 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/Environment/Modules/World/TreePopulator/TreePopulatorModule.cs
index 98b3bf8..bbd7b70 100644
--- a/OpenSim/Region/Environment/Modules/World/TreePopulator/TreePopulatorModule.cs
+++ b/OpenSim/Region/Environment/Modules/World/TreePopulator/TreePopulatorModule.cs
@@ -29,8 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Timers; 31using System.Timers;
32using Axiom.Math; 32using OpenMetaverse;
33using libsecondlife;
34using log4net; 33using log4net;
35using Nini.Config; 34using Nini.Config;
36using OpenSim.Framework; 35using OpenSim.Framework;
@@ -49,7 +48,7 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
49 48
50 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
51 public double m_tree_updates = 1000.0; // MS between updates 50 public double m_tree_updates = 1000.0; // MS between updates
52 private List<LLUUID> m_trees; 51 private List<UUID> m_trees;
53 52
54 #region IRegionModule Members 53 #region IRegionModule Members
55 54
@@ -63,7 +62,7 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
63 { 62 {
64 } 63 }
65 64
66 m_trees = new List<LLUUID>(); 65 m_trees = new List<UUID>();
67 m_scene = scene; 66 m_scene = scene;
68 67
69 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; 68 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
@@ -98,24 +97,24 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
98 { 97 {
99 if (args[0] == "tree") 98 if (args[0] == "tree")
100 { 99 {
101 LLUUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner; 100 UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner;
102 if (uuid == LLUUID.Zero) 101 if (uuid == UUID.Zero)
103 uuid = m_scene.RegionInfo.MasterAvatarAssignedUUID; 102 uuid = m_scene.RegionInfo.MasterAvatarAssignedUUID;
104 m_log.Debug("[TREES]: New tree planting"); 103 m_log.Debug("[TREES]: New tree planting");
105 CreateTree(uuid, new LLVector3(128.0f, 128.0f, 0.0f)); 104 CreateTree(uuid, new Vector3(128.0f, 128.0f, 0.0f));
106 } 105 }
107 } 106 }
108 107
109 private void growTrees() 108 private void growTrees()
110 { 109 {
111 foreach (LLUUID tree in m_trees) 110 foreach (UUID tree in m_trees)
112 { 111 {
113 if (m_scene.Entities.ContainsKey(tree)) 112 if (m_scene.Entities.ContainsKey(tree))
114 { 113 {
115 SceneObjectPart s_tree = ((SceneObjectGroup) m_scene.Entities[tree]).RootPart; 114 SceneObjectPart s_tree = ((SceneObjectGroup) m_scene.Entities[tree]).RootPart;
116 115
117 // 100 seconds to grow 1m 116 // 100 seconds to grow 1m
118 s_tree.Scale += new LLVector3(0.1f, 0.1f, 0.1f); 117 s_tree.Scale += new Vector3(0.1f, 0.1f, 0.1f);
119 s_tree.SendFullUpdateToAllClients(); 118 s_tree.SendFullUpdateToAllClients();
120 //s_tree.ScheduleTerseUpdate(); 119 //s_tree.ScheduleTerseUpdate();
121 } 120 }
@@ -128,7 +127,7 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
128 127
129 private void seedTrees() 128 private void seedTrees()
130 { 129 {
131 foreach (LLUUID tree in m_trees) 130 foreach (UUID tree in m_trees)
132 { 131 {
133 if (m_scene.Entities.ContainsKey(tree)) 132 if (m_scene.Entities.ContainsKey(tree))
134 { 133 {
@@ -151,7 +150,7 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
151 150
152 private void killTrees() 151 private void killTrees()
153 { 152 {
154 foreach (LLUUID tree in m_trees) 153 foreach (UUID tree in m_trees)
155 { 154 {
156 double killLikelyhood = 0.0; 155 double killLikelyhood = 0.0;
157 156
@@ -162,7 +161,7 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
162 Math.Pow(selectedTree.Scale.Y, 2) + 161 Math.Pow(selectedTree.Scale.Y, 2) +
163 Math.Pow(selectedTree.Scale.Z, 2)); 162 Math.Pow(selectedTree.Scale.Z, 2));
164 163
165 foreach (LLUUID picktree in m_trees) 164 foreach (UUID picktree in m_trees)
166 { 165 {
167 if (picktree != tree) 166 if (picktree != tree)
168 { 167 {
@@ -187,7 +186,7 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
187 186
188 m_scene.ForEachClient(delegate(IClientAPI controller) 187 m_scene.ForEachClient(delegate(IClientAPI controller)
189 { 188 {
190 controller.SendKillObject(m_scene.RegionInfo.RegionHandle, 189 controller.SendKiPrimitive(m_scene.RegionInfo.RegionHandle,
191 selectedTree.LocalId); 190 selectedTree.LocalId);
192 }); 191 });
193 192
@@ -204,7 +203,7 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
204 203
205 private void SpawnChild(SceneObjectPart s_tree) 204 private void SpawnChild(SceneObjectPart s_tree)
206 { 205 {
207 LLVector3 position = new LLVector3(); 206 Vector3 position = new Vector3();
208 207
209 position.X = s_tree.AbsolutePosition.X + (1 * (-1 * Util.RandomClass.Next(1))); 208 position.X = s_tree.AbsolutePosition.X + (1 * (-1 * Util.RandomClass.Next(1)));
210 if (position.X > 255) 209 if (position.X > 255)
@@ -223,20 +222,20 @@ namespace OpenSim.Region.Environment.Modules.World.TreePopulator
223 position.X += (float) randX; 222 position.X += (float) randX;
224 position.Y += (float) randY; 223 position.Y += (float) randY;
225 224
226 LLUUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner; 225 UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner;
227 if (uuid == LLUUID.Zero) 226 if (uuid == UUID.Zero)
228 uuid = m_scene.RegionInfo.MasterAvatarAssignedUUID; 227 uuid = m_scene.RegionInfo.MasterAvatarAssignedUUID;
229 228
230 CreateTree(uuid, position); 229 CreateTree(uuid, position);
231 } 230 }
232 231
233 private void CreateTree(LLUUID uuid, LLVector3 position) 232 private void CreateTree(UUID uuid, Vector3 position)
234 { 233 {
235 position.Z = (float) m_scene.Heightmap[(int) position.X, (int) position.Y]; 234 position.Z = (float) m_scene.Heightmap[(int) position.X, (int) position.Y];
236 235
237 SceneObjectGroup tree = 236 SceneObjectGroup tree =
238 m_scene.AddTree(uuid, new LLVector3(0.1f, 0.1f, 0.1f), 237 m_scene.AddTree(uuid, new Vector3(0.1f, 0.1f, 0.1f),
239 LLQuaternion.Identity, 238 Quaternion.Identity,
240 position, 239 position,
241 Tree.Cypress1, 240 Tree.Cypress1,
242 false); 241 false);