diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/World')
7 files changed, 146 insertions, 76 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; | |||
33 | using System.Timers; | 33 | using System.Timers; |
34 | using System.Text.RegularExpressions; | 34 | using System.Text.RegularExpressions; |
35 | using log4net; | 35 | using log4net; |
36 | using Mono.Addins; | ||
36 | using Nini.Config; | 37 | using Nini.Config; |
37 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
38 | using OpenSim.Region.Framework.Interfaces; | 39 | using 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 9c838d0..8f04ede 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); |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index ffd4222..5ea2bcd 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -603,13 +603,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
603 | { | 603 | { |
604 | } | 604 | } |
605 | 605 | ||
606 | public virtual void SendChatMessage(string message, byte type, Vector3 fromPos, string fromName, | 606 | public virtual void SendChatMessage( |
607 | UUID fromAgentID, byte source, byte audible) | 607 | string message, byte type, Vector3 fromPos, string fromName, |
608 | UUID fromAgentID, UUID ownerID, byte source, byte audible) | ||
608 | { | 609 | { |
609 | } | 610 | } |
610 | 611 | ||
611 | public virtual void SendChatMessage(byte[] message, byte type, Vector3 fromPos, string fromName, | 612 | public virtual void SendChatMessage( |
612 | UUID fromAgentID, byte source, byte audible) | 613 | byte[] message, byte type, Vector3 fromPos, string fromName, |
614 | UUID fromAgentID, UUID ownerID, byte source, byte audible) | ||
613 | { | 615 | { |
614 | } | 616 | } |
615 | 617 | ||
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 3f25bcf..7d46d92 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs | |||
@@ -29,37 +29,57 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Threading; | 31 | using System.Threading; |
32 | using Timer = System.Timers.Timer; | ||
33 | |||
32 | using log4net; | 34 | using log4net; |
33 | using Nini.Config; | 35 | using Nini.Config; |
36 | using Mono.Addins; | ||
34 | using OpenMetaverse; | 37 | using OpenMetaverse; |
38 | |||
35 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Framework; | 41 | using OpenSim.Framework; |
38 | using Timer=System.Timers.Timer; | ||
39 | using OpenSim.Services.Interfaces; | 42 | using OpenSim.Services.Interfaces; |
40 | 43 | ||
41 | namespace OpenSim.Region.OptionalModules.World.NPC | 44 | namespace 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,34 +118,35 @@ 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}", |
129 | firstname, lastname, npcAvatar.AgentId, owner, senseAsAgent, position, scene.RegionInfo.RegionName); | 148 | firstname, lastname, npcAvatar.AgentId, owner, |
149 | senseAsAgent, position, scene.RegionInfo.RegionName); | ||
130 | 150 | ||
131 | AgentCircuitData acd = new AgentCircuitData(); | 151 | AgentCircuitData acd = new AgentCircuitData(); |
132 | acd.AgentID = npcAvatar.AgentId; | 152 | acd.AgentID = npcAvatar.AgentId; |
@@ -134,42 +154,55 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
134 | acd.lastname = lastname; | 154 | acd.lastname = lastname; |
135 | acd.ServiceURLs = new Dictionary<string, object>(); | 155 | acd.ServiceURLs = new Dictionary<string, object>(); |
136 | 156 | ||
137 | AvatarAppearance npcAppearance = new AvatarAppearance(appearance, true); | 157 | AvatarAppearance npcAppearance = new AvatarAppearance(appearance, |
158 | true); | ||
138 | acd.Appearance = npcAppearance; | 159 | acd.Appearance = npcAppearance; |
139 | 160 | ||
140 | // for (int i = 0; i < acd.Appearance.Texture.FaceTextures.Length; i++) | 161 | /* |
141 | // { | 162 | for (int i = 0; |
142 | // m_log.DebugFormat( | 163 | i < acd.Appearance.Texture.FaceTextures.Length; i++) |
143 | // "[NPC MODULE]: NPC avatar {0} has texture id {1} : {2}", | 164 | { |
144 | // acd.AgentID, i, acd.Appearance.Texture.FaceTextures[i]); | 165 | m_log.DebugFormat( |
145 | // } | 166 | "[NPC MODULE]: NPC avatar {0} has texture id {1} : {2}", |
167 | acd.AgentID, i, | ||
168 | acd.Appearance.Texture.FaceTextures[i]); | ||
169 | } | ||
170 | */ | ||
146 | 171 | ||
147 | lock (m_avatars) | 172 | lock (m_avatars) |
148 | { | 173 | { |
149 | scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, acd); | 174 | scene.AuthenticateHandler.AddNewCircuit(npcAvatar.CircuitCode, |
175 | acd); | ||
150 | scene.AddNewClient(npcAvatar, PresenceType.Npc); | 176 | scene.AddNewClient(npcAvatar, PresenceType.Npc); |
151 | 177 | ||
152 | ScenePresence sp; | 178 | ScenePresence sp; |
153 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) | 179 | if (scene.TryGetScenePresence(npcAvatar.AgentId, out sp)) |
154 | { | 180 | { |
155 | // m_log.DebugFormat( | 181 | /* |
156 | // "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", sp.Name, sp.UUID); | 182 | m_log.DebugFormat( |
183 | "[NPC MODULE]: Successfully retrieved scene presence for NPC {0} {1}", | ||
184 | sp.Name, sp.UUID); | ||
185 | */ | ||
157 | 186 | ||
158 | sp.CompleteMovement(npcAvatar, false); | 187 | sp.CompleteMovement(npcAvatar, false); |
159 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); | 188 | m_avatars.Add(npcAvatar.AgentId, npcAvatar); |
160 | m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", npcAvatar.AgentId, sp.Name); | 189 | m_log.DebugFormat("[NPC MODULE]: Created NPC {0} {1}", |
190 | npcAvatar.AgentId, sp.Name); | ||
161 | 191 | ||
162 | return npcAvatar.AgentId; | 192 | return npcAvatar.AgentId; |
163 | } | 193 | } |
164 | else | 194 | else |
165 | { | 195 | { |
166 | m_log.WarnFormat("[NPC MODULE]: Could not find scene presence for NPC {0} {1}", sp.Name, sp.UUID); | 196 | m_log.WarnFormat( |
197 | "[NPC MODULE]: Could not find scene presence for NPC {0} {1}", | ||
198 | sp.Name, sp.UUID); | ||
167 | return UUID.Zero; | 199 | return UUID.Zero; |
168 | } | 200 | } |
169 | } | 201 | } |
170 | } | 202 | } |
171 | 203 | ||
172 | public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, bool noFly, bool landAtTarget, bool running) | 204 | public bool MoveToTarget(UUID agentID, Scene scene, Vector3 pos, |
205 | bool noFly, bool landAtTarget, bool running) | ||
173 | { | 206 | { |
174 | lock (m_avatars) | 207 | lock (m_avatars) |
175 | { | 208 | { |
@@ -179,12 +212,13 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
179 | if (scene.TryGetScenePresence(agentID, out sp)) | 212 | if (scene.TryGetScenePresence(agentID, out sp)) |
180 | { | 213 | { |
181 | m_log.DebugFormat( | 214 | m_log.DebugFormat( |
182 | "[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}", | 215 | "[NPC MODULE]: Moving {0} to {1} in {2}, noFly {3}, landAtTarget {4}", |
183 | sp.Name, pos, scene.RegionInfo.RegionName, noFly, landAtTarget); | 216 | sp.Name, pos, scene.RegionInfo.RegionName, |
217 | noFly, landAtTarget); | ||
184 | 218 | ||
185 | sp.MoveToTarget(pos, noFly, landAtTarget); | 219 | sp.MoveToTarget(pos, noFly, landAtTarget); |
186 | sp.SetAlwaysRun = running; | 220 | sp.SetAlwaysRun = running; |
187 | 221 | ||
188 | return true; | 222 | return true; |
189 | } | 223 | } |
190 | } | 224 | } |
@@ -257,9 +291,10 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
257 | ScenePresence sp; | 291 | ScenePresence sp; |
258 | if (scene.TryGetScenePresence(agentID, out sp)) | 292 | if (scene.TryGetScenePresence(agentID, out sp)) |
259 | { | 293 | { |
260 | sp.HandleAgentRequestSit(m_avatars[agentID], agentID, partID, Vector3.Zero); | 294 | sp.HandleAgentRequestSit(m_avatars[agentID], agentID, |
261 | // sp.HandleAgentSit(m_avatars[agentID], agentID); | 295 | partID, Vector3.Zero); |
262 | 296 | //sp.HandleAgentSit(m_avatars[agentID], agentID); | |
297 | |||
263 | return true; | 298 | return true; |
264 | } | 299 | } |
265 | } | 300 | } |
@@ -268,7 +303,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
268 | return false; | 303 | return false; |
269 | } | 304 | } |
270 | 305 | ||
271 | public bool Whisper(UUID agentID, Scene scene, string text, int channel) | 306 | public bool Whisper(UUID agentID, Scene scene, string text, |
307 | int channel) | ||
272 | { | 308 | { |
273 | lock (m_avatars) | 309 | lock (m_avatars) |
274 | { | 310 | { |
@@ -343,16 +379,23 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
343 | NPCAvatar av; | 379 | NPCAvatar av; |
344 | if (m_avatars.TryGetValue(agentID, out av)) | 380 | if (m_avatars.TryGetValue(agentID, out av)) |
345 | { | 381 | { |
346 | // m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", agentID, av.Name); | 382 | /* |
383 | m_log.DebugFormat("[NPC MODULE]: Found {0} {1} to remove", | ||
384 | agentID, av.Name); | ||
385 | */ | ||
347 | scene.RemoveClient(agentID, false); | 386 | scene.RemoveClient(agentID, false); |
348 | m_avatars.Remove(agentID); | 387 | m_avatars.Remove(agentID); |
349 | 388 | /* | |
350 | m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}", agentID, av.Name); | 389 | m_log.DebugFormat("[NPC MODULE]: Removed NPC {0} {1}", |
390 | agentID, av.Name); | ||
391 | */ | ||
351 | return true; | 392 | return true; |
352 | } | 393 | } |
353 | } | 394 | } |
354 | 395 | /* | |
355 | // m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove", agentID); | 396 | m_log.DebugFormat("[NPC MODULE]: Could not find {0} to remove", |
397 | agentID); | ||
398 | */ | ||
356 | return false; | 399 | return false; |
357 | } | 400 | } |
358 | 401 | ||
@@ -376,7 +419,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
376 | /// <returns>true if they do, false if they don't.</returns> | 419 | /// <returns>true if they do, false if they don't.</returns> |
377 | private bool CheckPermissions(NPCAvatar av, UUID callerID) | 420 | private bool CheckPermissions(NPCAvatar av, UUID callerID) |
378 | { | 421 | { |
379 | return callerID == UUID.Zero || av.OwnerID == UUID.Zero || av.OwnerID == callerID; | 422 | return callerID == UUID.Zero || av.OwnerID == UUID.Zero || |
423 | av.OwnerID == callerID; | ||
380 | } | 424 | } |
381 | } | 425 | } |
382 | } | 426 | } |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs index 9179966..a522277 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/Tests/NPCModuleTests.cs | |||
@@ -48,7 +48,7 @@ using OpenSim.Tests.Common.Mock; | |||
48 | namespace OpenSim.Region.OptionalModules.World.NPC.Tests | 48 | namespace OpenSim.Region.OptionalModules.World.NPC.Tests |
49 | { | 49 | { |
50 | [TestFixture] | 50 | [TestFixture] |
51 | public class NPCModuleTests | 51 | public class NPCModuleTests : OpenSimTestCase |
52 | { | 52 | { |
53 | private TestScene m_scene; | 53 | private TestScene m_scene; |
54 | private AvatarFactoryModule m_afMod; | 54 | private AvatarFactoryModule m_afMod; |
@@ -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; | |||
31 | using System.Timers; | 31 | using System.Timers; |
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using log4net; | 33 | using log4net; |
34 | using Mono.Addins; | ||
34 | using Nini.Config; | 35 | using Nini.Config; |
35 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
36 | using OpenSim.Region.CoreModules.Framework.InterfaceCommander; | 37 | using 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; | |||
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.IO; | 33 | using System.IO; |
34 | using log4net; | 34 | using log4net; |
35 | using Mono.Addins; | ||
35 | using Nini.Config; | 36 | using Nini.Config; |
36 | using OpenMetaverse; | 37 | using OpenMetaverse; |
37 | using OpenMetaverse.Imaging; | 38 | using OpenMetaverse.Imaging; |
@@ -45,6 +46,7 @@ using OpenSim.Services.Interfaces; | |||
45 | 46 | ||
46 | namespace OpenSim.Region.OptionalModules.World.WorldView | 47 | namespace 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 = |