aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/World
diff options
context:
space:
mode:
authorubit2012-12-03 21:26:36 +0100
committerubit2012-12-03 21:26:36 +0100
commit5d4b7d537d872d27c394402d3483c2a9bd2153f0 (patch)
tree39aae50386555bf024700314fb7bee5121a9d683 /OpenSim/Region/OptionalModules/World
parentMerge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork (diff)
parentMerge branch 'avination' into ubitwork (diff)
downloadopensim-SC-5d4b7d537d872d27c394402d3483c2a9bd2153f0.zip
opensim-SC-5d4b7d537d872d27c394402d3483c2a9bd2153f0.tar.gz
opensim-SC-5d4b7d537d872d27c394402d3483c2a9bd2153f0.tar.bz2
opensim-SC-5d4b7d537d872d27c394402d3483c2a9bd2153f0.tar.xz
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim/Region/OptionalModules/World')
-rw-r--r--OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs4
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs26
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs124
-rw-r--r--OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs11
-rw-r--r--OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs33
-rw-r--r--OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs2
7 files changed, 134 insertions, 68 deletions
diff --git a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs
index ec9f157..1d35c54 100644
--- a/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs
+++ b/OpenSim/Region/OptionalModules/World/AutoBackup/AutoBackupModule.cs
@@ -33,6 +33,7 @@ using System.Reflection;
33using System.Timers; 33using System.Timers;
34using System.Text.RegularExpressions; 34using System.Text.RegularExpressions;
35using log4net; 35using log4net;
36using Mono.Addins;
36using Nini.Config; 37using Nini.Config;
37using OpenSim.Framework; 38using OpenSim.Framework;
38using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
@@ -95,6 +96,7 @@ namespace OpenSim.Region.OptionalModules.World.AutoBackup
95 /// Save memory by setting low initial capacities. Minimizes impact in common cases of all regions using same interval, and instances hosting 1 ~ 4 regions. 96 /// Save memory by setting low initial capacities. Minimizes impact in common cases of all regions using same interval, and instances hosting 1 ~ 4 regions.
96 /// Also helps if you don't want AutoBackup at all. 97 /// Also helps if you don't want AutoBackup at all.
97 /// </remarks> 98 /// </remarks>
99 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AutoBackupModule")]
98 public class AutoBackupModule : ISharedRegionModule 100 public class AutoBackupModule : ISharedRegionModule
99 { 101 {
100 private static readonly ILog m_log = 102 private static readonly ILog m_log =
diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
index d206f69..c7e3a7a 100644
--- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
+++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs
@@ -55,7 +55,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
55 /// 55 ///
56 /// </summary> 56 /// </summary>
57 57
58 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] 58 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SampleMoneyModule")]
59 public class SampleMoneyModule : IMoneyModule, ISharedRegionModule 59 public class SampleMoneyModule : IMoneyModule, ISharedRegionModule
60 { 60 {
61 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 61 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -199,7 +199,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
199 { 199 {
200 } 200 }
201 201
202 public bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, int amount) 202 public bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, int amount, UUID txn)
203 { 203 {
204 string description = String.Format("Object {0} pays {1}", resolveObjectName(objectID), resolveAgentName(toID)); 204 string description = String.Format("Object {0} pays {1}", resolveObjectName(objectID), resolveAgentName(toID));
205 205
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
index 7c693b6..d665126 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs
@@ -148,7 +148,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
148 OnInstantMessage(this, new GridInstantMessage(m_scene, 148 OnInstantMessage(this, new GridInstantMessage(m_scene,
149 m_uuid, m_firstname + " " + m_lastname, 149 m_uuid, m_firstname + " " + m_lastname,
150 target, 0, false, message, 150 target, 0, false, message,
151 UUID.Zero, false, Position, new byte[0])); 151 UUID.Zero, false, Position, new byte[0], true));
152 } 152 }
153 153
154 public void SendAgentOffline(UUID[] agentIDs) 154 public void SendAgentOffline(UUID[] agentIDs)
@@ -473,7 +473,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
473 public event MuteListEntryRemove OnRemoveMuteListEntry; 473 public event MuteListEntryRemove OnRemoveMuteListEntry;
474 public event GodlikeMessage onGodlikeMessage; 474 public event GodlikeMessage onGodlikeMessage;
475 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate; 475 public event GodUpdateRegionInfoUpdate OnGodUpdateRegionInfoUpdate;
476 476 public event GenericCall2 OnUpdateThrottles;
477#pragma warning restore 67 477#pragma warning restore 67
478 478
479 #endregion 479 #endregion
@@ -597,6 +597,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC
597 public virtual void SetChildAgentThrottle(byte[] throttle) 597 public virtual void SetChildAgentThrottle(byte[] throttle)
598 { 598 {
599 } 599 }
600
601 public void SetAgentThrottleSilent(int throttle, int setting)
602 {
603
604
605 }
600 public byte[] GetThrottlesPacked(float multiplier) 606 public byte[] GetThrottlesPacked(float multiplier)
601 { 607 {
602 return new byte[0]; 608 return new byte[0];
@@ -607,13 +613,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC
607 { 613 {
608 } 614 }
609 615
610 public virtual void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, 616 public virtual void SendChatMessage(
611 UUID fromAgentID, byte source, byte audible) 617 string message, byte type, Vector3 fromPos, string fromName,
618 UUID fromAgentID, UUID ownerID, byte source, byte audible)
612 { 619 {
613 } 620 }
614 621
615 public virtual void SendChatMessage(byte[] message, byte type, Vector3 fromPos, string fromName, 622 public virtual void SendChatMessage(
616 UUID fromAgentID, byte source, byte audible) 623 byte[] message, byte type, Vector3 fromPos, string fromName,
624 UUID fromAgentID, UUID ownerID, byte source, byte audible)
617 { 625 {
618 } 626 }
619 627
@@ -909,11 +917,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC
909 917
910 public void Close() 918 public void Close()
911 { 919 {
912 Close(true); 920 Close(true, false);
913 } 921 }
914 922
915 public void Close(bool sendStop) 923 public void Close(bool sendStop, bool force)
916 { 924 {
925 // Remove ourselves from the scene
926 m_scene.RemoveClient(AgentId, false);
917 } 927 }
918 928
919 public void Start() 929 public void Start()
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
index f16927c..8c9c006 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs
@@ -29,37 +29,57 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using System.Threading; 31using System.Threading;
32using Timer = System.Timers.Timer;
33
32using log4net; 34using log4net;
33using Nini.Config; 35using Nini.Config;
36using Mono.Addins;
34using OpenMetaverse; 37using OpenMetaverse;
38
35using OpenSim.Region.Framework.Interfaces; 39using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 40using OpenSim.Region.Framework.Scenes;
37using OpenSim.Framework; 41using OpenSim.Framework;
38using Timer=System.Timers.Timer;
39using OpenSim.Services.Interfaces; 42using OpenSim.Services.Interfaces;
40 43
41namespace OpenSim.Region.OptionalModules.World.NPC 44namespace OpenSim.Region.OptionalModules.World.NPC
42{ 45{
43 public class NPCModule : IRegionModule, INPCModule 46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "NPCModule")]
47 public class NPCModule : INPCModule, ISharedRegionModule
44 { 48 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49 private static readonly ILog m_log = LogManager.GetLogger(
50 MethodBase.GetCurrentMethod().DeclaringType);
51
52 private Dictionary<UUID, NPCAvatar> m_avatars =
53 new Dictionary<UUID, NPCAvatar>();
46 54
47 private Dictionary<UUID, NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>(); 55 public bool Enabled { get; private set; }
48 56
49 public void Initialise(Scene scene, IConfigSource source) 57 public void Initialise(IConfigSource source)
50 { 58 {
51 IConfig config = source.Configs["NPC"]; 59 IConfig config = source.Configs["NPC"];
52 60
53 if (config != null && config.GetBoolean("Enabled", false)) 61 Enabled = (config != null && config.GetBoolean("Enabled", false));
54 { 62 }
63
64 public void AddRegion(Scene scene)
65 {
66 if (Enabled)
55 scene.RegisterModuleInterface<INPCModule>(this); 67 scene.RegisterModuleInterface<INPCModule>(this);
56 } 68 }
69
70 public void RegionLoaded(Scene scene)
71 {
57 } 72 }
58 73
59 public void PostInitialise() 74 public void PostInitialise()
60 { 75 {
61 } 76 }
62 77
78 public void RemoveRegion(Scene scene)
79 {
80 scene.UnregisterModuleInterface<INPCModule>(this);
81 }
82
63 public void Close() 83 public void Close()
64 { 84 {
65 } 85 }
@@ -69,15 +89,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC
69 get { return "NPCModule"; } 89 get { return "NPCModule"; }
70 } 90 }
71 91
72 public bool IsSharedModule 92 public Type ReplaceableInterface { get { return null; } }
73 {
74 get { return true; }
75 }
76 93
77 public bool IsNPC(UUID agentId, Scene scene) 94 public bool IsNPC(UUID agentId, Scene scene)
78 { 95 {
79 // FIXME: This implementation could not just use the ScenePresence.PresenceType (and callers could inspect 96 // FIXME: This implementation could not just use the
80 // that directly). 97 // ScenePresence.PresenceType (and callers could inspect that
98 // directly).
81 ScenePresence sp = scene.GetScenePresence(agentId); 99 ScenePresence sp = scene.GetScenePresence(agentId);
82 if (sp == null || sp.IsChildAgent) 100 if (sp == null || sp.IsChildAgent)
83 return false; 101 return false;
@@ -86,7 +104,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
86 return m_avatars.ContainsKey(agentId); 104 return m_avatars.ContainsKey(agentId);
87 } 105 }
88 106
89 public bool SetNPCAppearance(UUID agentId, AvatarAppearance appearance, Scene scene) 107 public bool SetNPCAppearance(UUID agentId,
108 AvatarAppearance appearance, Scene scene)
90 { 109 {
91 ScenePresence npc = scene.GetScenePresence(agentId); 110 ScenePresence npc = scene.GetScenePresence(agentId);
92 if (npc == null || npc.IsChildAgent) 111 if (npc == null || npc.IsChildAgent)
@@ -99,30 +118,30 @@ namespace OpenSim.Region.OptionalModules.World.NPC
99 // Delete existing npc attachments 118 // Delete existing npc attachments
100 scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false); 119 scene.AttachmentsModule.DeleteAttachmentsFromScene(npc, false);
101 120
102 // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet since it doesn't transfer attachments 121 // XXX: We can't just use IAvatarFactoryModule.SetAppearance() yet
103 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); 122 // since it doesn't transfer attachments
123 AvatarAppearance npcAppearance = new AvatarAppearance(appearance,
124 true);
104 npc.Appearance = npcAppearance; 125 npc.Appearance = npcAppearance;
105 126
106 // Rez needed npc attachments 127 // Rez needed npc attachments
107 scene.AttachmentsModule.RezAttachments(npc); 128 scene.AttachmentsModule.RezAttachments(npc);
108 129
109 IAvatarFactoryModule module = scene.RequestModuleInterface<IAvatarFactoryModule>(); 130 IAvatarFactoryModule module =
131 scene.RequestModuleInterface<IAvatarFactoryModule>();
110 module.SendAppearance(npc.UUID); 132 module.SendAppearance(npc.UUID);
111 133
112 return true; 134 return true;
113 } 135 }
114 136
115 public UUID CreateNPC( 137 public UUID CreateNPC(string firstname, string lastname,
116 string firstname, 138 Vector3 position, UUID owner, bool senseAsAgent, Scene scene,
117 string lastname, 139 AvatarAppearance appearance)
118 Vector3 position,
119 UUID owner,
120 bool senseAsAgent,
121 Scene scene,
122 AvatarAppearance appearance)
123 { 140 {
124 NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position, owner, senseAsAgent, scene); 141 NPCAvatar npcAvatar = new NPCAvatar(firstname, lastname, position,
125 npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue); 142 owner, senseAsAgent, scene);
143 npcAvatar.CircuitCode = (uint)Util.RandomClass.Next(0,
144 int.MaxValue);
126 145
127// m_log.DebugFormat( 146// m_log.DebugFormat(
128// "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}", 147// "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}",
@@ -134,15 +153,20 @@ namespace OpenSim.Region.OptionalModules.World.NPC
134 acd.lastname = lastname; 153 acd.lastname = lastname;
135 acd.ServiceURLs = new Dictionary<string, object>(); 154 acd.ServiceURLs = new Dictionary<string, object>();
136 155
137 AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); 156 AvatarAppearance npcAppearance = new AvatarAppearance(appearance,
157 true);
138 acd.Appearance = npcAppearance; 158 acd.Appearance = npcAppearance;
139 159
140// for (int i = 0; i < acd.Appearance.Texture.FaceTextures.Length; i++) 160 /*
141// { 161 for (int i = 0;
142// m_log.DebugFormat( 162 i < acd.Appearance.Texture.FaceTextures.Length; i++)
143// "[NPC MODULE]: NPC avatar {0} has texture id {1} : {2}", 163 {
144// acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); 164 m_log.DebugFormat(
145// } 165 "[NPC MODULE]: NPC avatar {0} has texture id {1} : {2}",
166 acd.AgentID, i,
167 acd.Appearance.Texture.FaceTextures[i]);
168 }
169 */
146 170
147 ManualResetEvent ev = new ManualResetEvent(false); 171 ManualResetEvent ev = new ManualResetEvent(false);
148 172
@@ -170,7 +194,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
170 return npcAvatar.AgentId; 194 return npcAvatar.AgentId;
171 } 195 }
172 196
173 public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running) 197 public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos,
198 bool noFly, bool landAtTarget, bool running)
174 { 199 {
175 lock (m_avatars) 200 lock (m_avatars)
176 { 201 {
@@ -185,7 +210,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
185 210
186 sp.MoveToTarget(pos, noFly, landAtTarget); 211 sp.MoveToTarget(pos, noFly, landAtTarget);
187 sp.SetAlwaysRun = running; 212 sp.SetAlwaysRun = running;
188 213
189 return true; 214 return true;
190 } 215 }
191 } 216 }
@@ -258,9 +283,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
258 ScenePresence sp; 283 ScenePresence sp;
259 if (scene.TryGetScenePresence(agentID, out sp)) 284 if (scene.TryGetScenePresence(agentID, out sp))
260 { 285 {
261 sp.HandleAgentRequestSit(m_avatars[agentID], agentID, partID, Vector3.Zero); 286 sp.HandleAgentRequestSit(m_avatars[agentID], agentID,
262 // sp.HandleAgentSit(m_avatars[agentID], agentID); 287 partID, Vector3.Zero);
263 288 //sp.HandleAgentSit(m_avatars[agentID], agentID);
289
264 return true; 290 return true;
265 } 291 }
266 } 292 }
@@ -269,7 +295,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
269 return false; 295 return false;
270 } 296 }
271 297
272 public bool Whisper(UUID agentID, Scene scene, string text, int channel) 298 public bool Whisper(UUID agentID, Scene scene, string text,
299 int channel)
273 { 300 {
274 lock (m_avatars) 301 lock (m_avatars)
275 { 302 {
@@ -344,7 +371,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
344 NPCAvatar av; 371 NPCAvatar av;
345 if (m_avatars.TryGetValue(agentID, out av)) 372 if (m_avatars.TryGetValue(agentID, out av))
346 { 373 {
347// m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", agentID, av.Name); 374 /*
375 m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove",
376 agentID, av.Name);
377 */
348 scene.RemoveClient(agentID, false); 378 scene.RemoveClient(agentID, false);
349 m_avatars.Remove(agentID); 379 m_avatars.Remove(agentID);
350 380
@@ -352,8 +382,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC
352 return true; 382 return true;
353 } 383 }
354 } 384 }
355 385 /*
356// m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove", agentID); 386 m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove",
387 agentID);
388 */
357 return false; 389 return false;
358 } 390 }
359 391
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
index 9179966..52ed846 100644
--- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs
@@ -117,6 +117,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
117 Assert.That(npc, Is.Not.Null); 117 Assert.That(npc, Is.Not.Null);
118 Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId)); 118 Assert.That(npc.Appearance.Texture.FaceTextures[8].TextureID, Is.EqualTo(originalFace8TextureId));
119 Assert.That(m_umMod.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname))); 119 Assert.That(m_umMod.GetUserName(npc.UUID), Is.EqualTo(string.Format("{0} {1}", npc.Firstname, npc.Lastname)));
120
121 IClientAPI client;
122 Assert.That(m_scene.TryGetClient(npcId, out client), Is.True);
123
124 // Have to account for both SP and NPC.
125 Assert.That(m_scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(2));
120 } 126 }
121 127
122 [Test] 128 [Test]
@@ -136,6 +142,11 @@ namespace OpenSim.Region.OptionalModules.World.NPC.Tests
136 ScenePresence deletedNpc = m_scene.GetScenePresence(npcId); 142 ScenePresence deletedNpc = m_scene.GetScenePresence(npcId);
137 143
138 Assert.That(deletedNpc, Is.Null); 144 Assert.That(deletedNpc, Is.Null);
145 IClientAPI client;
146 Assert.That(m_scene.TryGetClient(npcId, out client), Is.False);
147
148 // Have to account for SP still present.
149 Assert.That(m_scene.AuthenticateHandler.GetAgentCircuits().Count, Is.EqualTo(1));
139 } 150 }
140 151
141 [Test] 152 [Test]
diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
index 51b0592..8144870 100644
--- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
+++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs
@@ -31,6 +31,7 @@ using System.Reflection;
31using System.Timers; 31using System.Timers;
32using OpenMetaverse; 32using OpenMetaverse;
33using log4net; 33using log4net;
34using Mono.Addins;
34using Nini.Config; 35using Nini.Config;
35using OpenSim.Framework; 36using OpenSim.Framework;
36using OpenSim.Region.CoreModules.Framework.InterfaceCommander; 37using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
@@ -46,7 +47,8 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
46 /// <summary> 47 /// <summary>
47 /// Version 2.02 - Still hacky 48 /// Version 2.02 - Still hacky
48 /// </summary> 49 /// </summary>
49 public class TreePopulatorModule : IRegionModule, ICommandableModule, IVegetationModule 50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "TreePopulatorModule")]
51 public class TreePopulatorModule : INonSharedRegionModule, ICommandableModule, IVegetationModule
50 { 52 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 private readonly Commander m_commander = new Commander("tree"); 54 private readonly Commander m_commander = new Commander("tree");
@@ -168,15 +170,11 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
168 170
169 #endregion 171 #endregion
170 172
171 #region IRegionModule Members 173 #region Region Module interface
172 174
173 public void Initialise(Scene scene, IConfigSource config) 175 public void Initialise(IConfigSource config)
174 { 176 {
175 177
176 m_scene = scene;
177 m_scene.RegisterModuleInterface<IRegionModule>(this);
178 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
179
180 // ini file settings 178 // ini file settings
181 try 179 try
182 { 180 {
@@ -201,7 +199,19 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
201 m_log.Debug("[TREES]: Initialised tree module"); 199 m_log.Debug("[TREES]: Initialised tree module");
202 } 200 }
203 201
204 public void PostInitialise() 202 public void AddRegion(Scene scene)
203 {
204 m_scene = scene;
205 m_scene.RegisterModuleCommander(m_commander);
206 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
207
208 }
209
210 public void RemoveRegion(Scene scene)
211 {
212 }
213
214 public void RegionLoaded(Scene scene)
205 { 215 {
206 ReloadCopse(); 216 ReloadCopse();
207 if (m_copse.Count > 0) 217 if (m_copse.Count > 0)
@@ -220,11 +230,12 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
220 get { return "TreePopulatorModule"; } 230 get { return "TreePopulatorModule"; }
221 } 231 }
222 232
223 public bool IsSharedModule 233 public Type ReplaceableInterface
224 { 234 {
225 get { return false; } 235 get { return null; }
226 } 236 }
227 237
238
228 #endregion 239 #endregion
229 240
230 //-------------------------------------------------------------- 241 //--------------------------------------------------------------
@@ -448,8 +459,6 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator
448 m_commander.RegisterCommand("reload", treeReloadCommand); 459 m_commander.RegisterCommand("reload", treeReloadCommand);
449 m_commander.RegisterCommand("remove", treeRemoveCommand); 460 m_commander.RegisterCommand("remove", treeRemoveCommand);
450 m_commander.RegisterCommand("statistics", treeStatisticsCommand); 461 m_commander.RegisterCommand("statistics", treeStatisticsCommand);
451
452 m_scene.RegisterModuleCommander(m_commander);
453 } 462 }
454 463
455 /// <summary> 464 /// <summary>
diff --git a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs
index 1aee39a..baf55c3 100644
--- a/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs
+++ b/OpenSim/Region/OptionalModules/World/WorldView/WorldViewModule.cs
@@ -32,6 +32,7 @@ using System.Drawing.Imaging;
32using System.Reflection; 32using System.Reflection;
33using System.IO; 33using System.IO;
34using log4net; 34using log4net;
35using Mono.Addins;
35using Nini.Config; 36using Nini.Config;
36using OpenMetaverse; 37using OpenMetaverse;
37using OpenMetaverse.Imaging; 38using OpenMetaverse.Imaging;
@@ -45,6 +46,7 @@ using OpenSim.Services.Interfaces;
45 46
46namespace OpenSim.Region.OptionalModules.World.WorldView 47namespace OpenSim.Region.OptionalModules.World.WorldView
47{ 48{
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WorldViewModule")]
48 public class WorldViewModule : INonSharedRegionModule 50 public class WorldViewModule : INonSharedRegionModule
49 { 51 {
50 private static readonly ILog m_log = 52 private static readonly ILog m_log =