aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs148
-rwxr-xr-xOpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wavbin0 -> 211648 bytes
-rw-r--r--OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs30
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs58
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs212
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModule.cs33
-rw-r--r--OpenSim/Region/CoreModules/World/Sun/SunModule.cs96
-rw-r--r--OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs27
-rw-r--r--OpenSim/Region/CoreModules/World/Wind/WindModule.cs45
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs30
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs35
13 files changed, 521 insertions, 200 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index 68d13b7..c7c9778 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -422,9 +422,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
422 currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; 422 currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4;
423 currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; 423 currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun;
424 currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; 424 currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight;
425 425
426 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); 426 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>();
427 estateModule.sendRegionHandshakeToAll(); 427
428 if (estateModule != null)
429 estateModule.sendRegionHandshakeToAll();
428 430
429 return true; 431 return true;
430 } 432 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index fc8d4e1..c738b65 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -81,6 +81,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
81 81
82 public void RemoveRegion(Scene scene) 82 public void RemoveRegion(Scene scene)
83 { 83 {
84 scene.UnregisterModuleInterface<IRegionArchiverModule>(this);
84 } 85 }
85 86
86 public void Close() 87 public void Close()
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index edac4a4..1200105 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -36,6 +36,7 @@ using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using OpenSim.Framework.Communications.Cache; 37using OpenSim.Framework.Communications.Cache;
38using OpenSim.Framework.Serialization; 38using OpenSim.Framework.Serialization;
39using OpenSim.Framework.Serialization.External;
39using OpenSim.Region.CoreModules.World.Serialiser; 40using OpenSim.Region.CoreModules.World.Serialiser;
40using OpenSim.Region.CoreModules.World.Terrain; 41using OpenSim.Region.CoreModules.World.Terrain;
41using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
@@ -214,7 +215,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
214 // Also check that direct entries which will also have a file entry containing that directory doesn't 215 // Also check that direct entries which will also have a file entry containing that directory doesn't
215 // upset load 216 // upset load
216 tar.WriteDir(ArchiveConstants.TERRAINS_PATH); 217 tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
217 218
218 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); 219 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile());
219 220
220 string part1Name = "object1"; 221 string part1Name = "object1";
@@ -234,6 +235,45 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
234 UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition); 235 UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition);
235 part1.Name = part1Name; 236 part1.Name = part1Name;
236 SceneObjectGroup object1 = new SceneObjectGroup(part1); 237 SceneObjectGroup object1 = new SceneObjectGroup(part1);
238
239 // Let's put some inventory items into our object
240 UUID soundItemUuid = UUID.Parse("00000000-0000-0000-0000-000000000002");
241 Type type = GetType();
242 Assembly assembly = type.Assembly;
243 string soundDataResourceName = null;
244 string[] names = assembly.GetManifestResourceNames();
245 foreach (string name in names)
246 {
247 if (name.EndsWith(".Resources.test-sound.wav"))
248 soundDataResourceName = name;
249 }
250 Assert.That(soundDataResourceName, Is.Not.Null);
251
252 byte[] soundData;
253 Console.WriteLine("Loading " + soundDataResourceName);
254 using (Stream resource = assembly.GetManifestResourceStream(soundDataResourceName))
255 {
256 using (BinaryReader br = new BinaryReader(resource))
257 {
258 // FIXME: Use the inspector insteadthere are so many forums and lists already, though admittedly none of them are suitable for cross virtual-enivornemnt discussion
259 soundData = br.ReadBytes(99999999);
260 UUID soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
261 string soundAssetFileName
262 = ArchiveConstants.ASSETS_PATH + soundUuid
263 + ArchiveConstants.ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV];
264 tar.WriteFile(soundAssetFileName, soundData);
265
266 /*
267 AssetBase soundAsset = AssetHelpers.CreateAsset(soundUuid, soundData);
268 scene.AssetService.Store(soundAsset);
269 asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav";
270 */
271
272 TaskInventoryItem item1 = new TaskInventoryItem { AssetID = soundUuid, ItemID = soundItemUuid };
273 part1.Inventory.AddInventoryItem(item1, true);
274 }
275 }
276
237 scene.AddNewSceneObject(object1, false); 277 scene.AddNewSceneObject(object1, false);
238 278
239 string object1FileName = string.Format( 279 string object1FileName = string.Format(
@@ -265,11 +305,117 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
265 Assert.That( 305 Assert.That(
266 object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal"); 306 object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal");
267 307
308 // Need to implement a method to get the task inventory item by name (since the uuid will have changed on load)
309 /*
310 TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItem(soundItemUuid);
311 Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null");
312 AssetBase loadedSoundAsset = scene.AssetService.Get(loadedSoundItem.AssetID.ToString());
313 Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null");
314 Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match");
315 */
316
268 // Temporary 317 // Temporary
269 Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); 318 Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
270 } 319 }
271 320
272 /// <summary> 321 /// <summary>
322 /// Test loading the region settings of a V0.2 OpenSim Region Archive.
323 /// </summary>
324 [Test]
325 public void TestLoadOarV0_2RegionSettings()
326 {
327 TestHelper.InMethod();
328 //log4net.Config.XmlConfigurator.Configure();
329
330 SerialiserModule serialiserModule = new SerialiserModule();
331 ArchiverModule archiverModule = new ArchiverModule();
332 Scene scene = SceneSetupHelpers.SetupScene();
333 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule);
334
335 MemoryStream archiveWriteStream = new MemoryStream();
336 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
337
338 tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
339 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile());
340
341 RegionSettings rs = new RegionSettings();
342 rs.AgentLimit = 17;
343 rs.AllowDamage = true;
344 rs.AllowLandJoinDivide = true;
345 rs.AllowLandResell = true;
346 rs.BlockFly = true;
347 rs.BlockShowInSearch = true;
348 rs.BlockTerraform = true;
349 rs.DisableCollisions = true;
350 rs.DisablePhysics = true;
351 rs.DisableScripts = true;
352 rs.Elevation1NW = 15.9;
353 rs.Elevation1NE = 45.3;
354 rs.Elevation1SE = 49;
355 rs.Elevation1SW = 1.9;
356 rs.Elevation2NW = 4.5;
357 rs.Elevation2NE = 19.2;
358 rs.Elevation2SE = 9.2;
359 rs.Elevation2SW = 2.1;
360 rs.FixedSun = true;
361 rs.ObjectBonus = 1.4;
362 rs.RestrictPushing = true;
363 rs.TerrainLowerLimit = 0.4;
364 rs.TerrainRaiseLimit = 17.9;
365 rs.TerrainTexture1 = UUID.Parse("00000000-0000-0000-0000-000000000020");
366 rs.TerrainTexture2 = UUID.Parse("00000000-0000-0000-0000-000000000040");
367 rs.TerrainTexture3 = UUID.Parse("00000000-0000-0000-0000-000000000060");
368 rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080");
369 rs.UseEstateSun = true;
370 rs.WaterHeight = 23;
371
372 tar.WriteFile(ArchiveConstants.SETTINGS_PATH + "region1.xml", RegionSettingsSerializer.Serialize(rs));
373
374 tar.Close();
375
376 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
377
378 lock (this)
379 {
380 scene.EventManager.OnOarFileLoaded += LoadCompleted;
381 archiverModule.DearchiveRegion(archiveReadStream);
382 }
383
384 Assert.That(m_lastErrorMessage, Is.Null);
385 RegionSettings loadedRs = scene.RegionInfo.RegionSettings;
386
387 Assert.That(loadedRs.AgentLimit, Is.EqualTo(17));
388 Assert.That(loadedRs.AllowDamage, Is.True);
389 Assert.That(loadedRs.AllowLandJoinDivide, Is.True);
390 Assert.That(loadedRs.AllowLandResell, Is.True);
391 Assert.That(loadedRs.BlockFly, Is.True);
392 Assert.That(loadedRs.BlockShowInSearch, Is.True);
393 Assert.That(loadedRs.BlockTerraform, Is.True);
394 Assert.That(loadedRs.DisableCollisions, Is.True);
395 Assert.That(loadedRs.DisablePhysics, Is.True);
396 Assert.That(loadedRs.DisableScripts, Is.True);
397 Assert.That(loadedRs.Elevation1NW, Is.EqualTo(15.9));
398 Assert.That(loadedRs.Elevation1NE, Is.EqualTo(45.3));
399 Assert.That(loadedRs.Elevation1SE, Is.EqualTo(49));
400 Assert.That(loadedRs.Elevation1SW, Is.EqualTo(1.9));
401 Assert.That(loadedRs.Elevation2NW, Is.EqualTo(4.5));
402 Assert.That(loadedRs.Elevation2NE, Is.EqualTo(19.2));
403 Assert.That(loadedRs.Elevation2SE, Is.EqualTo(9.2));
404 Assert.That(loadedRs.Elevation2SW, Is.EqualTo(2.1));
405 Assert.That(loadedRs.FixedSun, Is.True);
406 Assert.That(loadedRs.ObjectBonus, Is.EqualTo(1.4));
407 Assert.That(loadedRs.RestrictPushing, Is.True);
408 Assert.That(loadedRs.TerrainLowerLimit, Is.EqualTo(0.4));
409 Assert.That(loadedRs.TerrainRaiseLimit, Is.EqualTo(17.9));
410 Assert.That(loadedRs.TerrainTexture1, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000020")));
411 Assert.That(loadedRs.TerrainTexture2, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000040")));
412 Assert.That(loadedRs.TerrainTexture3, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000060")));
413 Assert.That(loadedRs.TerrainTexture4, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000080")));
414 Assert.That(loadedRs.UseEstateSun, Is.True);
415 Assert.That(loadedRs.WaterHeight, Is.EqualTo(23));
416 }
417
418 /// <summary>
273 /// Test merging a V0.2 OpenSim Region Archive into an existing scene 419 /// Test merging a V0.2 OpenSim Region Archive into an existing scene
274 /// </summary> 420 /// </summary>
275 //[Test] 421 //[Test]
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wav b/OpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wav
new file mode 100755
index 0000000..b45ee54
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wav
Binary files differ
diff --git a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs
index 5fa3dc2..a2cfce6 100644
--- a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs
+++ b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using Mono.Addins;
30using Nini.Config; 31using Nini.Config;
31using OpenMetaverse; 32using OpenMetaverse;
32using OpenSim.Framework; 33using OpenSim.Framework;
@@ -35,6 +36,7 @@ using OpenSim.Region.Framework.Scenes;
35 36
36namespace OpenSim.Region.CoreModules 37namespace OpenSim.Region.CoreModules
37{ 38{
39 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
38 public class CloudModule : ICloudModule 40 public class CloudModule : ICloudModule
39 { 41 {
40// private static readonly log4net.ILog m_log 42// private static readonly log4net.ILog m_log
@@ -48,7 +50,7 @@ namespace OpenSim.Region.CoreModules
48 private float m_cloudDensity = 1.0F; 50 private float m_cloudDensity = 1.0F;
49 private float[] cloudCover = new float[16 * 16]; 51 private float[] cloudCover = new float[16 * 16];
50 52
51 public void Initialise(Scene scene, IConfigSource config) 53 public void Initialise(IConfigSource config)
52 { 54 {
53 IConfig cloudConfig = config.Configs["Cloud"]; 55 IConfig cloudConfig = config.Configs["Cloud"];
54 56
@@ -58,10 +60,17 @@ namespace OpenSim.Region.CoreModules
58 m_cloudDensity = cloudConfig.GetFloat("density", 0.5F); 60 m_cloudDensity = cloudConfig.GetFloat("density", 0.5F);
59 m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000); 61 m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000);
60 } 62 }
63 }
64
65 public Type ReplaceableInterface
66 {
67 get { return null; }
68 }
61 69
70 public void AddRegion(Scene scene)
71 {
62 if (m_enabled) 72 if (m_enabled)
63 { 73 {
64
65 m_scene = scene; 74 m_scene = scene;
66 75
67 scene.EventManager.OnNewClient += CloudsToClient; 76 scene.EventManager.OnNewClient += CloudsToClient;
@@ -71,9 +80,18 @@ namespace OpenSim.Region.CoreModules
71 GenerateCloudCover(); 80 GenerateCloudCover();
72 81
73 m_ready = true; 82 m_ready = true;
74
75 } 83 }
84 }
76 85
86 public void RegionLoaded(Scene scene)
87 {
88 }
89
90 public void RemoveRegion(Scene scene)
91 {
92 scene.EventManager.OnNewClient -= CloudsToClient;
93 scene.UnregisterModuleInterface<ICloudModule>(this);
94 scene.EventManager.OnFrame -= CloudUpdate;
77 } 95 }
78 96
79 public void PostInitialise() 97 public void PostInitialise()
@@ -96,12 +114,6 @@ namespace OpenSim.Region.CoreModules
96 get { return "CloudModule"; } 114 get { return "CloudModule"; }
97 } 115 }
98 116
99 public bool IsSharedModule
100 {
101 get { return false; }
102 }
103
104
105 public float CloudCover(int x, int y, int z) 117 public float CloudCover(int x, int y, int z)
106 { 118 {
107 float cover = 0f; 119 float cover = 0f;
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 695cced..39836ae 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -30,6 +30,7 @@ using System.IO;
30using System.Reflection; 30using System.Reflection;
31using System.Security; 31using System.Security;
32using log4net; 32using log4net;
33using Mono.Addins;
33using Nini.Config; 34using Nini.Config;
34using OpenMetaverse; 35using OpenMetaverse;
35using OpenSim.Framework; 36using OpenSim.Framework;
@@ -38,6 +39,7 @@ using OpenSim.Region.Framework.Scenes;
38 39
39namespace OpenSim.Region.CoreModules.World.Estate 40namespace OpenSim.Region.CoreModules.World.Estate
40{ 41{
42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
41 public class EstateManagementModule : IEstateModule 43 public class EstateManagementModule : IEstateModule
42 { 44 {
43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -898,7 +900,16 @@ namespace OpenSim.Region.CoreModules.World.Estate
898 900
899 #region IRegionModule Members 901 #region IRegionModule Members
900 902
901 public void Initialise(Scene scene, IConfigSource source) 903 public void Initialise(IConfigSource source)
904 {
905 }
906
907 public Type ReplaceableInterface
908 {
909 get { return null; }
910 }
911
912 public void AddRegion(Scene scene)
902 { 913 {
903 m_scene = scene; 914 m_scene = scene;
904 m_scene.RegisterModuleInterface<IEstateModule>(this); 915 m_scene.RegisterModuleInterface<IEstateModule>(this);
@@ -920,6 +931,29 @@ namespace OpenSim.Region.CoreModules.World.Estate
920 consoleSetTerrainHeights); 931 consoleSetTerrainHeights);
921 } 932 }
922 933
934 public void RegionLoaded(Scene scene)
935 {
936 // Sets up the sun module based on the saved Estate and Region Settings
937 // DO NOT REMOVE or the sun will stop working
938 TriggerEstateToolsSunUpdate();
939 }
940
941 public void RemoveRegion(Scene scene)
942 {
943 scene.UnregisterModuleInterface<IEstateModule>(this);
944 scene.EventManager.OnNewClient -= EventManager_OnNewClient;
945 scene.EventManager.OnRequestChangeWaterHeight -= changeWaterHeight;
946 }
947
948 public void Close()
949 {
950 }
951
952 public string Name
953 {
954 get { return "EstateManagementModule"; }
955 }
956
923 #region Console Commands 957 #region Console Commands
924 958
925 public void consoleSetTerrainTexture(string module, string[] args) 959 public void consoleSetTerrainTexture(string module, string[] args)
@@ -1006,28 +1040,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
1006 } 1040 }
1007 1041
1008 #endregion 1042 #endregion
1009
1010 public void PostInitialise()
1011 {
1012 // Sets up the sun module based no the saved Estate and Region Settings
1013 // DO NOT REMOVE or the sun will stop working
1014 TriggerEstateToolsSunUpdate();
1015 }
1016
1017 public void Close()
1018 {
1019 }
1020
1021 public string Name
1022 {
1023 get { return "EstateManagementModule"; }
1024 }
1025
1026 public bool IsSharedModule
1027 {
1028 get { return false; }
1029 }
1030
1031 #endregion 1043 #endregion
1032 1044
1033 #region Other Functions 1045 #region Other Functions
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index f66f01f..68e8485 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using Mono.Addins;
32using Nini.Config; 33using Nini.Config;
33using OpenMetaverse; 34using OpenMetaverse;
34using OpenSim.Framework; 35using OpenSim.Framework;
@@ -89,7 +90,8 @@ enum GroupPowers : long
89 90
90namespace OpenSim.Region.CoreModules.World.Permissions 91namespace OpenSim.Region.CoreModules.World.Permissions
91{ 92{
92 public class PermissionsModule : IRegionModule 93 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
94 public class PermissionsModule : INonSharedRegionModule
93 { 95 {
94 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 96 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
95 97
@@ -148,12 +150,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
148 150
149 #endregion 151 #endregion
150 152
151 #region IRegionModule Members 153 #region INonSharedRegionModule Members
152 154
153 public void Initialise(Scene scene, IConfigSource config) 155 public void Initialise(IConfigSource config)
154 { 156 {
155 m_scene = scene;
156
157 IConfig myConfig = config.Configs["Startup"]; 157 IConfig myConfig = config.Configs["Startup"];
158 158
159 string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule"); 159 string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule");
@@ -177,7 +177,57 @@ namespace OpenSim.Region.CoreModules.World.Permissions
177 if (m_bypassPermissions) 177 if (m_bypassPermissions)
178 m_log.Info("[PERMISSIONS]: serviceside_object_permissions = false in ini file so disabling all region service permission checks"); 178 m_log.Info("[PERMISSIONS]: serviceside_object_permissions = false in ini file so disabling all region service permission checks");
179 else 179 else
180 m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks"); 180 m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks");
181
182 string grant = myConfig.GetString("GrantLSL","");
183 if (grant.Length > 0) {
184 foreach (string uuidl in grant.Split(',')) {
185 string uuid = uuidl.Trim(" \t".ToCharArray());
186 GrantLSL.Add(uuid, true);
187 }
188 }
189
190 grant = myConfig.GetString("GrantCS","");
191 if (grant.Length > 0) {
192 foreach (string uuidl in grant.Split(',')) {
193 string uuid = uuidl.Trim(" \t".ToCharArray());
194 GrantCS.Add(uuid, true);
195 }
196 }
197
198 grant = myConfig.GetString("GrantVB","");
199 if (grant.Length > 0) {
200 foreach (string uuidl in grant.Split(',')) {
201 string uuid = uuidl.Trim(" \t".ToCharArray());
202 GrantVB.Add(uuid, true);
203 }
204 }
205
206 grant = myConfig.GetString("GrantJS", "");
207 if (grant.Length > 0)
208 {
209 foreach (string uuidl in grant.Split(','))
210 {
211 string uuid = uuidl.Trim(" \t".ToCharArray());
212 GrantJS.Add(uuid, true);
213 }
214 }
215
216 grant = myConfig.GetString("GrantYP", "");
217 if (grant.Length > 0)
218 {
219 foreach (string uuidl in grant.Split(','))
220 {
221 string uuid = uuidl.Trim(" \t".ToCharArray());
222 GrantYP.Add(uuid, true);
223 }
224 }
225
226 }
227
228 public void AddRegion(Scene scene)
229 {
230 m_scene = scene;
181 231
182 //Register functions with Scene External Checks! 232 //Register functions with Scene External Checks!
183 m_scene.Permissions.OnBypassPermissions += BypassPermissions; 233 m_scene.Permissions.OnBypassPermissions += BypassPermissions;
@@ -210,23 +260,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions
210 m_scene.Permissions.OnLinkObject += CanLinkObject; //NOT YET IMPLEMENTED 260 m_scene.Permissions.OnLinkObject += CanLinkObject; //NOT YET IMPLEMENTED
211 m_scene.Permissions.OnDelinkObject += CanDelinkObject; //NOT YET IMPLEMENTED 261 m_scene.Permissions.OnDelinkObject += CanDelinkObject; //NOT YET IMPLEMENTED
212 m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED 262 m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED
213 263
214 m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED 264 m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED
215 m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED 265 m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED
216 m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED 266 m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED
217 m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED 267 m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED
218 268
219 m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; //NOT IMPLEMENTED HERE 269 m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; //NOT IMPLEMENTED HERE
220 m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED 270 m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
221 m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED 271 m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED
222 m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED 272 m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED
223 m_scene.Permissions.OnResetScript += CanResetScript; 273 m_scene.Permissions.OnResetScript += CanResetScript;
224 274
225 m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; //NOT YET IMPLEMENTED 275 m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; //NOT YET IMPLEMENTED
226 m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; //NOT YET IMPLEMENTED 276 m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; //NOT YET IMPLEMENTED
227 m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; //NOT YET IMPLEMENTED 277 m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; //NOT YET IMPLEMENTED
228 m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED 278 m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED
229 279
230 m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED 280 m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED
231 m_scene.Permissions.OnUseObjectReturn += CanUseObjectReturn; //NOT YET IMPLEMENTED 281 m_scene.Permissions.OnUseObjectReturn += CanUseObjectReturn; //NOT YET IMPLEMENTED
232 282
@@ -244,52 +294,87 @@ namespace OpenSim.Region.CoreModules.World.Permissions
244 "debug permissions <true / false>", 294 "debug permissions <true / false>",
245 "Enable permissions debugging", 295 "Enable permissions debugging",
246 HandleDebugPermissions); 296 HandleDebugPermissions);
247 297 }
248
249 string grant = myConfig.GetString("GrantLSL","");
250 if (grant.Length > 0) {
251 foreach (string uuidl in grant.Split(',')) {
252 string uuid = uuidl.Trim(" \t".ToCharArray());
253 GrantLSL.Add(uuid, true);
254 }
255 }
256 298
257 grant = myConfig.GetString("GrantCS",""); 299 public Type ReplaceableInterface
258 if (grant.Length > 0) { 300 {
259 foreach (string uuidl in grant.Split(',')) { 301 get { return null; }
260 string uuid = uuidl.Trim(" \t".ToCharArray()); 302 }
261 GrantCS.Add(uuid, true);
262 }
263 }
264 303
265 grant = myConfig.GetString("GrantVB",""); 304 public void RegionLoaded(Scene scene)
266 if (grant.Length > 0) { 305 {
267 foreach (string uuidl in grant.Split(',')) { 306 m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
268 string uuid = uuidl.Trim(" \t".ToCharArray());
269 GrantVB.Add(uuid, true);
270 }
271 }
272 307
273 grant = myConfig.GetString("GrantJS", ""); 308 if (m_friendsModule == null)
274 if (grant.Length > 0) 309 m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work");
275 { 310 else
276 foreach (string uuidl in grant.Split(',')) 311 m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled");
277 { 312 }
278 string uuid = uuidl.Trim(" \t".ToCharArray());
279 GrantJS.Add(uuid, true);
280 }
281 }
282 313
283 grant = myConfig.GetString("GrantYP", ""); 314 public void RemoveRegion(Scene scene)
284 if (grant.Length > 0) 315 {
285 { 316 scene.Permissions.OnBypassPermissions -= BypassPermissions;
286 foreach (string uuidl in grant.Split(',')) 317 scene.Permissions.OnSetBypassPermissions -= SetBypassPermissions;
287 { 318 scene.Permissions.OnPropagatePermissions -= PropagatePermissions;
288 string uuid = uuidl.Trim(" \t".ToCharArray()); 319 scene.Permissions.OnGenerateClientFlags -= GenerateClientFlags;
289 GrantYP.Add(uuid, true); 320 scene.Permissions.OnAbandonParcel -= CanAbandonParcel;
290 } 321 scene.Permissions.OnReclaimParcel -= CanReclaimParcel;
291 } 322 scene.Permissions.OnDeedParcel -= CanDeedParcel;
323 scene.Permissions.OnDeedObject -= CanDeedObject;
324 scene.Permissions.OnIsGod -= IsGod;
325 scene.Permissions.OnDuplicateObject -= CanDuplicateObject;
326 scene.Permissions.OnDeleteObject -= CanDeleteObject; //MAYBE FULLY IMPLEMENTED
327 scene.Permissions.OnEditObject -= CanEditObject; //MAYBE FULLY IMPLEMENTED
328 scene.Permissions.OnEditParcel -= CanEditParcel; //MAYBE FULLY IMPLEMENTED
329 scene.Permissions.OnInstantMessage -= CanInstantMessage;
330 scene.Permissions.OnInventoryTransfer -= CanInventoryTransfer; //NOT YET IMPLEMENTED
331 scene.Permissions.OnIssueEstateCommand -= CanIssueEstateCommand; //FULLY IMPLEMENTED
332 scene.Permissions.OnMoveObject -= CanMoveObject; //MAYBE FULLY IMPLEMENTED
333 scene.Permissions.OnObjectEntry -= CanObjectEntry;
334 scene.Permissions.OnReturnObject -= CanReturnObject; //NOT YET IMPLEMENTED
335 scene.Permissions.OnRezObject -= CanRezObject; //MAYBE FULLY IMPLEMENTED
336 scene.Permissions.OnRunConsoleCommand -= CanRunConsoleCommand;
337 scene.Permissions.OnRunScript -= CanRunScript; //NOT YET IMPLEMENTED
338 scene.Permissions.OnCompileScript -= CanCompileScript;
339 scene.Permissions.OnSellParcel -= CanSellParcel;
340 scene.Permissions.OnTakeObject -= CanTakeObject;
341 scene.Permissions.OnTakeCopyObject -= CanTakeCopyObject;
342 scene.Permissions.OnTerraformLand -= CanTerraformLand;
343 scene.Permissions.OnLinkObject -= CanLinkObject; //NOT YET IMPLEMENTED
344 scene.Permissions.OnDelinkObject -= CanDelinkObject; //NOT YET IMPLEMENTED
345 scene.Permissions.OnBuyLand -= CanBuyLand; //NOT YET IMPLEMENTED
346
347 scene.Permissions.OnViewNotecard -= CanViewNotecard; //NOT YET IMPLEMENTED
348 scene.Permissions.OnViewScript -= CanViewScript; //NOT YET IMPLEMENTED
349 scene.Permissions.OnEditNotecard -= CanEditNotecard; //NOT YET IMPLEMENTED
350 scene.Permissions.OnEditScript -= CanEditScript; //NOT YET IMPLEMENTED
351
352 scene.Permissions.OnCreateObjectInventory -= CanCreateObjectInventory; //NOT IMPLEMENTED HERE
353 scene.Permissions.OnEditObjectInventory -= CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED
354 scene.Permissions.OnCopyObjectInventory -= CanCopyObjectInventory; //NOT YET IMPLEMENTED
355 scene.Permissions.OnDeleteObjectInventory -= CanDeleteObjectInventory; //NOT YET IMPLEMENTED
356 scene.Permissions.OnResetScript -= CanResetScript;
357
358 scene.Permissions.OnCreateUserInventory -= CanCreateUserInventory; //NOT YET IMPLEMENTED
359 scene.Permissions.OnCopyUserInventory -= CanCopyUserInventory; //NOT YET IMPLEMENTED
360 scene.Permissions.OnEditUserInventory -= CanEditUserInventory; //NOT YET IMPLEMENTED
361 scene.Permissions.OnDeleteUserInventory -= CanDeleteUserInventory; //NOT YET IMPLEMENTED
362
363 scene.Permissions.OnTeleport -= CanTeleport; //NOT YET IMPLEMENTED
364 scene.Permissions.OnUseObjectReturn -= CanUseObjectReturn; //NOT YET IMPLEMENTED
365 }
366
367 public void PostInitialise()
368 {
369 }
370
371 public void Close()
372 {
373 }
292 374
375 public string Name
376 {
377 get { return "PermissionsModule"; }
293 } 378 }
294 379
295 public void HandleBypassPermissions(string module, string[] args) 380 public void HandleBypassPermissions(string module, string[] args)
@@ -362,31 +447,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
362 m_log.InfoFormat("[PERMISSIONS] Set permissions debugging to {0} in {1}", m_debugPermissions, m_scene.RegionInfo.RegionName); 447 m_log.InfoFormat("[PERMISSIONS] Set permissions debugging to {0} in {1}", m_debugPermissions, m_scene.RegionInfo.RegionName);
363 } 448 }
364 } 449 }
365
366 public void PostInitialise()
367 {
368 m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
369
370 if (m_friendsModule == null)
371 m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work");
372 else
373 m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled");
374 }
375
376 public void Close()
377 {
378 }
379
380 public string Name
381 {
382 get { return "PermissionsModule"; }
383 }
384
385 public bool IsSharedModule
386 {
387 get { return false; }
388 }
389
390 #endregion 450 #endregion
391 451
392 #region Helper Functions 452 #region Helper Functions
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
index 37f1f2e..ed7bfe1 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using Mono.Addins;
29using Nini.Config; 30using Nini.Config;
30using OpenMetaverse; 31using OpenMetaverse;
31using OpenSim.Framework; 32using OpenSim.Framework;
@@ -34,26 +35,44 @@ using OpenSim.Region.Framework.Scenes;
34 35
35namespace OpenSim.Region.CoreModules.World.Sound 36namespace OpenSim.Region.CoreModules.World.Sound
36{ 37{
37 public class SoundModule : IRegionModule, ISoundModule 38 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
39 public class SoundModule : INonSharedRegionModule, ISoundModule
38 { 40 {
39 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 42
41 protected Scene m_scene; 43 protected Scene m_scene;
42 44
43 public void Initialise(Scene scene, IConfigSource source) 45 public void Initialise(IConfigSource source)
46 {
47 }
48
49 public void AddRegion(Scene scene)
44 { 50 {
45 m_scene = scene; 51 m_scene = scene;
46 52
47 m_scene.EventManager.OnNewClient += OnNewClient; 53 m_scene.EventManager.OnNewClient += OnNewClient;
48 54
49 m_scene.RegisterModuleInterface<ISoundModule>(this); 55 m_scene.RegisterModuleInterface<ISoundModule>(this);
50 } 56 }
57
58 public Type ReplaceableInterface
59 {
60 get { return null; }
61 }
62
63 public void RegionLoaded(Scene scene)
64 {
65 }
66
67 public void RemoveRegion(Scene scene)
68 {
69 scene.EventManager.OnNewClient -= OnNewClient;
70 scene.UnregisterModuleInterface<ISoundModule>(this);
71 }
51 72
52 public void PostInitialise() {}
53 public void Close() {} 73 public void Close() {}
54 public string Name { get { return "Sound Module"; } } 74 public string Name { get { return "Sound Module"; } }
55 public bool IsSharedModule { get { return false; } } 75
56
57 private void OnNewClient(IClientAPI client) 76 private void OnNewClient(IClientAPI client)
58 { 77 {
59 client.OnSoundTrigger += TriggerSound; 78 client.OnSoundTrigger += TriggerSound;
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
index 0712a7f..948c47c 100644
--- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
@@ -29,6 +29,7 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection; 30using System.Reflection;
31using log4net; 31using log4net;
32using Mono.Addins;
32using Nini.Config; 33using Nini.Config;
33using OpenMetaverse; 34using OpenMetaverse;
34using OpenSim.Framework; 35using OpenSim.Framework;
@@ -37,6 +38,7 @@ using OpenSim.Region.Framework.Scenes;
37 38
38namespace OpenSim.Region.CoreModules 39namespace OpenSim.Region.CoreModules
39{ 40{
41 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
40 public class SunModule : ISunModule 42 public class SunModule : ISunModule
41 { 43 {
42 /// <summary> 44 /// <summary>
@@ -278,27 +280,12 @@ namespace OpenSim.Region.CoreModules
278 return GetCurrentSunHour() + 6.0f; 280 return GetCurrentSunHour() + 6.0f;
279 } 281 }
280 282
281 #region IRegion Methods 283 #region INonSharedRegionModule Methods
282 284
283 // Called immediately after the module is loaded for a given region 285 // Called immediately after the module is loaded for a given region
284 // i.e. Immediately after instance creation. 286 // i.e. Immediately after instance creation.
285 public void Initialise(Scene scene, IConfigSource config) 287 public void Initialise(IConfigSource config)
286 { 288 {
287 m_scene = scene;
288 m_frame = 0;
289
290 // This one puts an entry in the main help screen
291 m_scene.AddCommand(this, String.Empty, "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null);
292
293 // This one enables the ability to type just "sun" without any parameters
294 m_scene.AddCommand(this, "sun", "", "", HandleSunConsoleCommand);
295 foreach (KeyValuePair<string, string> kvp in GetParamList())
296 {
297 m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand);
298 }
299
300
301
302 TimeZone local = TimeZone.CurrentTimeZone; 289 TimeZone local = TimeZone.CurrentTimeZone;
303 TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; 290 TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks;
304 m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset); 291 m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset);
@@ -346,7 +333,43 @@ namespace OpenSim.Region.CoreModules
346 // m_latitude = d_latitude; 333 // m_latitude = d_latitude;
347 // m_longitude = d_longitude; 334 // m_longitude = d_longitude;
348 } 335 }
336 }
337
338 public void Close()
339 {
340 ready = false;
341
342 // Remove our hooks
343 m_scene.EventManager.OnFrame -= SunUpdate;
344 m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
345 m_scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate;
346 m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour;
347 }
348
349 public string Name
350 {
351 get { return "SunModule"; }
352 }
353
354 public Type ReplaceableInterface
355 {
356 get { return null; }
357 }
358
359 public void AddRegion(Scene scene)
360 {
361 m_scene = scene;
362 m_frame = 0;
363
364 // This one puts an entry in the main help screen
365 m_scene.AddCommand(this, String.Empty, "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null);
349 366
367 // This one enables the ability to type just "sun" without any parameters
368 m_scene.AddCommand(this, "sun", "", "", HandleSunConsoleCommand);
369 foreach (KeyValuePair<string, string> kvp in GetParamList())
370 {
371 m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand);
372 }
350 switch (m_RegionMode) 373 switch (m_RegionMode)
351 { 374 {
352 case "T1": 375 case "T1":
@@ -354,8 +377,8 @@ namespace OpenSim.Region.CoreModules
354 case "SL": 377 case "SL":
355 // Time taken to complete a cycle (day and season) 378 // Time taken to complete a cycle (day and season)
356 379
357 SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60); 380 SecondsPerSunCycle = (uint)(m_DayLengthHours * 60 * 60);
358 SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays); 381 SecondsPerYear = (uint)(SecondsPerSunCycle * m_YearLengthDays);
359 382
360 // Ration of real-to-virtual time 383 // Ration of real-to-virtual time
361 384
@@ -364,17 +387,17 @@ namespace OpenSim.Region.CoreModules
364 // Speed of rotation needed to complete a cycle in the 387 // Speed of rotation needed to complete a cycle in the
365 // designated period (day and season) 388 // designated period (day and season)
366 389
367 SunSpeed = m_SunCycle/SecondsPerSunCycle; 390 SunSpeed = m_SunCycle / SecondsPerSunCycle;
368 SeasonSpeed = m_SeasonalCycle/SecondsPerYear; 391 SeasonSpeed = m_SeasonalCycle / SecondsPerYear;
369 392
370 // Horizon translation 393 // Horizon translation
371 394
372 HorizonShift = m_HorizonShift; // Z axis translation 395 HorizonShift = m_HorizonShift; // Z axis translation
373 // HoursToRadians = (SunCycle/24)*VWTimeRatio; 396 // HoursToRadians = (SunCycle/24)*VWTimeRatio;
374 397
375 // Insert our event handling hooks 398 // Insert our event handling hooks
376 399
377 scene.EventManager.OnFrame += SunUpdate; 400 scene.EventManager.OnFrame += SunUpdate;
378 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; 401 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
379 scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate; 402 scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate;
380 scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour; 403 scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour;
@@ -391,34 +414,21 @@ namespace OpenSim.Region.CoreModules
391 } 414 }
392 415
393 scene.RegisterModuleInterface<ISunModule>(this); 416 scene.RegisterModuleInterface<ISunModule>(this);
394
395 } 417 }
396 418
397 419 public void RegionLoaded(Scene scene)
398 public void PostInitialise()
399 { 420 {
400 } 421 }
401 422
402 public void Close() 423 public void RemoveRegion(Scene scene)
403 {
404 ready = false;
405
406 // Remove our hooks
407 m_scene.EventManager.OnFrame -= SunUpdate;
408 m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
409 m_scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate;
410 m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour;
411 }
412
413 public string Name
414 { 424 {
415 get { return "SunModule"; } 425 scene.RegisterModuleInterface<ISunModule>(this);
426 scene.EventManager.OnFrame -= SunUpdate;
427 scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
428 scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate;
429 scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour;
416 } 430 }
417 431
418 public bool IsSharedModule
419 {
420 get { return false; }
421 }
422 #endregion 432 #endregion
423 433
424 #region EventManager Events 434 #region EventManager Events
diff --git a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
index c2ad7b8..0b487ed 100644
--- a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
+++ b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Reflection; 29using System.Reflection;
30using log4net; 30using log4net;
31using Mono.Addins;
31using Nini.Config; 32using Nini.Config;
32using OpenMetaverse; 33using OpenMetaverse;
33using OpenSim.Framework; 34using OpenSim.Framework;
@@ -36,7 +37,8 @@ using OpenSim.Region.Framework.Scenes;
36 37
37namespace OpenSim.Region.CoreModules.Avatar.Vegetation 38namespace OpenSim.Region.CoreModules.Avatar.Vegetation
38{ 39{
39 public class VegetationModule : IRegionModule, IVegetationModule 40 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
41 public class VegetationModule : INonSharedRegionModule, IVegetationModule
40 { 42 {
41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
42 44
@@ -45,17 +47,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation
45 protected static readonly PCode[] creationCapabilities = new PCode[] { PCode.Grass, PCode.NewTree, PCode.Tree }; 47 protected static readonly PCode[] creationCapabilities = new PCode[] { PCode.Grass, PCode.NewTree, PCode.Tree };
46 public PCode[] CreationCapabilities { get { return creationCapabilities; } } 48 public PCode[] CreationCapabilities { get { return creationCapabilities; } }
47 49
48 public void Initialise(Scene scene, IConfigSource source) 50 public void Initialise(IConfigSource source)
51 {
52 }
53
54 public void AddRegion(Scene scene)
49 { 55 {
50 m_scene = scene; 56 m_scene = scene;
51 m_scene.RegisterModuleInterface<IVegetationModule>(this); 57 m_scene.RegisterModuleInterface<IVegetationModule>(this);
52 } 58 }
59
60 public Type ReplaceableInterface
61 {
62 get { return null; }
63 }
64
65 public void RegionLoaded(Scene scene)
66 {
67 }
68
69 public void RemoveRegion(Scene scene)
70 {
71 scene.UnregisterModuleInterface<IVegetationModule>(this);
72 }
53 73
54 public void PostInitialise() {} 74 public void PostInitialise() {}
55 public void Close() {} 75 public void Close() {}
56 public string Name { get { return "Vegetation Module"; } } 76 public string Name { get { return "Vegetation Module"; } }
57 public bool IsSharedModule { get { return false; } } 77
58
59 public SceneObjectGroup AddTree( 78 public SceneObjectGroup AddTree(
60 UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree) 79 UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree)
61 { 80 {
diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
index 3283c1f..cd3706d 100644
--- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
@@ -55,17 +55,19 @@ namespace OpenSim.Region.CoreModules
55 55
56 private IWindModelPlugin m_activeWindPlugin = null; 56 private IWindModelPlugin m_activeWindPlugin = null;
57 private const string m_dWindPluginName = "SimpleRandomWind"; 57 private const string m_dWindPluginName = "SimpleRandomWind";
58 private string m_desiredWindPlugin = "SimpleRandomWind";
58 private Dictionary<string, IWindModelPlugin> m_availableWindPlugins = new Dictionary<string, IWindModelPlugin>(); 59 private Dictionary<string, IWindModelPlugin> m_availableWindPlugins = new Dictionary<string, IWindModelPlugin>();
59 60
60 // Simplified windSpeeds based on the fact that the client protocal tracks at a resolution of 16m 61 // Simplified windSpeeds based on the fact that the client protocal tracks at a resolution of 16m
61 private Vector2[] windSpeeds = new Vector2[16 * 16]; 62 private Vector2[] windSpeeds = new Vector2[16 * 16];
63 private IConfig windConfig;
62 64
63 #region IRegion Methods 65 #region IRegion Methods
64 66
65 public void Initialise(Scene scene, IConfigSource config) 67 public void Initialise(IConfigSource config)
66 { 68 {
67 IConfig windConfig = config.Configs["Wind"]; 69 windConfig = config.Configs["Wind"];
68 string desiredWindPlugin = m_dWindPluginName; 70 m_desiredWindPlugin = m_dWindPluginName;
69 71
70 if (windConfig != null) 72 if (windConfig != null)
71 { 73 {
@@ -76,10 +78,18 @@ namespace OpenSim.Region.CoreModules
76 // Determine which wind model plugin is desired 78 // Determine which wind model plugin is desired
77 if (windConfig.Contains("wind_plugin")) 79 if (windConfig.Contains("wind_plugin"))
78 { 80 {
79 desiredWindPlugin = windConfig.GetString("wind_plugin"); 81 m_desiredWindPlugin = windConfig.GetString("wind_plugin");
80 } 82 }
81 } 83 }
84 }
85
86 public Type ReplaceableInterface
87 {
88 get { return null; }
89 }
82 90
91 public void AddRegion(Scene scene)
92 {
83 if (m_enabled) 93 if (m_enabled)
84 { 94 {
85 m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate); 95 m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate);
@@ -95,30 +105,30 @@ namespace OpenSim.Region.CoreModules
95 } 105 }
96 106
97 // Check for desired plugin 107 // Check for desired plugin
98 if (m_availableWindPlugins.ContainsKey(desiredWindPlugin)) 108 if (m_availableWindPlugins.ContainsKey(m_desiredWindPlugin))
99 { 109 {
100 m_activeWindPlugin = m_availableWindPlugins[desiredWindPlugin]; 110 m_activeWindPlugin = m_availableWindPlugins[m_desiredWindPlugin];
101 111
102 m_log.InfoFormat("[WIND] {0} plugin found, initializing.", desiredWindPlugin); 112 m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_desiredWindPlugin);
103 113
104 if (windConfig != null) 114 if (windConfig != null)
105 { 115 {
106 m_activeWindPlugin.Initialise(); 116 m_activeWindPlugin.Initialise();
107 m_activeWindPlugin.WindConfig(m_scene, windConfig); 117 m_activeWindPlugin.WindConfig(m_scene, windConfig);
108 } 118 }
109 } 119 }
110 120
111 121
112 // if the plug-in wasn't found, default to no wind. 122 // if the plug-in wasn't found, default to no wind.
113 if (m_activeWindPlugin == null) 123 if (m_activeWindPlugin == null)
114 { 124 {
115 m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", desiredWindPlugin); 125 m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", m_desiredWindPlugin);
116 m_log.ErrorFormat("[WIND] Defaulting to no wind."); 126 m_log.ErrorFormat("[WIND] Defaulting to no wind.");
117 } 127 }
118 128
119 // This one puts an entry in the main help screen 129 // This one puts an entry in the main help screen
120 m_scene.AddCommand(this, String.Empty, "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null); 130 m_scene.AddCommand(this, String.Empty, "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null);
121 131
122 // This one enables the ability to type just the base command without any parameters 132 // This one enables the ability to type just the base command without any parameters
123 m_scene.AddCommand(this, "wind", "", "", HandleConsoleCommand); 133 m_scene.AddCommand(this, "wind", "", "", HandleConsoleCommand);
124 134
@@ -127,7 +137,7 @@ namespace OpenSim.Region.CoreModules
127 { 137 {
128 m_scene.AddCommand(this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); 138 m_scene.AddCommand(this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand);
129 m_scene.AddCommand(this, String.Format("wind base wind_update_rate"), "Change the wind update rate.", "", HandleConsoleBaseCommand); 139 m_scene.AddCommand(this, String.Format("wind base wind_update_rate"), "Change the wind update rate.", "", HandleConsoleBaseCommand);
130 140
131 foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams()) 141 foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams())
132 { 142 {
133 m_scene.AddCommand(this, String.Format("wind {0} {1}", windPlugin.Name, kvp.Key), String.Format("{0} : {1} - {2}", windPlugin.Name, kvp.Key, kvp.Value), "", HandleConsoleParamCommand); 143 m_scene.AddCommand(this, String.Format("wind {0} {1}", windPlugin.Name, kvp.Key), String.Format("{0} : {1} - {2}", windPlugin.Name, kvp.Key, kvp.Value), "", HandleConsoleParamCommand);
@@ -149,11 +159,17 @@ namespace OpenSim.Region.CoreModules
149 m_ready = true; 159 m_ready = true;
150 160
151 } 161 }
162 }
152 163
164 public void RegionLoaded(Scene scene)
165 {
153 } 166 }
154 167
155 public void PostInitialise() 168 public void RemoveRegion(Scene scene)
156 { 169 {
170 scene.EventManager.OnFrame -= WindUpdate;
171 scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion;
172 scene.UnregisterModuleInterface<IWindModule>(this);
157 } 173 }
158 174
159 public void Close() 175 public void Close()
@@ -182,11 +198,6 @@ namespace OpenSim.Region.CoreModules
182 get { return "WindModule"; } 198 get { return "WindModule"; }
183 } 199 }
184 200
185 public bool IsSharedModule
186 {
187 get { return false; }
188 }
189
190 201
191 #endregion 202 #endregion
192 203
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
index 285d36a..6bda1e9 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
30using System.Drawing; 30using System.Drawing;
31using System.Reflection; 31using System.Reflection;
32using log4net; 32using log4net;
33using Mono.Addins;
33using Nini.Config; 34using Nini.Config;
34using OpenMetaverse; 35using OpenMetaverse;
35using OpenMetaverse.Imaging; 36using OpenMetaverse.Imaging;
@@ -59,7 +60,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
59 public face[] trns; 60 public face[] trns;
60 } 61 }
61 62
62 public class MapImageModule : IMapImageGenerator, IRegionModule 63 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
64 public class MapImageModule : IMapImageGenerator, INonSharedRegionModule
63 { 65 {
64 private static readonly ILog m_log = 66 private static readonly ILog m_log =
65 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 67 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -128,37 +130,45 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
128 130
129 #endregion 131 #endregion
130 132
131 #region IRegionModule Members 133 #region INonSharedRegionModule Members
132 134
133 public void Initialise(Scene scene, IConfigSource source) 135 public void Initialise(IConfigSource source)
134 { 136 {
135 m_scene = scene;
136 m_config = source; 137 m_config = source;
137 138
138 IConfig startupConfig = m_config.Configs["Startup"]; 139 IConfig startupConfig = m_config.Configs["Startup"];
139 if (startupConfig.GetString("MapImageModule", "MapImageModule") != 140 if (startupConfig.GetString("MapImageModule", "MapImageModule") !=
140 "MapImageModule") 141 "MapImageModule")
141 return; 142 return;
143 }
142 144
145 public void AddRegion(Scene scene)
146 {
147 m_scene = scene;
143 m_scene.RegisterModuleInterface<IMapImageGenerator>(this); 148 m_scene.RegisterModuleInterface<IMapImageGenerator>(this);
144 } 149 }
145 150
146 public void PostInitialise() 151 public Type ReplaceableInterface
147 { 152 {
153 get { return null; }
148 } 154 }
149 155
150 public void Close() 156 public void RegionLoaded(Scene scene)
151 { 157 {
152 } 158 }
153 159
154 public string Name 160 public void RemoveRegion(Scene scene)
155 { 161 {
156 get { return "MapImageModule"; } 162 scene.UnregisterModuleInterface<IMapImageGenerator>(this);
157 } 163 }
158 164
159 public bool IsSharedModule 165 public void Close()
166 {
167 }
168
169 public string Name
160 { 170 {
161 get { return false; } 171 get { return "MapImageModule"; }
162 } 172 }
163 173
164 #endregion 174 #endregion
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index be46fa5..dd33673 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -24,9 +24,12 @@
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27
28using System;
27using System.Collections.Generic; 29using System.Collections.Generic;
28using System.Reflection; 30using System.Reflection;
29using log4net; 31using log4net;
32using Mono.Addins;
30using Nini.Config; 33using Nini.Config;
31using OpenMetaverse; 34using OpenMetaverse;
32using OpenSim.Framework; 35using OpenSim.Framework;
@@ -38,7 +41,8 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
38 41
39namespace OpenSim.Region.CoreModules.World.WorldMap 42namespace OpenSim.Region.CoreModules.World.WorldMap
40{ 43{
41 public class MapSearchModule : IRegionModule 44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")]
45 public class MapSearchModule : ISharedRegionModule
42 { 46 {
43 private static readonly ILog m_log = 47 private static readonly ILog m_log =
44 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 48 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -46,8 +50,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
46 Scene m_scene = null; // only need one for communication with GridService 50 Scene m_scene = null; // only need one for communication with GridService
47 List<Scene> m_scenes = new List<Scene>(); 51 List<Scene> m_scenes = new List<Scene>();
48 52
49 #region IRegionModule Members 53 #region ISharedRegionModule Members
50 public void Initialise(Scene scene, IConfigSource source) 54 public void Initialise(IConfigSource source)
55 {
56 }
57
58 public void AddRegion(Scene scene)
51 { 59 {
52 if (m_scene == null) 60 if (m_scene == null)
53 { 61 {
@@ -58,6 +66,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
58 scene.EventManager.OnNewClient += OnNewClient; 66 scene.EventManager.OnNewClient += OnNewClient;
59 } 67 }
60 68
69 public Type ReplaceableInterface
70 {
71 get { return null; }
72 }
73
74 public void RegionLoaded(Scene scene)
75 {
76 }
77
78 public void RemoveRegion(Scene scene)
79 {
80 if(m_scenes.Contains(scene))
81 m_scenes.Remove(scene);
82 scene.EventManager.OnNewClient -= OnNewClient;
83 }
84
61 public void PostInitialise() 85 public void PostInitialise()
62 { 86 {
63 } 87 }
@@ -73,11 +97,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
73 get { return "MapSearchModule"; } 97 get { return "MapSearchModule"; }
74 } 98 }
75 99
76 public bool IsSharedModule
77 {
78 get { return true; }
79 }
80
81 #endregion 100 #endregion
82 101
83 private void OnNewClient(IClientAPI client) 102 private void OnNewClient(IClientAPI client)