diff options
author | Jeff Ames | 2009-03-09 23:31:10 +0000 |
---|---|---|
committer | Jeff Ames | 2009-03-09 23:31:10 +0000 |
commit | 278ae3477a22c57f3a13aafb0a5eb9c6e6587092 (patch) | |
tree | 88153479a0150132b3c29c8bb0bf186a0bda4c33 /OpenSim | |
parent | * minor: remove some mono compiler warnings (diff) | |
download | opensim-SC_OLD-278ae3477a22c57f3a13aafb0a5eb9c6e6587092.zip opensim-SC_OLD-278ae3477a22c57f3a13aafb0a5eb9c6e6587092.tar.gz opensim-SC_OLD-278ae3477a22c57f3a13aafb0a5eb9c6e6587092.tar.bz2 opensim-SC_OLD-278ae3477a22c57f3a13aafb0a5eb9c6e6587092.tar.xz |
Thanks M1sha for a patch to reinstate the original functionality of the TreePopulatorModule.
Note that the planting command 'tree' has been changed to 'tree plant'. (#3264)
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs | 89 |
1 files changed, 51 insertions, 38 deletions
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs index 94ebcac..eddc4c6 100644 --- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs +++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs | |||
@@ -39,7 +39,7 @@ using OpenSim.Region.Framework.Scenes; | |||
39 | namespace OpenSim.Region.OptionalModules.World.TreePopulator | 39 | namespace OpenSim.Region.OptionalModules.World.TreePopulator |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// Version 2.0 - Very hacky compared to the original. Will fix original and release as 0.3 later. | 42 | /// Version 2.01 - Very hacky compared to the original. Will fix original and release as 0.3 later. |
43 | /// </summary> | 43 | /// </summary> |
44 | public class TreePopulatorModule : IRegionModule | 44 | public class TreePopulatorModule : IRegionModule |
45 | { | 45 | { |
@@ -56,6 +56,15 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
56 | 56 | ||
57 | public void Initialise(Scene scene, IConfigSource config) | 57 | public void Initialise(Scene scene, IConfigSource config) |
58 | { | 58 | { |
59 | m_scene = scene; | ||
60 | m_scene.RegisterModuleInterface<IRegionModule>(this); | ||
61 | |||
62 | m_scene.AddCommand( | ||
63 | this, "tree plant", "tree plant", "Start populating trees", HandleTreeConsoleCommand); | ||
64 | |||
65 | m_scene.AddCommand( | ||
66 | this, "tree active", "tree active <boolean>", "Change activity state for trees module", HandleTreeConsoleCommand); | ||
67 | |||
59 | try | 68 | try |
60 | { | 69 | { |
61 | m_tree_density = config.Configs["Trees"].GetDouble("tree_density", m_tree_density); | 70 | m_tree_density = config.Configs["Trees"].GetDouble("tree_density", m_tree_density); |
@@ -66,9 +75,6 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
66 | } | 75 | } |
67 | 76 | ||
68 | m_trees = new List<UUID>(); | 77 | m_trees = new List<UUID>(); |
69 | m_scene = scene; | ||
70 | |||
71 | m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; | ||
72 | 78 | ||
73 | if (m_active_trees) | 79 | if (m_active_trees) |
74 | activeizeTreeze(true); | 80 | activeizeTreeze(true); |
@@ -96,47 +102,54 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator | |||
96 | 102 | ||
97 | #endregion | 103 | #endregion |
98 | 104 | ||
99 | private void EventManager_OnPluginConsole(string[] args) | 105 | /// <summary> |
106 | /// Handle a tree command from the console. | ||
107 | /// </summary> | ||
108 | /// <param name="module"></param> | ||
109 | /// <param name="cmdparams"></param> | ||
110 | public void HandleTreeConsoleCommand(string module, string[] cmdparams) | ||
100 | { | 111 | { |
101 | if (args.Length == 1) | 112 | if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) |
102 | { | 113 | return; |
103 | if (args[0] == "tree") | ||
104 | { | ||
105 | UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
106 | if (uuid == UUID.Zero) | ||
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 | } | ||
112 | } | ||
113 | 114 | ||
114 | if (args.Length == 2 || args.Length == 3) | 115 | if (cmdparams[1] == "active") |
115 | { | 116 | { |
116 | if (args[1] == "active") | 117 | if (cmdparams.Length <= 2) |
117 | { | 118 | { |
118 | if (args.Length >= 3) | 119 | if (m_active_trees) |
119 | { | 120 | m_log.InfoFormat("[TREES]: Trees are currently active"); |
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 | 121 | else |
134 | { | 122 | m_log.InfoFormat("[TREES]: Trees are currently not active"); |
135 | m_log.Info("[TREES]: When setting the tree module active via the console, you must specify true or false"); | 123 | } |
136 | } | 124 | else if (cmdparams[2] == "true" && !m_active_trees) |
125 | { | ||
126 | m_log.InfoFormat("[TREES]: Activating Trees"); | ||
127 | m_active_trees = true; | ||
128 | activeizeTreeze(m_active_trees); | ||
129 | } | ||
130 | else if (cmdparams[2] == "false" && m_active_trees) | ||
131 | { | ||
132 | m_log.InfoFormat("[TREES]: Trees no longer active, for now..."); | ||
133 | m_active_trees = false; | ||
134 | activeizeTreeze(m_active_trees); | ||
135 | } | ||
136 | else | ||
137 | { | ||
138 | m_log.InfoFormat("[TREES]: When setting the tree module active via the console, you must specify true or false"); | ||
137 | } | 139 | } |
138 | } | 140 | } |
139 | 141 | else if (cmdparams[1] == "plant") | |
142 | { | ||
143 | m_log.InfoFormat("[TREES]: New tree planting"); | ||
144 | UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner; | ||
145 | if (uuid == UUID.Zero) | ||
146 | uuid = m_scene.RegionInfo.MasterAvatarAssignedUUID; | ||
147 | CreateTree(uuid, new Vector3(128.0f, 128.0f, 0.0f)); | ||
148 | } | ||
149 | else | ||
150 | { | ||
151 | m_log.InfoFormat("[TREES]: Unknown command"); | ||
152 | } | ||
140 | } | 153 | } |
141 | 154 | ||
142 | private void activeizeTreeze(bool activeYN) | 155 | private void activeizeTreeze(bool activeYN) |