diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs | 91 |
1 files changed, 47 insertions, 44 deletions
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs index bdd875a..6e1f8bb 100644 --- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs +++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs | |||
@@ -282,54 +282,57 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
282 | string copsename = ((string)args[0]).Trim(); | 282 | string copsename = ((string)args[0]).Trim(); |
283 | Boolean freezeState = (Boolean) args[1]; | 283 | Boolean freezeState = (Boolean) args[1]; |
284 | 284 | ||
285 | foreach (Copse cp in m_copses) | 285 | lock(mylock) |
286 | { | 286 | { |
287 | if (cp.m_name == copsename) | 287 | foreach (Copse cp in m_copses) |
288 | continue; | ||
289 | |||
290 | if(!cp.m_frozen && freezeState || cp.m_frozen && !freezeState) | ||
291 | { | 288 | { |
292 | cp.m_frozen = freezeState; | 289 | if (cp.m_name != copsename) |
293 | List<UUID> losttrees = new List<UUID>(); | 290 | continue; |
294 | foreach (UUID tree in cp.m_trees) | 291 | |
292 | if(!cp.m_frozen && freezeState || cp.m_frozen && !freezeState) | ||
295 | { | 293 | { |
296 | SceneObjectGroup sog = m_scene.GetSceneObjectGroup(tree); | 294 | cp.m_frozen = freezeState; |
297 | if(sog != null && !sog.IsDeleted) | 295 | List<UUID> losttrees = new List<UUID>(); |
296 | foreach (UUID tree in cp.m_trees) | ||
298 | { | 297 | { |
299 | SceneObjectPart sop = sog.RootPart; | 298 | SceneObjectGroup sog = m_scene.GetSceneObjectGroup(tree); |
300 | string name = sop.Name; | 299 | if(sog != null && !sog.IsDeleted) |
301 | if(freezeState) | ||
302 | { | 300 | { |
303 | if(name.StartsWith("FTPM")) | 301 | SceneObjectPart sop = sog.RootPart; |
304 | continue; | 302 | string name = sop.Name; |
305 | if(!name.StartsWith("ATPM")) | 303 | if(freezeState) |
306 | continue; | 304 | { |
307 | sop.Name = sop.Name.Replace("ATPM", "FTPM"); | 305 | if(name.StartsWith("FTPM")) |
306 | continue; | ||
307 | if(!name.StartsWith("ATPM")) | ||
308 | continue; | ||
309 | sop.Name = sop.Name.Replace("ATPM", "FTPM"); | ||
310 | } | ||
311 | else | ||
312 | { | ||
313 | if(name.StartsWith("ATPM")) | ||
314 | continue; | ||
315 | if(!name.StartsWith("FTPM")) | ||
316 | continue; | ||
317 | sop.Name = sop.Name.Replace("FTPM", "ATPM"); | ||
318 | } | ||
319 | sop.ParentGroup.HasGroupChanged = true; | ||
320 | sog.ScheduleGroupForFullUpdate(); | ||
308 | } | 321 | } |
309 | else | 322 | else |
310 | { | 323 | losttrees.Add(tree); |
311 | if(name.StartsWith("ATPM")) | ||
312 | continue; | ||
313 | if(!name.StartsWith("FTPM")) | ||
314 | continue; | ||
315 | sop.Name = sop.Name.Replace("FTPM", "ATPM"); | ||
316 | } | ||
317 | sop.ParentGroup.HasGroupChanged = true; | ||
318 | sog.ScheduleGroupForFullUpdate(); | ||
319 | } | 324 | } |
320 | else | 325 | foreach (UUID tree in losttrees) |
321 | losttrees.Add(tree); | 326 | cp.m_trees.Remove(tree); |
322 | } | ||
323 | foreach (UUID tree in losttrees) | ||
324 | cp.m_trees.Remove(tree); | ||
325 | 327 | ||
326 | m_log.InfoFormat("[TREES]: Activity for copse {0} is frozen {1}", copsename, freezeState); | 328 | m_log.InfoFormat("[TREES]: Activity for copse {0} is frozen {1}", copsename, freezeState); |
327 | return; | 329 | return; |
328 | } | 330 | } |
329 | else | 331 | else |
330 | { | 332 | { |
331 | m_log.InfoFormat("[TREES]: Copse {0} is already in the requested freeze state", copsename); | 333 | m_log.InfoFormat("[TREES]: Copse {0} is already in the requested freeze state", copsename); |
332 | return; | 334 | return; |
335 | } | ||
333 | } | 336 | } |
334 | } | 337 | } |
335 | m_log.InfoFormat("[TREES]: Copse {0} was not found - command failed", copsename); | 338 | m_log.InfoFormat("[TREES]: Copse {0} was not found - command failed", copsename); |
@@ -382,6 +385,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
382 | else | 385 | else |
383 | { | 386 | { |
384 | m_log.InfoFormat("[TREES]: Copse {0} has already been planted", copsename); | 387 | m_log.InfoFormat("[TREES]: Copse {0} has already been planted", copsename); |
388 | return; | ||
385 | } | 389 | } |
386 | } | 390 | } |
387 | } | 391 | } |
@@ -465,10 +469,11 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
465 | 469 | ||
466 | private void HandleTreeStatistics(Object[] args) | 470 | private void HandleTreeStatistics(Object[] args) |
467 | { | 471 | { |
468 | m_log.InfoFormat("[TREES]: Activity State: {0}; Update Rate: {1}", m_active_trees, m_update_ms); | 472 | m_log.InfoFormat("[TREES]: region {0}:", m_scene.Name); |
473 | m_log.InfoFormat("[TREES]: Activity State: {0}; Update Rate: {1}", m_active_trees, m_update_ms); | ||
469 | foreach (Copse cp in m_copses) | 474 | foreach (Copse cp in m_copses) |
470 | { | 475 | { |
471 | m_log.InfoFormat("[TREES]: Copse {0}; {1} trees; frozen {2}", cp.m_name, cp.m_trees.Count, cp.m_frozen); | 476 | m_log.InfoFormat("[TREES]: Copse {0}; {1} trees; frozen {2}", cp.m_name, cp.m_trees.Count, cp.m_frozen); |
472 | } | 477 | } |
473 | } | 478 | } |
474 | 479 | ||
@@ -909,9 +914,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
909 | killTrees(); | 914 | killTrees(); |
910 | } | 915 | } |
911 | } | 916 | } |
912 | catch(Exception ex) | 917 | catch { } |
913 | { | ||
914 | } | ||
915 | if(CalculateTrees != null) | 918 | if(CalculateTrees != null) |
916 | CalculateTrees.Start(); | 919 | CalculateTrees.Start(); |
917 | Monitor.Exit(mylock); | 920 | Monitor.Exit(mylock); |