aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World
diff options
context:
space:
mode:
authorBlueWall2012-11-25 17:03:14 -0500
committerBlueWall2012-11-25 17:03:14 -0500
commitc754003944d0166bf50b4f94b0c0eea642503bb0 (patch)
treedfa1c2020d5500d510519d5b2b3236600692f277 /OpenSim/Region/CoreModules/World
parentMerge branch 'master' into connector_plugin (diff)
parentCombine TestDeleteSceneObjectAsync() with TestDeRezSceneObject() as they are ... (diff)
downloadopensim-SC-c754003944d0166bf50b4f94b0c0eea642503bb0.zip
opensim-SC-c754003944d0166bf50b4f94b0c0eea642503bb0.tar.gz
opensim-SC-c754003944d0166bf50b4f94b0c0eea642503bb0.tar.bz2
opensim-SC-c754003944d0166bf50b4f94b0c0eea642503bb0.tar.xz
Merge branch 'master' into connector_plugin
Conflicts: OpenSim/Server/Base/ServicesServerBase.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/World')
-rw-r--r--OpenSim/Region/CoreModules/World/Access/AccessModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs25
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs11
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs22
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs317
-rw-r--r--OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs57
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs128
-rw-r--r--OpenSim/Region/CoreModules/World/Land/DwellModule.cs112
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs20
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs13
-rw-r--r--OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs224
-rw-r--r--OpenSim/Region/CoreModules/World/LightShare/LightShareModule.cs297
-rw-r--r--OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs181
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs267
-rw-r--r--OpenSim/Region/CoreModules/World/Region/RestartModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Sound/SoundModule.cs315
-rw-r--r--OpenSim/Region/CoreModules/World/Sun/SunModule.cs64
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs3
-rw-r--r--OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs30
-rw-r--r--OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Wind/WindModule.cs185
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs99
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs2
34 files changed, 1797 insertions, 613 deletions
diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
index e7b1454..1599f15 100644
--- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
+++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.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;
@@ -39,6 +40,7 @@ using OpenSim.Services.Interfaces;
39 40
40namespace OpenSim.Region.CoreModules.World 41namespace OpenSim.Region.CoreModules.World
41{ 42{
43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AccessModule")]
42 public class AccessModule : ISharedRegionModule 44 public class AccessModule : ISharedRegionModule
43 { 45 {
44// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index ea806ec..c810242 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -552,13 +552,22 @@ namespace OpenSim.Region.CoreModules.World.Archiver
552 552
553 // Validate User and Group UUID's 553 // Validate User and Group UUID's
554 554
555 if (!ResolveUserUuid(scene, parcel.OwnerID)) 555 if (parcel.IsGroupOwned)
556 parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner;
557
558 if (!ResolveGroupUuid(parcel.GroupID))
559 { 556 {
560 parcel.GroupID = UUID.Zero; 557 if (!ResolveGroupUuid(parcel.GroupID))
561 parcel.IsGroupOwned = false; 558 {
559 parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner;
560 parcel.GroupID = UUID.Zero;
561 parcel.IsGroupOwned = false;
562 }
563 }
564 else
565 {
566 if (!ResolveUserUuid(scene, parcel.OwnerID))
567 parcel.OwnerID = m_rootScene.RegionInfo.EstateSettings.EstateOwner;
568
569 if (!ResolveGroupUuid(parcel.GroupID))
570 parcel.GroupID = UUID.Zero;
562 } 571 }
563 572
564 List<LandAccessEntry> accessList = new List<LandAccessEntry>(); 573 List<LandAccessEntry> accessList = new List<LandAccessEntry>();
@@ -571,8 +580,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
571 parcel.ParcelAccessList = accessList; 580 parcel.ParcelAccessList = accessList;
572 581
573// m_log.DebugFormat( 582// m_log.DebugFormat(
574// "[ARCHIVER]: Adding parcel {0}, local id {1}, area {2}", 583// "[ARCHIVER]: Adding parcel {0}, local id {1}, owner {2}, group {3}, isGroupOwned {4}, area {5}",
575// parcel.Name, parcel.LocalID, parcel.Area); 584// parcel.Name, parcel.LocalID, parcel.OwnerID, parcel.GroupID, parcel.IsGroupOwned, parcel.Area);
576 585
577 landData.Add(parcel); 586 landData.Add(parcel);
578 } 587 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs
index a66ed88..d8dace2 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveScenesGroup.cs
@@ -110,7 +110,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
110 lastX = (lastX == null) ? curLastX : (lastX > curLastX) ? lastX : curLastX; 110 lastX = (lastX == null) ? curLastX : (lastX > curLastX) ? lastX : curLastX;
111 } 111 }
112 112
113 Rect = new Rectangle((int)firstX, (int)firstY, (int)(lastY - firstY + 1), (int)(lastX - firstX + 1)); 113 Rect = new Rectangle((int)firstX, (int)firstY, (int)(lastX - firstX + 1), (int)(lastY - firstY + 1));
114 114
115 115
116 // Calculate the subdirectory in which each region will be stored in the archive 116 // Calculate the subdirectory in which each region will be stored in the archive
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
index d751b1c..7bdd65c 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
@@ -167,7 +167,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
167 } 167 }
168 scenesGroup.CalcSceneLocations(); 168 scenesGroup.CalcSceneLocations();
169 169
170
171 m_archiveWriter = new TarArchiveWriter(m_saveStream); 170 m_archiveWriter = new TarArchiveWriter(m_saveStream);
172 171
173 try 172 try
@@ -216,7 +215,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
216 } 215 }
217 } 216 }
218 217
219
220 private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, AssetType> assetUuids) 218 private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, AssetType> assetUuids)
221 { 219 {
222 m_log.InfoFormat("[ARCHIVER]: Writing region {0}", scene.RegionInfo.RegionName); 220 m_log.InfoFormat("[ARCHIVER]: Writing region {0}", scene.RegionInfo.RegionName);
@@ -540,7 +538,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
540 xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y)); 538 xtw.WriteElementString("size_in_meters", string.Format("{0},{1}", size.X, size.Y));
541 } 539 }
542 540
543
544 protected void Save(Scene scene, List<SceneObjectGroup> sceneObjects, string regionDir) 541 protected void Save(Scene scene, List<SceneObjectGroup> sceneObjects, string regionDir)
545 { 542 {
546 if (regionDir != string.Empty) 543 if (regionDir != string.Empty)
@@ -560,8 +557,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
560 foreach (ILandObject lo in landObjects) 557 foreach (ILandObject lo in landObjects)
561 { 558 {
562 LandData landData = lo.LandData; 559 LandData landData = lo.LandData;
563 string landDataPath = String.Format("{0}{1}{2}.xml", 560 string landDataPath
564 regionDir, ArchiveConstants.LANDDATA_PATH, landData.GlobalID.ToString()); 561 = String.Format("{0}{1}", regionDir, ArchiveConstants.CreateOarLandDataPath(landData));
565 m_archiveWriter.WriteFile(landDataPath, LandDataSerializer.Serialize(landData, m_options)); 562 m_archiveWriter.WriteFile(landDataPath, LandDataSerializer.Serialize(landData, m_options));
566 } 563 }
567 564
@@ -604,7 +601,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
604 601
605 CloseArchive(String.Empty); 602 CloseArchive(String.Empty);
606 } 603 }
607
608 604
609 /// <summary> 605 /// <summary>
610 /// Closes the archive and notifies that we're done. 606 /// Closes the archive and notifies that we're done.
@@ -629,6 +625,5 @@ namespace OpenSim.Region.CoreModules.World.Archiver
629 625
630 m_rootScene.EventManager.TriggerOarFileSaved(m_requestId, errorMessage); 626 m_rootScene.EventManager.TriggerOarFileSaved(m_requestId, errorMessage);
631 } 627 }
632
633 } 628 }
634} 629} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index 2a87dc2..1be6386 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -32,6 +32,9 @@ using System.Reflection;
32using log4net; 32using log4net;
33using NDesk.Options; 33using NDesk.Options;
34using Nini.Config; 34using Nini.Config;
35using Mono.Addins;
36using OpenSim.Framework;
37using OpenSim.Framework.Console;
35using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
37 40
@@ -40,6 +43,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
40 /// <summary> 43 /// <summary>
41 /// This module loads and saves OpenSimulator region archives 44 /// This module loads and saves OpenSimulator region archives
42 /// </summary> 45 /// </summary>
46 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ArchiverModule")]
43 public class ArchiverModule : INonSharedRegionModule, IRegionArchiverModule 47 public class ArchiverModule : INonSharedRegionModule, IRegionArchiverModule
44 { 48 {
45 private static readonly ILog m_log = 49 private static readonly ILog m_log =
@@ -117,7 +121,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
117// 121//
118// foreach (string param in mainParams) 122// foreach (string param in mainParams)
119// m_log.DebugFormat("GOT PARAM [{0}]", param); 123// m_log.DebugFormat("GOT PARAM [{0}]", param);
120 124
121 if (mainParams.Count > 2) 125 if (mainParams.Count > 2)
122 { 126 {
123 DearchiveRegion(mainParams[2], mergeOar, skipAssets, Guid.Empty); 127 DearchiveRegion(mainParams[2], mergeOar, skipAssets, Guid.Empty);
@@ -150,14 +154,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver
150 154
151 List<string> mainParams = ops.Parse(cmdparams); 155 List<string> mainParams = ops.Parse(cmdparams);
152 156
157 string path;
153 if (mainParams.Count > 2) 158 if (mainParams.Count > 2)
154 { 159 path = mainParams[2];
155 ArchiveRegion(mainParams[2], options);
156 }
157 else 160 else
158 { 161 path = DEFAULT_OAR_BACKUP_FILENAME;
159 ArchiveRegion(DEFAULT_OAR_BACKUP_FILENAME, options); 162
160 } 163 // Not doing this right now as this causes some problems with auto-backup systems. Maybe a force flag is
164 // needed
165// if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, path))
166// return;
167
168 ArchiveRegion(path, options);
161 } 169 }
162 170
163 public void ArchiveRegion(string savePath, Dictionary<string, object> options) 171 public void ArchiveRegion(string savePath, Dictionary<string, object> options)
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
index 5787279..103eb47 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
@@ -129,6 +129,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
129 m_options = options; 129 m_options = options;
130 m_repliesRequired = uuids.Count; 130 m_repliesRequired = uuids.Count;
131 131
132 // FIXME: This is a really poor way of handling the timeout since it will always leave the original requesting thread
133 // hanging. Need to restructure so an original request thread waits for a ManualResetEvent on asset received
134 // so we can properly abort that thread. Or request all assets synchronously, though that would be a more
135 // radical change
132 m_requestCallbackTimer = new System.Timers.Timer(TIMEOUT); 136 m_requestCallbackTimer = new System.Timers.Timer(TIMEOUT);
133 m_requestCallbackTimer.AutoReset = false; 137 m_requestCallbackTimer.AutoReset = false;
134 m_requestCallbackTimer.Elapsed += new ElapsedEventHandler(OnRequestCallbackTimeout); 138 m_requestCallbackTimer.Elapsed += new ElapsedEventHandler(OnRequestCallbackTimeout);
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 82f49b0..eec1cec 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -31,16 +31,19 @@ using System.IO;
31using System.Reflection; 31using System.Reflection;
32using System.Threading; 32using System.Threading;
33using log4net.Config; 33using log4net.Config;
34using Nini.Config;
34using NUnit.Framework; 35using NUnit.Framework;
35using OpenMetaverse; 36using OpenMetaverse;
36using OpenMetaverse.Assets; 37using OpenMetaverse.Assets;
37using OpenSim.Framework; 38using OpenSim.Framework;
38using OpenSim.Framework.Serialization; 39using OpenSim.Framework.Serialization;
39using OpenSim.Framework.Serialization.External; 40using OpenSim.Framework.Serialization.External;
41using OpenSim.Region.CoreModules.World.Land;
40using OpenSim.Region.CoreModules.World.Serialiser; 42using OpenSim.Region.CoreModules.World.Serialiser;
41using OpenSim.Region.CoreModules.World.Terrain; 43using OpenSim.Region.CoreModules.World.Terrain;
42using OpenSim.Region.Framework.Scenes; 44using OpenSim.Region.Framework.Scenes;
43using OpenSim.Region.Framework.Scenes.Serialization; 45using OpenSim.Region.Framework.Scenes.Serialization;
46using OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups;
44using OpenSim.Tests.Common; 47using OpenSim.Tests.Common;
45using OpenSim.Tests.Common.Mock; 48using OpenSim.Tests.Common.Mock;
46using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants; 49using ArchiveConstants = OpenSim.Framework.Serialization.ArchiveConstants;
@@ -69,9 +72,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
69 { 72 {
70 base.SetUp(); 73 base.SetUp();
71 74
72 // FIXME: Do something about this - relying on statics in unit tests causes trouble sooner or later
73 new SceneManager();
74
75 m_archiverModule = new ArchiverModule(); 75 m_archiverModule = new ArchiverModule();
76 m_serialiserModule = new SerialiserModule(); 76 m_serialiserModule = new SerialiserModule();
77 TerrainModule terrainModule = new TerrainModule(); 77 TerrainModule terrainModule = new TerrainModule();
@@ -127,6 +127,53 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
127 127
128 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; 128 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
129 } 129 }
130
131 private void CreateTestObjects(Scene scene, out SceneObjectGroup sog1, out SceneObjectGroup sog2, out UUID ncAssetUuid)
132 {
133 SceneObjectPart part1 = CreateSceneObjectPart1();
134 sog1 = new SceneObjectGroup(part1);
135 scene.AddNewSceneObject(sog1, false);
136
137 AssetNotecard nc = new AssetNotecard();
138 nc.BodyText = "Hello World!";
139 nc.Encode();
140 ncAssetUuid = UUID.Random();
141 UUID ncItemUuid = UUID.Random();
142 AssetBase ncAsset
143 = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
144 m_scene.AssetService.Store(ncAsset);
145
146 TaskInventoryItem ncItem
147 = new TaskInventoryItem { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid };
148 SceneObjectPart part2 = CreateSceneObjectPart2();
149 sog2 = new SceneObjectGroup(part2);
150 part2.Inventory.AddInventoryItem(ncItem, true);
151
152 scene.AddNewSceneObject(sog2, false);
153 }
154
155 private static void CreateSoundAsset(TarArchiveWriter tar, Assembly assembly, string soundDataResourceName, out byte[] soundData, out UUID soundUuid)
156 {
157 using (Stream resource = assembly.GetManifestResourceStream(soundDataResourceName))
158 {
159 using (BinaryReader br = new BinaryReader(resource))
160 {
161 // FIXME: Use the inspector instead
162 soundData = br.ReadBytes(99999999);
163 soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
164 string soundAssetFileName
165 = ArchiveConstants.ASSETS_PATH + soundUuid
166 + ArchiveConstants.ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV];
167 tar.WriteFile(soundAssetFileName, soundData);
168
169 /*
170 AssetBase soundAsset = AssetHelpers.CreateAsset(soundUuid, soundData);
171 scene.AssetService.Store(soundAsset);
172 asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav";
173 */
174 }
175 }
176 }
130 177
131 /// <summary> 178 /// <summary>
132 /// Test saving an OpenSim Region Archive. 179 /// Test saving an OpenSim Region Archive.
@@ -204,30 +251,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
204 // TODO: Test presence of more files and contents of files. 251 // TODO: Test presence of more files and contents of files.
205 } 252 }
206 253
207 private void CreateTestObjects(Scene scene, out SceneObjectGroup sog1, out SceneObjectGroup sog2, out UUID ncAssetUuid)
208 {
209 SceneObjectPart part1 = CreateSceneObjectPart1();
210 sog1 = new SceneObjectGroup(part1);
211 scene.AddNewSceneObject(sog1, false);
212
213 AssetNotecard nc = new AssetNotecard();
214 nc.BodyText = "Hello World!";
215 nc.Encode();
216 ncAssetUuid = UUID.Random();
217 UUID ncItemUuid = UUID.Random();
218 AssetBase ncAsset
219 = AssetHelpers.CreateAsset(ncAssetUuid, AssetType.Notecard, nc.AssetData, UUID.Zero);
220 m_scene.AssetService.Store(ncAsset);
221
222 TaskInventoryItem ncItem
223 = new TaskInventoryItem { Name = "ncItem", AssetID = ncAssetUuid, ItemID = ncItemUuid };
224 SceneObjectPart part2 = CreateSceneObjectPart2();
225 sog2 = new SceneObjectGroup(part2);
226 part2.Inventory.AddInventoryItem(ncItem, true);
227
228 scene.AddNewSceneObject(sog2, false);
229 }
230
231 /// <summary> 254 /// <summary>
232 /// Test saving an OpenSim Region Archive with the no assets option 255 /// Test saving an OpenSim Region Archive with the no assets option
233 /// </summary> 256 /// </summary>
@@ -309,59 +332,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
309 } 332 }
310 333
311 /// <summary> 334 /// <summary>
312 /// Test loading an OpenSim Region Archive where the scene object parts are not ordered by link number (e.g.
313 /// 2 can come after 3).
314 /// </summary>
315 [Test]
316 public void TestLoadOarUnorderedParts()
317 {
318 TestHelpers.InMethod();
319
320 UUID ownerId = TestHelpers.ParseTail(0xaaaa);
321
322 MemoryStream archiveWriteStream = new MemoryStream();
323 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
324
325 tar.WriteFile(
326 ArchiveConstants.CONTROL_FILE_PATH,
327 new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup()));
328
329 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ownerId, "obj1-", 0x11);
330 SceneObjectPart sop2
331 = SceneHelpers.CreateSceneObjectPart("obj1-Part2", TestHelpers.ParseTail(0x12), ownerId);
332 SceneObjectPart sop3
333 = SceneHelpers.CreateSceneObjectPart("obj1-Part3", TestHelpers.ParseTail(0x13), ownerId);
334
335 // Add the parts so they will be written out in reverse order to the oar
336 sog1.AddPart(sop3);
337 sop3.LinkNum = 3;
338 sog1.AddPart(sop2);
339 sop2.LinkNum = 2;
340
341 tar.WriteFile(
342 ArchiveConstants.CreateOarObjectPath(sog1.Name, sog1.UUID, sog1.AbsolutePosition),
343 SceneObjectSerializer.ToXml2Format(sog1));
344
345 tar.Close();
346
347 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
348
349 lock (this)
350 {
351 m_scene.EventManager.OnOarFileLoaded += LoadCompleted;
352 m_archiverModule.DearchiveRegion(archiveReadStream);
353 }
354
355 Assert.That(m_lastErrorMessage, Is.Null);
356
357 SceneObjectPart part2 = m_scene.GetSceneObjectPart("obj1-Part2");
358 Assert.That(part2.LinkNum, Is.EqualTo(2));
359
360 SceneObjectPart part3 = m_scene.GetSceneObjectPart("obj1-Part3");
361 Assert.That(part3.LinkNum, Is.EqualTo(3));
362 }
363
364 /// <summary>
365 /// Test loading an OpenSim Region Archive. 335 /// Test loading an OpenSim Region Archive.
366 /// </summary> 336 /// </summary>
367 [Test] 337 [Test]
@@ -435,50 +405,57 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
435 TestLoadedRegion(part1, soundItemName, soundData); 405 TestLoadedRegion(part1, soundItemName, soundData);
436 } 406 }
437 407
438 private static void CreateSoundAsset(TarArchiveWriter tar, Assembly assembly, string soundDataResourceName, out byte[] soundData, out UUID soundUuid) 408 /// <summary>
409 /// Test loading an OpenSim Region Archive where the scene object parts are not ordered by link number (e.g.
410 /// 2 can come after 3).
411 /// </summary>
412 [Test]
413 public void TestLoadOarUnorderedParts()
439 { 414 {
440 using (Stream resource = assembly.GetManifestResourceStream(soundDataResourceName)) 415 TestHelpers.InMethod();
441 {
442 using (BinaryReader br = new BinaryReader(resource))
443 {
444 // FIXME: Use the inspector instead
445 soundData = br.ReadBytes(99999999);
446 soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
447 string soundAssetFileName
448 = ArchiveConstants.ASSETS_PATH + soundUuid
449 + ArchiveConstants.ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV];
450 tar.WriteFile(soundAssetFileName, soundData);
451 416
452 /* 417 UUID ownerId = TestHelpers.ParseTail(0xaaaa);
453 AssetBase soundAsset = AssetHelpers.CreateAsset(soundUuid, soundData);
454 scene.AssetService.Store(soundAsset);
455 asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav";
456 */
457 }
458 }
459 }
460 418
461 private void TestLoadedRegion(SceneObjectPart part1, string soundItemName, byte[] soundData) 419 MemoryStream archiveWriteStream = new MemoryStream();
462 { 420 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
463 SceneObjectPart object1PartLoaded = m_scene.GetSceneObjectPart(part1.Name);
464 421
465 Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded"); 422 tar.WriteFile(
466 Assert.That(object1PartLoaded.Name, Is.EqualTo(part1.Name), "object1 names not identical"); 423 ArchiveConstants.CONTROL_FILE_PATH,
467 Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal"); 424 new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup()));
468 Assert.That(
469 object1PartLoaded.RotationOffset, Is.EqualTo(part1.RotationOffset), "object1 rotation offset not equal");
470 Assert.That(
471 object1PartLoaded.OffsetPosition, Is.EqualTo(part1.OffsetPosition), "object1 offset position not equal");
472 Assert.That(object1PartLoaded.SitTargetOrientation, Is.EqualTo(part1.SitTargetOrientation));
473 Assert.That(object1PartLoaded.SitTargetPosition, Is.EqualTo(part1.SitTargetPosition));
474 425
475 TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItems(soundItemName)[0]; 426 SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ownerId, "obj1-", 0x11);
476 Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null"); 427 SceneObjectPart sop2
477 AssetBase loadedSoundAsset = m_scene.AssetService.Get(loadedSoundItem.AssetID.ToString()); 428 = SceneHelpers.CreateSceneObjectPart("obj1-Part2", TestHelpers.ParseTail(0x12), ownerId);
478 Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null"); 429 SceneObjectPart sop3
479 Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match"); 430 = SceneHelpers.CreateSceneObjectPart("obj1-Part3", TestHelpers.ParseTail(0x13), ownerId);
480 431
481 Assert.Greater(m_scene.LandChannel.AllParcels().Count, 0, "incorrect number of parcels"); 432 // Add the parts so they will be written out in reverse order to the oar
433 sog1.AddPart(sop3);
434 sop3.LinkNum = 3;
435 sog1.AddPart(sop2);
436 sop2.LinkNum = 2;
437
438 tar.WriteFile(
439 ArchiveConstants.CreateOarObjectPath(sog1.Name, sog1.UUID, sog1.AbsolutePosition),
440 SceneObjectSerializer.ToXml2Format(sog1));
441
442 tar.Close();
443
444 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
445
446 lock (this)
447 {
448 m_scene.EventManager.OnOarFileLoaded += LoadCompleted;
449 m_archiverModule.DearchiveRegion(archiveReadStream);
450 }
451
452 Assert.That(m_lastErrorMessage, Is.Null);
453
454 SceneObjectPart part2 = m_scene.GetSceneObjectPart("obj1-Part2");
455 Assert.That(part2.LinkNum, Is.EqualTo(2));
456
457 SceneObjectPart part3 = m_scene.GetSceneObjectPart("obj1-Part3");
458 Assert.That(part3.LinkNum, Is.EqualTo(3));
482 } 459 }
483 460
484 /// <summary> 461 /// <summary>
@@ -538,8 +515,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
538 SerialiserModule serialiserModule = new SerialiserModule(); 515 SerialiserModule serialiserModule = new SerialiserModule();
539 TerrainModule terrainModule = new TerrainModule(); 516 TerrainModule terrainModule = new TerrainModule();
540 517
541 m_sceneHelpers = new SceneHelpers(); 518 SceneHelpers m_sceneHelpers2 = new SceneHelpers();
542 TestScene scene2 = m_sceneHelpers.SetupScene(); 519 TestScene scene2 = m_sceneHelpers2.SetupScene();
543 SceneHelpers.SetupSceneModules(scene2, archiverModule, serialiserModule, terrainModule); 520 SceneHelpers.SetupSceneModules(scene2, archiverModule, serialiserModule, terrainModule);
544 521
545 // Make sure there's a valid owner for the owner we saved (this should have been wiped if the code is 522 // Make sure there's a valid owner for the owner we saved (this should have been wiped if the code is
@@ -563,6 +540,71 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
563 } 540 }
564 541
565 /// <summary> 542 /// <summary>
543 /// Test OAR loading where the land parcel is group deeded.
544 /// </summary>
545 /// <remarks>
546 /// In this situation, the owner ID is set to the group ID.
547 /// </remarks>
548 [Test]
549 public void TestLoadOarDeededLand()
550 {
551 TestHelpers.InMethod();
552// TestHelpers.EnableLogging();
553
554 UUID landID = TestHelpers.ParseTail(0x10);
555
556 MockGroupsServicesConnector groupsService = new MockGroupsServicesConnector();
557
558 IConfigSource configSource = new IniConfigSource();
559 IConfig config = configSource.AddConfig("Groups");
560 config.Set("Enabled", true);
561 config.Set("Module", "GroupsModule");
562 config.Set("DebugEnabled", true);
563 SceneHelpers.SetupSceneModules(
564 m_scene, configSource, new object[] { new GroupsModule(), groupsService, new LandManagementModule() });
565
566 // Create group in scene for loading
567 // FIXME: For now we'll put up with the issue that we'll get a group ID that varies across tests.
568 UUID groupID
569 = groupsService.CreateGroup(UUID.Zero, "group1", "", true, UUID.Zero, 3, true, true, true, UUID.Zero);
570
571 // Construct OAR
572 MemoryStream oarStream = new MemoryStream();
573 TarArchiveWriter tar = new TarArchiveWriter(oarStream);
574
575 tar.WriteDir(ArchiveConstants.LANDDATA_PATH);
576 tar.WriteFile(
577 ArchiveConstants.CONTROL_FILE_PATH,
578 new ArchiveWriteRequest(m_scene, (Stream)null, Guid.Empty).CreateControlFile(new ArchiveScenesGroup()));
579
580 LandObject lo = new LandObject(groupID, true, null);
581 lo.SetLandBitmap(lo.BasicFullRegionLandBitmap());
582 LandData ld = lo.LandData;
583 ld.GlobalID = landID;
584
585 string ldPath = ArchiveConstants.CreateOarLandDataPath(ld);
586 tar.WriteFile(ldPath, LandDataSerializer.Serialize(ld, null));
587 tar.Close();
588
589 oarStream = new MemoryStream(oarStream.ToArray());
590
591 // Load OAR
592 lock (this)
593 {
594 m_scene.EventManager.OnOarFileLoaded += LoadCompleted;
595 m_archiverModule.DearchiveRegion(oarStream);
596 }
597
598 ILandObject rLo = m_scene.LandChannel.GetLandObject(16, 16);
599 LandData rLd = rLo.LandData;
600
601 Assert.That(rLd.GlobalID, Is.EqualTo(landID));
602 Assert.That(rLd.OwnerID, Is.EqualTo(groupID));
603 Assert.That(rLd.GroupID, Is.EqualTo(groupID));
604 Assert.That(rLd.IsGroupOwned, Is.EqualTo(true));
605 }
606
607 /// <summary>
566 /// Test loading the region settings of an OpenSim Region Archive. 608 /// Test loading the region settings of an OpenSim Region Archive.
567 /// </summary> 609 /// </summary>
568 [Test] 610 [Test]
@@ -781,9 +823,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
781 } 823 }
782 } 824 }
783 825
784
785 // Save OAR 826 // Save OAR
786
787 MemoryStream archiveWriteStream = new MemoryStream(); 827 MemoryStream archiveWriteStream = new MemoryStream();
788 m_scene.EventManager.OnOarFileSaved += SaveCompleted; 828 m_scene.EventManager.OnOarFileSaved += SaveCompleted;
789 829
@@ -800,7 +840,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
800 840
801 841
802 // Check that the OAR contains the expected data 842 // Check that the OAR contains the expected data
803
804 Assert.That(m_lastRequestId, Is.EqualTo(requestId)); 843 Assert.That(m_lastRequestId, Is.EqualTo(requestId));
805 844
806 byte[] archive = archiveWriteStream.ToArray(); 845 byte[] archive = archiveWriteStream.ToArray();
@@ -892,7 +931,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
892 } 931 }
893 932
894 ArchiveScenesGroup scenesGroup = new ArchiveScenesGroup(); 933 ArchiveScenesGroup scenesGroup = new ArchiveScenesGroup();
895 SceneManager.Instance.ForEachScene(delegate(Scene scene) 934 m_sceneHelpers.SceneManager.ForEachScene(delegate(Scene scene)
896 { 935 {
897 scenesGroup.AddScene(scene); 936 scenesGroup.AddScene(scene);
898 }); 937 });
@@ -950,13 +989,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
950 989
951 // Delete the current objects, to test that they're loaded from the OAR and didn't 990 // Delete the current objects, to test that they're loaded from the OAR and didn't
952 // just remain in the scene. 991 // just remain in the scene.
953 SceneManager.Instance.ForEachScene(delegate(Scene scene) 992 m_sceneHelpers.SceneManager.ForEachScene(delegate(Scene scene)
954 { 993 {
955 scene.DeleteAllSceneObjects(); 994 scene.DeleteAllSceneObjects();
956 }); 995 });
957 996
958 // Create a "hole", to test that that the corresponding region isn't loaded from the OAR 997 // Create a "hole", to test that that the corresponding region isn't loaded from the OAR
959 SceneManager.Instance.CloseScene(SceneManager.Instance.Scenes[1]); 998 m_sceneHelpers.SceneManager.CloseScene(SceneManager.Instance.Scenes[1]);
960 999
961 1000
962 // Check thay the OAR file contains the expected data 1001 // Check thay the OAR file contains the expected data
@@ -971,10 +1010,32 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
971 1010
972 Assert.That(m_lastErrorMessage, Is.Null); 1011 Assert.That(m_lastErrorMessage, Is.Null);
973 1012
974 Assert.AreEqual(3, SceneManager.Instance.Scenes.Count); 1013 Assert.AreEqual(3, m_sceneHelpers.SceneManager.Scenes.Count);
975 1014
976 TestLoadedRegion(part1, soundItemName, soundData); 1015 TestLoadedRegion(part1, soundItemName, soundData);
977 } 1016 }
978 1017
1018 private void TestLoadedRegion(SceneObjectPart part1, string soundItemName, byte[] soundData)
1019 {
1020 SceneObjectPart object1PartLoaded = m_scene.GetSceneObjectPart(part1.Name);
1021
1022 Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded");
1023 Assert.That(object1PartLoaded.Name, Is.EqualTo(part1.Name), "object1 names not identical");
1024 Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal");
1025 Assert.That(
1026 object1PartLoaded.RotationOffset, Is.EqualTo(part1.RotationOffset), "object1 rotation offset not equal");
1027 Assert.That(
1028 object1PartLoaded.OffsetPosition, Is.EqualTo(part1.OffsetPosition), "object1 offset position not equal");
1029 Assert.That(object1PartLoaded.SitTargetOrientation, Is.EqualTo(part1.SitTargetOrientation));
1030 Assert.That(object1PartLoaded.SitTargetPosition, Is.EqualTo(part1.SitTargetPosition));
1031
1032 TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItems(soundItemName)[0];
1033 Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null");
1034 AssetBase loadedSoundAsset = m_scene.AssetService.Get(loadedSoundItem.AssetID.ToString());
1035 Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null");
1036 Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match");
1037
1038 Assert.Greater(m_scene.LandChannel.AllParcels().Count, 0, "incorrect number of parcels");
1039 }
979 } 1040 }
980} 1041} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs
index 5fa3dc2..d217f36 100644
--- a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs
+++ b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs
@@ -27,15 +27,17 @@
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;
33using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
35 36
36namespace OpenSim.Region.CoreModules 37namespace OpenSim.Region.CoreModules.World
37{ 38{
38 public class CloudModule : ICloudModule 39 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "CloudModule")]
40 public class CloudModule : ICloudModule, INonSharedRegionModule
39 { 41 {
40// private static readonly log4net.ILog m_log 42// private static readonly log4net.ILog m_log
41// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 43// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -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
@@ -59,21 +61,40 @@ namespace OpenSim.Region.CoreModules
59 m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000); 61 m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000);
60 } 62 }
61 63
62 if (m_enabled) 64 }
63 {
64 65
65 m_scene = scene; 66 public void AddRegion(Scene scene)
67 {
68 if (!m_enabled)
69 return;
66 70
67 scene.EventManager.OnNewClient += CloudsToClient; 71 m_scene = scene;
68 scene.RegisterModuleInterface<ICloudModule>(this);
69 scene.EventManager.OnFrame += CloudUpdate;
70 72
71 GenerateCloudCover(); 73 scene.EventManager.OnNewClient += CloudsToClient;
74 scene.RegisterModuleInterface<ICloudModule>(this);
75 scene.EventManager.OnFrame += CloudUpdate;
72 76
73 m_ready = true; 77 GenerateCloudCover();
74 78
75 } 79 m_ready = true;
80 }
81
82 public void RemoveRegion(Scene scene)
83 {
84 if (!m_enabled)
85 return;
76 86
87 m_ready = false;
88 // Remove our hooks
89 m_scene.EventManager.OnNewClient -= CloudsToClient;
90 m_scene.EventManager.OnFrame -= CloudUpdate;
91 m_scene.UnregisterModuleInterface<ICloudModule>(this);
92
93 m_scene = null;
94 }
95
96 public void RegionLoaded(Scene scene)
97 {
77 } 98 }
78 99
79 public void PostInitialise() 100 public void PostInitialise()
@@ -82,13 +103,6 @@ namespace OpenSim.Region.CoreModules
82 103
83 public void Close() 104 public void Close()
84 { 105 {
85 if (m_enabled)
86 {
87 m_ready = false;
88 // Remove our hooks
89 m_scene.EventManager.OnNewClient -= CloudsToClient;
90 m_scene.EventManager.OnFrame -= CloudUpdate;
91 }
92 } 106 }
93 107
94 public string Name 108 public string Name
@@ -96,12 +110,11 @@ namespace OpenSim.Region.CoreModules
96 get { return "CloudModule"; } 110 get { return "CloudModule"; }
97 } 111 }
98 112
99 public bool IsSharedModule 113 public Type ReplaceableInterface
100 { 114 {
101 get { return false; } 115 get { return null; }
102 } 116 }
103 117
104
105 public float CloudCover(int x, int y, int z) 118 public float CloudCover(int x, int y, int z)
106 { 119 {
107 float cover = 0f; 120 float cover = 0f;
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 0e6d663..eb06fcc 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -53,6 +53,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
53 53
54 protected EstateManagementCommands m_commands; 54 protected EstateManagementCommands m_commands;
55 55
56 /// <summary>
57 /// If false, region restart requests from the client are blocked even if they are otherwise legitimate.
58 /// </summary>
59 public bool AllowRegionRestartFromClient { get; set; }
60
56 private EstateTerrainXferHandler TerrainUploader; 61 private EstateTerrainXferHandler TerrainUploader;
57 public TelehubManager m_Telehub; 62 public TelehubManager m_Telehub;
58 63
@@ -60,6 +65,53 @@ namespace OpenSim.Region.CoreModules.World.Estate
60 public event ChangeDelegate OnEstateInfoChange; 65 public event ChangeDelegate OnEstateInfoChange;
61 public event MessageDelegate OnEstateMessage; 66 public event MessageDelegate OnEstateMessage;
62 67
68 #region Region Module interface
69
70 public string Name { get { return "EstateManagementModule"; } }
71
72 public Type ReplaceableInterface { get { return null; } }
73
74 public void Initialise(IConfigSource source)
75 {
76 AllowRegionRestartFromClient = true;
77
78 IConfig config = source.Configs["EstateManagement"];
79
80 if (config != null)
81 AllowRegionRestartFromClient = config.GetBoolean("AllowRegionRestartFromClient", true);
82 }
83
84 public void AddRegion(Scene scene)
85 {
86 Scene = scene;
87 Scene.RegisterModuleInterface<IEstateModule>(this);
88 Scene.EventManager.OnNewClient += EventManager_OnNewClient;
89 Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight;
90
91 m_Telehub = new TelehubManager(scene);
92
93 m_commands = new EstateManagementCommands(this);
94 m_commands.Initialise();
95 }
96
97 public void RemoveRegion(Scene scene) {}
98
99 public void RegionLoaded(Scene scene)
100 {
101 // Sets up the sun module based no the saved Estate and Region Settings
102 // DO NOT REMOVE or the sun will stop working
103 scene.TriggerEstateSunUpdate();
104
105 UserManager = scene.RequestModuleInterface<IUserManagement>();
106 }
107
108 public void Close()
109 {
110 m_commands.Close();
111 }
112
113 #endregion
114
63 #region Packet Data Responders 115 #region Packet Data Responders
64 116
65 private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) 117 private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice)
@@ -184,6 +236,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
184 Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture; 236 Scene.RegionInfo.RegionSettings.TerrainTexture4 = texture;
185 break; 237 break;
186 } 238 }
239
187 Scene.RegionInfo.RegionSettings.Save(); 240 Scene.RegionInfo.RegionSettings.Save();
188 TriggerRegionInfoChange(); 241 TriggerRegionInfoChange();
189 sendRegionInfoPacketToAll(); 242 sendRegionInfoPacketToAll();
@@ -215,6 +268,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
215 Scene.RegionInfo.RegionSettings.Elevation2NE = highValue; 268 Scene.RegionInfo.RegionSettings.Elevation2NE = highValue;
216 break; 269 break;
217 } 270 }
271
218 Scene.RegionInfo.RegionSettings.Save(); 272 Scene.RegionInfo.RegionSettings.Save();
219 TriggerRegionInfoChange(); 273 TriggerRegionInfoChange();
220 sendRegionHandshakeToAll(); 274 sendRegionHandshakeToAll();
@@ -255,6 +309,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
255 309
256 private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) 310 private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds)
257 { 311 {
312 if (!AllowRegionRestartFromClient)
313 {
314 remoteClient.SendAlertMessage("Region restart has been disabled on this simulator.");
315 return;
316 }
317
258 IRestartModule restartModule = Scene.RequestModuleInterface<IRestartModule>(); 318 IRestartModule restartModule = Scene.RequestModuleInterface<IRestartModule>();
259 if (restartModule != null) 319 if (restartModule != null)
260 { 320 {
@@ -271,6 +331,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
271 } 331 }
272 332
273 restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true); 333 restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true);
334
335 m_log.InfoFormat(
336 "User {0} requested restart of region {1} in {2} seconds",
337 remoteClient.Name, Scene.Name, times.Count != 0 ? times[0] : 0);
274 } 338 }
275 } 339 }
276 340
@@ -295,7 +359,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
295 359
296 if ((estateAccessType & 4) != 0) // User add 360 if ((estateAccessType & 4) != 0) // User add
297 { 361 {
298 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) 362 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
299 { 363 {
300 if ((estateAccessType & 1) != 0) // All estates 364 if ((estateAccessType & 1) != 0) // All estates
301 { 365 {
@@ -325,9 +389,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
325 } 389 }
326 390
327 } 391 }
392
328 if ((estateAccessType & 8) != 0) // User remove 393 if ((estateAccessType & 8) != 0) // User remove
329 { 394 {
330 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) 395 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
331 { 396 {
332 if ((estateAccessType & 1) != 0) // All estates 397 if ((estateAccessType & 1) != 0) // All estates
333 { 398 {
@@ -356,9 +421,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
356 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); 421 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
357 } 422 }
358 } 423 }
424
359 if ((estateAccessType & 16) != 0) // Group add 425 if ((estateAccessType & 16) != 0) // Group add
360 { 426 {
361 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) 427 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
362 { 428 {
363 if ((estateAccessType & 1) != 0) // All estates 429 if ((estateAccessType & 1) != 0) // All estates
364 { 430 {
@@ -387,9 +453,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
387 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); 453 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
388 } 454 }
389 } 455 }
456
390 if ((estateAccessType & 32) != 0) // Group remove 457 if ((estateAccessType & 32) != 0) // Group remove
391 { 458 {
392 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) 459 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
393 { 460 {
394 if ((estateAccessType & 1) != 0) // All estates 461 if ((estateAccessType & 1) != 0) // All estates
395 { 462 {
@@ -418,9 +485,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
418 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); 485 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
419 } 486 }
420 } 487 }
488
421 if ((estateAccessType & 64) != 0) // Ban add 489 if ((estateAccessType & 64) != 0) // Ban add
422 { 490 {
423 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || Scene.Permissions.BypassPermissions()) 491 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false))
424 { 492 {
425 EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans; 493 EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans;
426 494
@@ -495,9 +563,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
495 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); 563 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
496 } 564 }
497 } 565 }
566
498 if ((estateAccessType & 128) != 0) // Ban remove 567 if ((estateAccessType & 128) != 0) // Ban remove
499 { 568 {
500 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false) || Scene.Permissions.BypassPermissions()) 569 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, false))
501 { 570 {
502 EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans; 571 EstateBan[] banlistcheck = Scene.RegionInfo.EstateSettings.EstateBans;
503 572
@@ -550,9 +619,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
550 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); 619 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
551 } 620 }
552 } 621 }
622
553 if ((estateAccessType & 256) != 0) // Manager add 623 if ((estateAccessType & 256) != 0) // Manager add
554 { 624 {
555 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) 625 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
556 { 626 {
557 if ((estateAccessType & 1) != 0) // All estates 627 if ((estateAccessType & 1) != 0) // All estates
558 { 628 {
@@ -581,9 +651,10 @@ namespace OpenSim.Region.CoreModules.World.Estate
581 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions"); 651 remote_client.SendAlertMessage("Method EstateAccessDelta Failed, you don't have permissions");
582 } 652 }
583 } 653 }
654
584 if ((estateAccessType & 512) != 0) // Manager remove 655 if ((estateAccessType & 512) != 0) // Manager remove
585 { 656 {
586 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true) || Scene.Permissions.BypassPermissions()) 657 if (Scene.Permissions.CanIssueEstateCommand(remote_client.AgentId, true))
587 { 658 {
588 if ((estateAccessType & 1) != 0) // All estates 659 if ((estateAccessType & 1) != 0) // All estates
589 { 660 {
@@ -614,7 +685,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
614 } 685 }
615 } 686 }
616 687
617 public void handleOnEstateManageTelehub (IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) 688 public void handleOnEstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1)
618 { 689 {
619 SceneObjectPart part; 690 SceneObjectPart part;
620 691
@@ -1072,45 +1143,6 @@ namespace OpenSim.Region.CoreModules.World.Estate
1072 1143
1073 #endregion 1144 #endregion
1074 1145
1075 #region IRegionModule Members
1076
1077 public string Name { get { return "EstateManagementModule"; } }
1078
1079 public Type ReplaceableInterface { get { return null; } }
1080
1081 public void Initialise(IConfigSource source) {}
1082
1083 public void AddRegion(Scene scene)
1084 {
1085 Scene = scene;
1086 Scene.RegisterModuleInterface<IEstateModule>(this);
1087 Scene.EventManager.OnNewClient += EventManager_OnNewClient;
1088 Scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight;
1089
1090 m_Telehub = new TelehubManager(scene);
1091
1092 m_commands = new EstateManagementCommands(this);
1093 m_commands.Initialise();
1094 }
1095
1096 public void RemoveRegion(Scene scene) {}
1097
1098 public void RegionLoaded(Scene scene)
1099 {
1100 // Sets up the sun module based no the saved Estate and Region Settings
1101 // DO NOT REMOVE or the sun will stop working
1102 scene.TriggerEstateSunUpdate();
1103
1104 UserManager = scene.RequestModuleInterface<IUserManagement>();
1105 }
1106
1107 public void Close()
1108 {
1109 m_commands.Close();
1110 }
1111
1112 #endregion
1113
1114 #region Other Functions 1146 #region Other Functions
1115 1147
1116 public void changeWaterHeight(float height) 1148 public void changeWaterHeight(float height)
diff --git a/OpenSim/Region/CoreModules/World/Land/DwellModule.cs b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs
new file mode 100644
index 0000000..bd22155
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Land/DwellModule.cs
@@ -0,0 +1,112 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
26 */
27
28using System;
29using System.Collections;
30using System.Collections.Generic;
31using System.Diagnostics;
32using System.Reflection;
33using System.Text;
34using log4net;
35using Nini.Config;
36using OpenMetaverse;
37using OpenMetaverse.StructuredData;
38using OpenMetaverse.Messages.Linden;
39using Mono.Addins;
40using OpenSim.Framework;
41using OpenSim.Framework.Capabilities;
42using OpenSim.Framework.Console;
43using OpenSim.Framework.Servers;
44using OpenSim.Framework.Servers.HttpServer;
45using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
46using OpenSim.Region.Framework.Interfaces;
47using OpenSim.Region.Framework.Scenes;
48using OpenSim.Region.Physics.Manager;
49using OpenSim.Services.Interfaces;
50using Caps = OpenSim.Framework.Capabilities.Caps;
51using GridRegion = OpenSim.Services.Interfaces.GridRegion;
52
53namespace OpenSim.Region.CoreModules.World.Land
54{
55 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "DwellModule")]
56 public class DwellModule : IDwellModule, INonSharedRegionModule
57 {
58 private Scene m_scene;
59
60 public Type ReplaceableInterface
61 {
62 get { return typeof(IDwellModule); }
63 }
64
65 public string Name
66 {
67 get { return "DwellModule"; }
68 }
69
70 public void Initialise(IConfigSource source)
71 {
72 }
73
74 public void AddRegion(Scene scene)
75 {
76 m_scene = scene;
77
78 m_scene.EventManager.OnNewClient += OnNewClient;
79 }
80
81 public void RegionLoaded(Scene scene)
82 {
83 }
84
85 public void RemoveRegion(Scene scene)
86 {
87 }
88
89 public void Close()
90 {
91 }
92
93 public void OnNewClient(IClientAPI client)
94 {
95 client.OnParcelDwellRequest += ClientOnParcelDwellRequest;
96 }
97
98 private void ClientOnParcelDwellRequest(int localID, IClientAPI client)
99 {
100 ILandObject parcel = m_scene.LandChannel.GetLandObject(localID);
101 if (parcel == null)
102 return;
103
104 client.SendParcelDwellReply(localID, parcel.LandData.GlobalID, parcel.LandData.Dwell);
105 }
106
107 public int GetDwell(UUID parcelID)
108 {
109 return 0;
110 }
111 }
112}
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
index 95edf62..7149aad 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
@@ -36,6 +36,7 @@ using Nini.Config;
36using OpenMetaverse; 36using OpenMetaverse;
37using OpenMetaverse.StructuredData; 37using OpenMetaverse.StructuredData;
38using OpenMetaverse.Messages.Linden; 38using OpenMetaverse.Messages.Linden;
39using Mono.Addins;
39using OpenSim.Framework; 40using OpenSim.Framework;
40using OpenSim.Framework.Capabilities; 41using OpenSim.Framework.Capabilities;
41using OpenSim.Framework.Console; 42using OpenSim.Framework.Console;
@@ -60,6 +61,7 @@ namespace OpenSim.Region.CoreModules.World.Land
60 public byte RegionAccess; 61 public byte RegionAccess;
61 } 62 }
62 63
64 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LandManagementModule")]
63 public class LandManagementModule : INonSharedRegionModule 65 public class LandManagementModule : INonSharedRegionModule
64 { 66 {
65 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 67 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -207,7 +209,6 @@ namespace OpenSim.Region.CoreModules.World.Land
207 client.OnParcelInfoRequest += ClientOnParcelInfoRequest; 209 client.OnParcelInfoRequest += ClientOnParcelInfoRequest;
208 client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup; 210 client.OnParcelDeedToGroup += ClientOnParcelDeedToGroup;
209 client.OnPreAgentUpdate += ClientOnPreAgentUpdate; 211 client.OnPreAgentUpdate += ClientOnPreAgentUpdate;
210 client.OnParcelDwellRequest += ClientOnParcelDwellRequest;
211 212
212 EntityBase presenceEntity; 213 EntityBase presenceEntity;
213 if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence) 214 if (m_scene.Entities.TryGetValue(client.AgentId, out presenceEntity) && presenceEntity is ScenePresence)
@@ -799,17 +800,6 @@ namespace OpenSim.Region.CoreModules.World.Land
799 } 800 }
800 } 801 }
801 802
802 private void ClientOnParcelDwellRequest(int localID, IClientAPI client)
803 {
804 ILandObject parcel = null;
805 lock (m_landList)
806 {
807 if (!m_landList.TryGetValue(localID, out parcel))
808 return;
809 }
810 client.SendParcelDwellReply(localID, parcel.LandData.GlobalID, parcel.LandData.Dwell);
811 }
812
813 #endregion 803 #endregion
814 804
815 #region Parcel Modification 805 #region Parcel Modification
@@ -962,6 +952,7 @@ namespace OpenSim.Region.CoreModules.World.Land
962 ILandObject newLand = startLandObject.Copy(); 952 ILandObject newLand = startLandObject.Copy();
963 newLand.LandData.Name = newLand.LandData.Name; 953 newLand.LandData.Name = newLand.LandData.Name;
964 newLand.LandData.GlobalID = UUID.Random(); 954 newLand.LandData.GlobalID = UUID.Random();
955 newLand.LandData.Dwell = 0;
965 956
966 newLand.SetLandBitmap(newLand.GetSquareLandBitmap(start_x, start_y, end_x, end_y)); 957 newLand.SetLandBitmap(newLand.GetSquareLandBitmap(start_x, start_y, end_x, end_y));
967 958
@@ -1387,10 +1378,11 @@ namespace OpenSim.Region.CoreModules.World.Land
1387 1378
1388 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) 1379 public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data)
1389 { 1380 {
1381// m_log.DebugFormat(
1382// "[LAND MANAGMENT MODULE]: Processing {0} incoming parcels on {1}", data.Count, m_scene.Name);
1383
1390 for (int i = 0; i < data.Count; i++) 1384 for (int i = 0; i < data.Count; i++)
1391 {
1392 IncomingLandObjectFromStorage(data[i]); 1385 IncomingLandObjectFromStorage(data[i]);
1393 }
1394 } 1386 }
1395 1387
1396 public void IncomingLandObjectFromStorage(LandData data) 1388 public void IncomingLandObjectFromStorage(LandData data)
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 8829f27..5969d45 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -727,9 +727,10 @@ namespace OpenSim.Region.CoreModules.World.Land
727 int ty = min_y * 4; 727 int ty = min_y * 4;
728 if (ty > ((int)Constants.RegionSize - 1)) 728 if (ty > ((int)Constants.RegionSize - 1))
729 ty = ((int)Constants.RegionSize - 1); 729 ty = ((int)Constants.RegionSize - 1);
730
730 LandData.AABBMin = 731 LandData.AABBMin =
731 new Vector3((float) (min_x * 4), (float) (min_y * 4), 732 new Vector3(
732 (float) m_scene.Heightmap[tx, ty]); 733 (float)(min_x * 4), (float)(min_y * 4), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0);
733 734
734 tx = max_x * 4; 735 tx = max_x * 4;
735 if (tx > ((int)Constants.RegionSize - 1)) 736 if (tx > ((int)Constants.RegionSize - 1))
@@ -737,9 +738,11 @@ namespace OpenSim.Region.CoreModules.World.Land
737 ty = max_y * 4; 738 ty = max_y * 4;
738 if (ty > ((int)Constants.RegionSize - 1)) 739 if (ty > ((int)Constants.RegionSize - 1))
739 ty = ((int)Constants.RegionSize - 1); 740 ty = ((int)Constants.RegionSize - 1);
740 LandData.AABBMax = 741
741 new Vector3((float) (max_x * 4), (float) (max_y * 4), 742 LandData.AABBMax
742 (float) m_scene.Heightmap[tx, ty]); 743 = new Vector3(
744 (float)(max_x * 4), (float)(max_y * 4), m_scene != null ? (float)m_scene.Heightmap[tx, ty] : 0);
745
743 LandData.Area = tempArea; 746 LandData.Area = tempArea;
744 } 747 }
745 748
diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
index 665875f..f9cc0cf 100644
--- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
+++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs
@@ -34,6 +34,7 @@ using log4net;
34using Nini.Config; 34using Nini.Config;
35using OpenMetaverse; 35using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37using Mono.Addins;
37using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
39using OpenSim.Services.Interfaces; 40using OpenSim.Services.Interfaces;
@@ -49,6 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Land
49 public Dictionary <UUID, int> Users = new Dictionary <UUID, int>(); 50 public Dictionary <UUID, int> Users = new Dictionary <UUID, int>();
50 } 51 }
51 52
53 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PrimCountModule")]
52 public class PrimCountModule : IPrimCountModule, INonSharedRegionModule 54 public class PrimCountModule : IPrimCountModule, INonSharedRegionModule
53 { 55 {
54// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 56// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
diff --git a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
index b5ee4d2..14eca42 100644
--- a/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
+++ b/OpenSim/Region/CoreModules/World/Land/Tests/PrimCountModuleTests.cs
@@ -41,7 +41,7 @@ using OpenSim.Tests.Common.Mock;
41namespace OpenSim.Region.CoreModules.World.Land.Tests 41namespace OpenSim.Region.CoreModules.World.Land.Tests
42{ 42{
43 [TestFixture] 43 [TestFixture]
44 public class PrimCountModuleTests 44 public class PrimCountModuleTests : OpenSimTestCase
45 { 45 {
46 protected UUID m_userId = new UUID("00000000-0000-0000-0000-100000000000"); 46 protected UUID m_userId = new UUID("00000000-0000-0000-0000-100000000000");
47 protected UUID m_groupId = new UUID("00000000-0000-0000-8888-000000000000"); 47 protected UUID m_groupId = new UUID("00000000-0000-0000-8888-000000000000");
diff --git a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
index aa306c7..8a422b0 100644
--- a/OpenSim/Region/CoreModules/World/LegacyMap/MapImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/LegacyMap/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,6 +60,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
59 public face[] trns; 60 public face[] trns;
60 } 61 }
61 62
63 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapImageModule")]
62 public class MapImageModule : IMapImageGenerator, INonSharedRegionModule 64 public class MapImageModule : IMapImageGenerator, INonSharedRegionModule
63 { 65 {
64 private static readonly ILog m_log = 66 private static readonly ILog m_log =
@@ -131,7 +133,7 @@ namespace OpenSim.Region.CoreModules.World.LegacyMap
131 133
132 #endregion 134 #endregion
133 135
134 #region IRegionModule Members 136 #region Region Module interface
135 137
136 public void Initialise(IConfigSource source) 138 public void Initialise(IConfigSource source)
137 { 139 {
diff --git a/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs b/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs
new file mode 100644
index 0000000..c3cea7a
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/LightShare/EnvironmentModule.cs
@@ -0,0 +1,224 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
26 */
27
28using System;
29using System.Reflection;
30using OpenMetaverse;
31using OpenSim.Framework;
32using OpenSim.Framework.Capabilities;
33using OpenSim.Framework.Servers.HttpServer;
34using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes;
36using log4net;
37using Nini.Config;
38using Mono.Addins;
39
40using Caps = OpenSim.Framework.Capabilities.Caps;
41
42
43namespace OpenSim.Region.CoreModules.World.LightShare
44{
45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EnvironmentModule")]
46
47 public class EnvironmentModule : INonSharedRegionModule, IEnvironmentModule
48 {
49 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
50
51 private Scene m_scene = null;
52 private UUID regionID = UUID.Zero;
53 private static bool Enabled = false;
54
55 private static readonly string capsName = "EnvironmentSettings";
56 private static readonly string capsBase = "/CAPS/0020/";
57
58 private LLSDEnvironmentSetResponse setResponse = null;
59
60 #region INonSharedRegionModule
61 public void Initialise(IConfigSource source)
62 {
63 IConfig config = source.Configs["ClientStack.LindenCaps"];
64
65 if (null == config)
66 return;
67
68 if (config.GetString("Cap_EnvironmentSettings", String.Empty) != "localhost")
69 {
70 m_log.InfoFormat("[{0}]: Module is disabled.", Name);
71 return;
72 }
73
74 Enabled = true;
75
76 m_log.InfoFormat("[{0}]: Module is enabled.", Name);
77 }
78
79 public void Close()
80 {
81 }
82
83 public string Name
84 {
85 get { return "EnvironmentModule"; }
86 }
87
88 public Type ReplaceableInterface
89 {
90 get { return null; }
91 }
92
93 public void AddRegion(Scene scene)
94 {
95 if (!Enabled)
96 return;
97
98 scene.RegisterModuleInterface<IEnvironmentModule>(this);
99 m_scene = scene;
100 regionID = scene.RegionInfo.RegionID;
101 }
102
103 public void RegionLoaded(Scene scene)
104 {
105 if (!Enabled)
106 return;
107
108 setResponse = new LLSDEnvironmentSetResponse();
109 scene.EventManager.OnRegisterCaps += OnRegisterCaps;
110 }
111
112 public void RemoveRegion(Scene scene)
113 {
114 if (Enabled)
115 return;
116
117 scene.EventManager.OnRegisterCaps -= OnRegisterCaps;
118 m_scene = null;
119 }
120 #endregion
121
122 #region IEnvironmentModule
123 public void ResetEnvironmentSettings(UUID regionUUID)
124 {
125 if (!Enabled)
126 return;
127
128 m_scene.SimulationDataService.RemoveRegionEnvironmentSettings(regionUUID);
129 }
130 #endregion
131
132 #region Events
133 private void OnRegisterCaps(UUID agentID, Caps caps)
134 {
135 // m_log.DebugFormat("[{0}]: Register capability for agentID {1} in region {2}",
136 // Name, agentID, caps.RegionName);
137
138 string capsPath = capsBase + UUID.Random();
139
140 // Get handler
141 caps.RegisterHandler(
142 capsName,
143 new RestStreamHandler(
144 "GET",
145 capsPath,
146 (request, path, param, httpRequest, httpResponse)
147 => GetEnvironmentSettings(request, path, param, agentID, caps),
148 capsName,
149 agentID.ToString()));
150
151 // Set handler
152 caps.HttpListener.AddStreamHandler(
153 new RestStreamHandler(
154 "POST",
155 capsPath,
156 (request, path, param, httpRequest, httpResponse)
157 => SetEnvironmentSettings(request, path, param, agentID, caps),
158 capsName,
159 agentID.ToString()));
160 }
161 #endregion
162
163 private string GetEnvironmentSettings(string request, string path, string param,
164 UUID agentID, Caps caps)
165 {
166 // m_log.DebugFormat("[{0}]: Environment GET handle for agentID {1} in region {2}",
167 // Name, agentID, caps.RegionName);
168
169 string env = String.Empty;
170
171 try
172 {
173 env = m_scene.SimulationDataService.LoadRegionEnvironmentSettings(regionID);
174 }
175 catch (Exception e)
176 {
177 m_log.ErrorFormat("[{0}]: Unable to load environment settings for region {1}, Exception: {2} - {3}",
178 Name, caps.RegionName, e.Message, e.StackTrace);
179 }
180
181 if (String.IsNullOrEmpty(env))
182 env = EnvironmentSettings.EmptySettings(UUID.Zero, regionID);
183
184 return env;
185 }
186
187 private string SetEnvironmentSettings(string request, string path, string param,
188 UUID agentID, Caps caps)
189 {
190
191 // m_log.DebugFormat("[{0}]: Environment SET handle from agentID {1} in region {2}",
192 // Name, agentID, caps.RegionName);
193
194 setResponse.regionID = regionID;
195 setResponse.success = false;
196
197 if (!m_scene.Permissions.CanIssueEstateCommand(agentID, false))
198 {
199 setResponse.fail_reason = "Insufficient estate permissions, settings has not been saved.";
200 return LLSDHelpers.SerialiseLLSDReply(setResponse);
201 }
202
203 try
204 {
205 m_scene.SimulationDataService.StoreRegionEnvironmentSettings(regionID, request);
206 setResponse.success = true;
207
208 m_log.InfoFormat("[{0}]: New Environment settings has been saved from agentID {1} in region {2}",
209 Name, agentID, caps.RegionName);
210 }
211 catch (Exception e)
212 {
213 m_log.ErrorFormat("[{0}]: Environment settings has not been saved for region {1}, Exception: {2} - {3}",
214 Name, caps.RegionName, e.Message, e.StackTrace);
215
216 setResponse.success = false;
217 setResponse.fail_reason = String.Format("Environment Set for region {0} has failed, settings has not been saved.", caps.RegionName);
218 }
219
220 return LLSDHelpers.SerialiseLLSDReply(setResponse);
221 }
222 }
223}
224
diff --git a/OpenSim/Region/CoreModules/World/LightShare/LightShareModule.cs b/OpenSim/Region/CoreModules/World/LightShare/LightShareModule.cs
new file mode 100644
index 0000000..4e20196
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/LightShare/LightShareModule.cs
@@ -0,0 +1,297 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.Reflection;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
34using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes;
36using log4net;
37using Nini.Config;
38using Mono.Addins;
39
40namespace OpenSim.Region.CoreModules.World.LightShare
41{
42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LightShareModule")]
43 public class LightShareModule : INonSharedRegionModule, ILightShareModule, ICommandableModule
44 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
46 private readonly Commander m_commander = new Commander("windlight");
47 private Scene m_scene;
48 private static bool m_enableWindlight;
49
50 #region ICommandableModule Members
51
52 public ICommander CommandInterface
53 {
54 get { return m_commander; }
55 }
56
57 #endregion
58
59 #region INonSharedRegionModule Members
60
61 public void Initialise(IConfigSource config)
62 {
63 try
64 {
65 m_enableWindlight = config.Configs["LightShare"].GetBoolean("enable_windlight", false);
66 }
67 catch (Exception)
68 {
69 m_log.Debug("[WINDLIGHT]: ini failure for enable_windlight - using default");
70 }
71
72 m_log.DebugFormat("[WINDLIGHT]: windlight module {0}", (m_enableWindlight ? "enabled" : "disabled"));
73 }
74
75 public void AddRegion(Scene scene)
76 {
77 if (!m_enableWindlight)
78 return;
79
80 m_scene = scene;
81 m_scene.RegisterModuleInterface<ILightShareModule>(this);
82 m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole;
83
84 m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent;
85 m_scene.EventManager.OnSaveNewWindlightProfile += EventManager_OnSaveNewWindlightProfile;
86 m_scene.EventManager.OnSendNewWindlightProfileTargeted += EventManager_OnSendNewWindlightProfileTargeted;
87 m_scene.LoadWindlightProfile();
88
89 InstallCommands();
90 }
91
92 public void RemoveRegion(Scene scene)
93 {
94 if (!m_enableWindlight)
95 return;
96
97 m_scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole;
98
99 m_scene.EventManager.OnMakeRootAgent -= EventManager_OnMakeRootAgent;
100 m_scene.EventManager.OnSaveNewWindlightProfile -= EventManager_OnSaveNewWindlightProfile;
101 m_scene.EventManager.OnSendNewWindlightProfileTargeted -= EventManager_OnSendNewWindlightProfileTargeted;
102
103 m_scene = null;
104 }
105
106 public void Close()
107 {
108 }
109
110 public string Name
111 {
112 get { return "LightShareModule"; }
113 }
114
115 public void RegionLoaded(Scene scene)
116 {
117 }
118
119 public Type ReplaceableInterface
120 {
121 get { return null; }
122 }
123
124 #endregion
125
126 public static bool EnableWindlight
127 {
128 get
129 {
130 return m_enableWindlight;
131 }
132 set
133 {
134 }
135 }
136
137 #region events
138
139 private List<byte[]> compileWindlightSettings(RegionLightShareData wl)
140 {
141 byte[] mBlock = new Byte[249];
142 int pos = 0;
143
144 wl.waterColor.ToBytes(mBlock, 0); pos += 12;
145 Utils.FloatToBytes(wl.waterFogDensityExponent).CopyTo(mBlock, pos); pos += 4;
146 Utils.FloatToBytes(wl.underwaterFogModifier).CopyTo(mBlock, pos); pos += 4;
147 wl.reflectionWaveletScale.ToBytes(mBlock, pos); pos += 12;
148 Utils.FloatToBytes(wl.fresnelScale).CopyTo(mBlock, pos); pos += 4;
149 Utils.FloatToBytes(wl.fresnelOffset).CopyTo(mBlock, pos); pos += 4;
150 Utils.FloatToBytes(wl.refractScaleAbove).CopyTo(mBlock, pos); pos += 4;
151 Utils.FloatToBytes(wl.refractScaleBelow).CopyTo(mBlock, pos); pos += 4;
152 Utils.FloatToBytes(wl.blurMultiplier).CopyTo(mBlock, pos); pos += 4;
153 wl.bigWaveDirection.ToBytes(mBlock, pos); pos += 8;
154 wl.littleWaveDirection.ToBytes(mBlock, pos); pos += 8;
155 wl.normalMapTexture.ToBytes(mBlock, pos); pos += 16;
156 wl.horizon.ToBytes(mBlock, pos); pos += 16;
157 Utils.FloatToBytes(wl.hazeHorizon).CopyTo(mBlock, pos); pos += 4;
158 wl.blueDensity.ToBytes(mBlock, pos); pos += 16;
159 Utils.FloatToBytes(wl.hazeDensity).CopyTo(mBlock, pos); pos += 4;
160 Utils.FloatToBytes(wl.densityMultiplier).CopyTo(mBlock, pos); pos += 4;
161 Utils.FloatToBytes(wl.distanceMultiplier).CopyTo(mBlock, pos); pos += 4;
162 wl.sunMoonColor.ToBytes(mBlock, pos); pos += 16;
163 Utils.FloatToBytes(wl.sunMoonPosition).CopyTo(mBlock, pos); pos += 4;
164 wl.ambient.ToBytes(mBlock, pos); pos += 16;
165 Utils.FloatToBytes(wl.eastAngle).CopyTo(mBlock, pos); pos += 4;
166 Utils.FloatToBytes(wl.sunGlowFocus).CopyTo(mBlock, pos); pos += 4;
167 Utils.FloatToBytes(wl.sunGlowSize).CopyTo(mBlock, pos); pos += 4;
168 Utils.FloatToBytes(wl.sceneGamma).CopyTo(mBlock, pos); pos += 4;
169 Utils.FloatToBytes(wl.starBrightness).CopyTo(mBlock, pos); pos += 4;
170 wl.cloudColor.ToBytes(mBlock, pos); pos += 16;
171 wl.cloudXYDensity.ToBytes(mBlock, pos); pos += 12;
172 Utils.FloatToBytes(wl.cloudCoverage).CopyTo(mBlock, pos); pos += 4;
173 Utils.FloatToBytes(wl.cloudScale).CopyTo(mBlock, pos); pos += 4;
174 wl.cloudDetailXYDensity.ToBytes(mBlock, pos); pos += 12;
175 Utils.FloatToBytes(wl.cloudScrollX).CopyTo(mBlock, pos); pos += 4;
176 Utils.FloatToBytes(wl.cloudScrollY).CopyTo(mBlock, pos); pos += 4;
177 Utils.UInt16ToBytes(wl.maxAltitude).CopyTo(mBlock, pos); pos += 2;
178 mBlock[pos] = Convert.ToByte(wl.cloudScrollXLock); pos++;
179 mBlock[pos] = Convert.ToByte(wl.cloudScrollYLock); pos++;
180 mBlock[pos] = Convert.ToByte(wl.drawClassicClouds); pos++;
181 List<byte[]> param = new List<byte[]>();
182 param.Add(mBlock);
183 return param;
184 }
185
186 public void SendProfileToClient(IClientAPI client)
187 {
188 SendProfileToClient(client, m_scene.RegionInfo.WindlightSettings);
189 }
190
191 public void SendProfileToClient(IClientAPI client, RegionLightShareData wl)
192 {
193 if (m_enableWindlight)
194 {
195 if (m_scene.RegionInfo.WindlightSettings.valid)
196 {
197 List<byte[]> param = compileWindlightSettings(wl);
198 client.SendGenericMessage("Windlight", param);
199 }
200 else
201 {
202 List<byte[]> param = new List<byte[]>();
203 client.SendGenericMessage("WindlightReset", param);
204 }
205 }
206 }
207
208 private void EventManager_OnMakeRootAgent(ScenePresence presence)
209 {
210 m_log.Debug("[WINDLIGHT]: Sending windlight scene to new client");
211 SendProfileToClient(presence.ControllingClient);
212 }
213
214 private void EventManager_OnSendNewWindlightProfileTargeted(RegionLightShareData wl, UUID pUUID)
215 {
216 IClientAPI client;
217 m_scene.TryGetClient(pUUID, out client);
218 SendProfileToClient(client, wl);
219 }
220
221 private void EventManager_OnSaveNewWindlightProfile()
222 {
223 m_scene.ForEachRootClient(SendProfileToClient);
224 }
225
226 #endregion
227
228 #region ICommandableModule Members
229
230 private void InstallCommands()
231 {
232 Command wlload = new Command("load", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleLoad, "Load windlight profile from the database and broadcast");
233 Command wlenable = new Command("enable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleEnable, "Enable the windlight plugin");
234 Command wldisable = new Command("disable", CommandIntentions.COMMAND_NON_HAZARDOUS, HandleDisable, "Disable the windlight plugin");
235
236 m_commander.RegisterCommand("load", wlload);
237 m_commander.RegisterCommand("enable", wlenable);
238 m_commander.RegisterCommand("disable", wldisable);
239
240 m_scene.RegisterModuleCommander(m_commander);
241 }
242
243 private void HandleLoad(Object[] args)
244 {
245 if (!m_enableWindlight)
246 {
247 m_log.InfoFormat("[WINDLIGHT]: Cannot load windlight profile, module disabled. Use 'windlight enable' first.");
248 }
249 else
250 {
251 m_log.InfoFormat("[WINDLIGHT]: Loading Windlight profile from database");
252 m_scene.LoadWindlightProfile();
253 m_log.InfoFormat("[WINDLIGHT]: Load complete");
254 }
255 }
256
257 private void HandleDisable(Object[] args)
258 {
259 m_log.InfoFormat("[WINDLIGHT]: Plugin now disabled");
260 m_enableWindlight = false;
261 }
262
263 private void HandleEnable(Object[] args)
264 {
265 m_log.InfoFormat("[WINDLIGHT]: Plugin now enabled");
266 m_enableWindlight = true;
267 }
268
269 /// <summary>
270 /// Processes commandline input. Do not call directly.
271 /// </summary>
272 /// <param name="args">Commandline arguments</param>
273 private void EventManager_OnPluginConsole(string[] args)
274 {
275 if (args[0] == "windlight")
276 {
277 if (args.Length == 1)
278 {
279 m_commander.ProcessConsoleCommand("add", new string[0]);
280 return;
281 }
282
283 string[] tmpArgs = new string[args.Length - 2];
284 int i;
285 for (i = 2; i < args.Length; i++)
286 {
287 tmpArgs[i - 2] = args[i];
288 }
289
290 m_commander.ProcessConsoleCommand(args[1], tmpArgs);
291 }
292 }
293 #endregion
294
295 }
296}
297
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs
index 396095a..ba4b041 100644
--- a/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs
+++ b/OpenSim/Region/CoreModules/World/Media/Moap/Tests/MoapTests.cs
@@ -44,7 +44,7 @@ using OpenSim.Tests.Common.Mock;
44namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests 44namespace OpenSim.Region.CoreModules.World.Media.Moap.Tests
45{ 45{
46 [TestFixture] 46 [TestFixture]
47 public class MoapTests 47 public class MoapTests : OpenSimTestCase
48 { 48 {
49 protected TestScene m_scene; 49 protected TestScene m_scene;
50 protected MoapModule m_module; 50 protected MoapModule m_module;
diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
index 87241e1..ab8f143 100644
--- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs
@@ -27,10 +27,12 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO;
30using System.Linq; 31using System.Linq;
31using System.Reflection; 32using System.Reflection;
32using System.Text; 33using System.Text;
33using System.Text.RegularExpressions; 34using System.Text.RegularExpressions;
35using System.Xml;
34using log4net; 36using log4net;
35using Mono.Addins; 37using Mono.Addins;
36using NDesk.Options; 38using NDesk.Options;
@@ -41,6 +43,7 @@ using OpenSim.Framework.Console;
41using OpenSim.Framework.Monitoring; 43using OpenSim.Framework.Monitoring;
42using OpenSim.Region.Framework.Interfaces; 44using OpenSim.Region.Framework.Interfaces;
43using OpenSim.Region.Framework.Scenes; 45using OpenSim.Region.Framework.Scenes;
46using OpenSim.Region.Framework.Scenes.Serialization;
44 47
45namespace OpenSim.Region.CoreModules.World.Objects.Commands 48namespace OpenSim.Region.CoreModules.World.Objects.Commands
46{ 49{
@@ -96,9 +99,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
96 HandleDeleteObject); 99 HandleDeleteObject);
97 100
98 m_console.Commands.AddCommand( 101 m_console.Commands.AddCommand(
99 "Objects", false, "delete object uuid", 102 "Objects", false, "delete object id",
100 "delete object uuid <UUID>", 103 "delete object id <UUID-or-localID>",
101 "Delete a scene object by uuid", 104 "Delete a scene object by uuid or localID",
102 HandleDeleteObject); 105 HandleDeleteObject);
103 106
104 m_console.Commands.AddCommand( 107 m_console.Commands.AddCommand(
@@ -122,28 +125,18 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
122 "delete object pos", 125 "delete object pos",
123 "delete object pos <start-coord> to <end-coord>", 126 "delete object pos <start-coord> to <end-coord>",
124 "Delete scene objects within the given area.", 127 "Delete scene objects within the given area.",
125 "Each component of the coord is comma separated. There must be no spaces between the commas.\n" 128 ConsoleUtil.CoordHelp,
126 + "If you don't care about the z component you can simply omit it.\n"
127 + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n"
128 + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n"
129 + "If you want to specify the minimum value of a component then you can use -~ instead of a number\n"
130 + "e.g.\n"
131 + "delete object pos 20,20,20 to 40,40,40\n"
132 + "delete object pos 20,20 to 40,40\n"
133 + "delete object pos ,20,20 to ,40,40\n"
134 + "delete object pos ,,30 to ,,~\n"
135 + "delete object pos ,,-~ to ,,30",
136 HandleDeleteObject); 129 HandleDeleteObject);
137 130
138 m_console.Commands.AddCommand( 131 m_console.Commands.AddCommand(
139 "Objects", 132 "Objects",
140 false, 133 false,
141 "show object uuid", 134 "show object id",
142 "show object uuid [--full] <UUID>", 135 "show object id [--full] <UUID-or-localID>",
143 "Show details of a scene object with the given UUID", 136 "Show details of a scene object with the given UUID or localID",
144 "The --full option will print out information on all the parts of the object.\n" 137 "The --full option will print out information on all the parts of the object.\n"
145 + "For yet more detailed part information, use the \"show part\" commands.", 138 + "For yet more detailed part information, use the \"show part\" commands.",
146 HandleShowObjectByUuid); 139 HandleShowObjectById);
147 140
148 m_console.Commands.AddCommand( 141 m_console.Commands.AddCommand(
149 "Objects", 142 "Objects",
@@ -164,25 +157,15 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
164 "Show details of scene objects within the given area.", 157 "Show details of scene objects within the given area.",
165 "The --full option will print out information on all the parts of the object.\n" 158 "The --full option will print out information on all the parts of the object.\n"
166 + "For yet more detailed part information, use the \"show part\" commands.\n" 159 + "For yet more detailed part information, use the \"show part\" commands.\n"
167 + "Each component of the coord is comma separated. There must be no spaces between the commas.\n" 160 + ConsoleUtil.CoordHelp,
168 + "If you don't care about the z component you can simply omit it.\n"
169 + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n"
170 + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n"
171 + "If you want to specify the minimum value of a component then you can use -~ instead of a number\n"
172 + "e.g.\n"
173 + "show object pos 20,20,20 to 40,40,40\n"
174 + "show object pos 20,20 to 40,40\n"
175 + "show object pos ,20,20 to ,40,40\n"
176 + "show object pos ,,30 to ,,~\n"
177 + "show object pos ,,-~ to ,,30",
178 HandleShowObjectByPos); 161 HandleShowObjectByPos);
179 162
180 m_console.Commands.AddCommand( 163 m_console.Commands.AddCommand(
181 "Objects", 164 "Objects",
182 false, 165 false,
183 "show part uuid", 166 "show part id",
184 "show part uuid <UUID>", 167 "show part id <UUID-or-localID>",
185 "Show details of a scene object parts with the given UUID", HandleShowPartByUuid); 168 "Show details of a scene object part with the given UUID or localID", HandleShowPartById);
186 169
187 m_console.Commands.AddCommand( 170 m_console.Commands.AddCommand(
188 "Objects", 171 "Objects",
@@ -190,7 +173,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
190 "show part name", 173 "show part name",
191 "show part name [--regex] <name>", 174 "show part name [--regex] <name>",
192 "Show details of scene object parts with the given name.", 175 "Show details of scene object parts with the given name.",
193 "If --regex is specified then the name is treatead as a regular expression", 176 "If --regex is specified then the name is treated as a regular expression",
194 HandleShowPartByName); 177 HandleShowPartByName);
195 178
196 m_console.Commands.AddCommand( 179 m_console.Commands.AddCommand(
@@ -199,18 +182,19 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
199 "show part pos", 182 "show part pos",
200 "show part pos <start-coord> to <end-coord>", 183 "show part pos <start-coord> to <end-coord>",
201 "Show details of scene object parts within the given area.", 184 "Show details of scene object parts within the given area.",
202 "Each component of the coord is comma separated. There must be no spaces between the commas.\n" 185 ConsoleUtil.CoordHelp,
203 + "If you don't care about the z component you can simply omit it.\n"
204 + "If you don't care about the x or y components then you can leave them blank (though a comma is still required)\n"
205 + "If you want to specify the maxmimum value of a component then you can use ~ instead of a number\n"
206 + "If you want to specify the minimum value of a component then you can use -~ instead of a number\n"
207 + "e.g.\n"
208 + "show object pos 20,20,20 to 40,40,40\n"
209 + "show object pos 20,20 to 40,40\n"
210 + "show object pos ,20,20 to ,40,40\n"
211 + "show object pos ,,30 to ,,~\n"
212 + "show object pos ,,-~ to ,,30",
213 HandleShowPartByPos); 186 HandleShowPartByPos);
187
188 m_console.Commands.AddCommand(
189 "Objects",
190 false,
191 "dump object id",
192 "dump object id <UUID-or-localID>",
193 "Dump the formatted serialization of the given object to the file <UUID>.xml",
194 "e.g. dump object uuid c1ed6809-cc24-4061-a4c2-93082a2d1f1d will dump serialization to c1ed6809-cc24-4061-a4c2-93082a2d1f1d.xml\n"
195 + "To locate the UUID or localID in the first place, you need to use the other show object commands.\n"
196 + "If a local ID is given then the filename used is still that for the UUID",
197 HandleDumpObjectById);
214 } 198 }
215 199
216 public void RemoveRegion(Scene scene) 200 public void RemoveRegion(Scene scene)
@@ -265,7 +249,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
265 m_console.OutputFormat(sb.ToString()); 249 m_console.OutputFormat(sb.ToString());
266 } 250 }
267 251
268 private void HandleShowObjectByUuid(string module, string[] cmdparams) 252 private void HandleShowObjectById(string module, string[] cmdparams)
269 { 253 {
270 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 254 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
271 return; 255 return;
@@ -281,14 +265,17 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
281 return; 265 return;
282 } 266 }
283 267
284 UUID objectUuid; 268 UUID uuid;
285 if (!UUID.TryParse(mainParams[3], out objectUuid)) 269 uint localId;
286 { 270 if (!ConsoleUtil.TryParseConsoleId(m_console, mainParams[3], out uuid, out localId))
287 m_console.OutputFormat("{0} is not a valid uuid", mainParams[3]);
288 return; 271 return;
289 }
290 272
291 SceneObjectGroup so = m_scene.GetSceneObjectGroup(objectUuid); 273 SceneObjectGroup so;
274
275 if (localId != ConsoleUtil.LocalIdNotFound)
276 so = m_scene.GetSceneObjectGroup(localId);
277 else
278 so = m_scene.GetSceneObjectGroup(uuid);
292 279
293 if (so == null) 280 if (so == null)
294 { 281 {
@@ -365,7 +352,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
365 OutputSogsToConsole(searchPredicate, showFull); 352 OutputSogsToConsole(searchPredicate, showFull);
366 } 353 }
367 354
368 private void HandleShowPartByUuid(string module, string[] cmdparams) 355 private void HandleShowPartById(string module, string[] cmdparams)
369 { 356 {
370 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) 357 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
371 return; 358 return;
@@ -378,18 +365,20 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
378 365
379 if (mainParams.Count < 4) 366 if (mainParams.Count < 4)
380 { 367 {
381 m_console.OutputFormat("Usage: show part uuid [--full] <uuid>"); 368 m_console.OutputFormat("Usage: show part id [--full] <UUID-or-localID>");
382 return; 369 return;
383 } 370 }
384 371
385 UUID objectUuid; 372 UUID objectUuid;
386 if (!UUID.TryParse(mainParams[3], out objectUuid)) 373 uint localId;
387 { 374 if (!ConsoleUtil.TryParseConsoleId(m_console, mainParams[3], out objectUuid, out localId))
388 m_console.OutputFormat("{0} is not a valid uuid", mainParams[3]);
389 return; 375 return;
390 }
391 376
392 SceneObjectPart sop = m_scene.GetSceneObjectPart(objectUuid); 377 SceneObjectPart sop;
378 if (localId == ConsoleUtil.LocalIdNotFound)
379 sop = m_scene.GetSceneObjectPart(objectUuid);
380 else
381 sop = m_scene.GetSceneObjectPart(localId);
393 382
394 if (sop == null) 383 if (sop == null)
395 { 384 {
@@ -477,6 +466,51 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
477 OutputSopsToConsole(searchPredicate, true); 466 OutputSopsToConsole(searchPredicate, true);
478 } 467 }
479 468
469 private void HandleDumpObjectById(string module, string[] cmdparams)
470 {
471 if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene))
472 return;
473
474 if (cmdparams.Length < 4)
475 {
476 m_console.OutputFormat("Usage: dump object id <UUID-or-localID>");
477 return;
478 }
479
480 UUID objectUuid;
481 uint localId;
482 if (!ConsoleUtil.TryParseConsoleId(m_console, cmdparams[3], out objectUuid, out localId))
483 return;
484
485 SceneObjectGroup so;
486 if (localId == ConsoleUtil.LocalIdNotFound)
487 so = m_scene.GetSceneObjectGroup(objectUuid);
488 else
489 so = m_scene.GetSceneObjectGroup(localId);
490
491 if (so == null)
492 {
493// m_console.OutputFormat("No part found with uuid {0}", objectUuid);
494 return;
495 }
496
497 // In case we found it via local ID.
498 objectUuid = so.UUID;
499
500 string fileName = string.Format("{0}.xml", objectUuid);
501
502 if (!ConsoleUtil.CheckFileDoesNotExist(m_console, fileName))
503 return;
504
505 using (XmlTextWriter xtw = new XmlTextWriter(fileName, Encoding.UTF8))
506 {
507 xtw.Formatting = Formatting.Indented;
508 SceneObjectSerializer.ToOriginalXmlFormat(so, xtw, true);
509 }
510
511 m_console.OutputFormat("Object dumped to file {0}", fileName);
512 }
513
480 /// <summary> 514 /// <summary>
481 /// Append a scene object report to an input StringBuilder 515 /// Append a scene object report to an input StringBuilder
482 /// </summary> 516 /// </summary>
@@ -572,12 +606,18 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
572 cdt.AddColumn("Asset UUID", 36); 606 cdt.AddColumn("Asset UUID", 36);
573 607
574 foreach (TaskInventoryItem item in inv.GetInventoryItems()) 608 foreach (TaskInventoryItem item in inv.GetInventoryItems())
609 {
610 bool foundScriptInstance, scriptRunning;
611 foundScriptInstance
612 = SceneObjectPartInventory.TryGetScriptInstanceRunning(m_scene, item, out scriptRunning);
613
575 cdt.AddRow( 614 cdt.AddRow(
576 item.Name, 615 item.Name,
577 ((InventoryType)item.InvType).ToString(), 616 ((InventoryType)item.InvType).ToString(),
578 (InventoryType)item.InvType == InventoryType.LSL ? item.ScriptRunning.ToString() : "n/a", 617 foundScriptInstance ? scriptRunning.ToString() : "n/a",
579 item.ItemID.ToString(), 618 item.ItemID.ToString(),
580 item.AssetID.ToString()); 619 item.AssetID.ToString());
620 }
581 621
582 return sb.Append(cdt.ToString()); 622 return sb.Append(cdt.ToString());
583 } 623 }
@@ -641,19 +681,24 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands
641 681
642 break; 682 break;
643 683
644 case "uuid": 684 case "id":
645 if (!UUID.TryParse(o, out match)) 685 UUID uuid;
686 uint localId;
687 if (!ConsoleUtil.TryParseConsoleId(m_console, o, out uuid, out localId))
646 return; 688 return;
647 689
648 requireConfirmation = false; 690 requireConfirmation = false;
649 deletes = new List<SceneObjectGroup>(); 691 deletes = new List<SceneObjectGroup>();
650 692
651 m_scene.ForEachSOG(delegate (SceneObjectGroup g) 693 SceneObjectGroup so;
652 { 694 if (localId == ConsoleUtil.LocalIdNotFound)
653 if (g.UUID == match && !g.IsAttachment) 695 so = m_scene.GetSceneObjectGroup(uuid);
654 deletes.Add(g); 696 else
655 }); 697 so = m_scene.GetSceneObjectGroup(localId);
656 698
699 if (!so.IsAttachment)
700 deletes.Add(so);
701
657 // if (deletes.Count == 0) 702 // if (deletes.Count == 0)
658 // m_console.OutputFormat("No objects were found with uuid {0}", match); 703 // m_console.OutputFormat("No objects were found with uuid {0}", match);
659 704
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 7a8a57c..ddaa227 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -37,13 +37,17 @@ using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
39 39
40using Mono.Addins;
41
40namespace OpenSim.Region.CoreModules.World.Permissions 42namespace OpenSim.Region.CoreModules.World.Permissions
41{ 43{
42 public class PermissionsModule : IRegionModule, IPermissionsModule 44 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "PermissionsModule")]
45 public class PermissionsModule : INonSharedRegionModule, IPermissionsModule
43 { 46 {
44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 48
46 protected Scene m_scene; 49 protected Scene m_scene;
50 protected bool m_Enabled;
47 51
48 private InventoryFolderImpl m_libraryRootFolder; 52 private InventoryFolderImpl m_libraryRootFolder;
49 protected InventoryFolderImpl LibraryRootFolder 53 protected InventoryFolderImpl LibraryRootFolder
@@ -114,18 +118,44 @@ namespace OpenSim.Region.CoreModules.World.Permissions
114 private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>(); 118 private Dictionary<string, bool> GrantVB = new Dictionary<string, bool>();
115 private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>(); 119 private Dictionary<string, bool> GrantJS = new Dictionary<string, bool>();
116 private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>(); 120 private Dictionary<string, bool> GrantYP = new Dictionary<string, bool>();
121
117 private IFriendsModule m_friendsModule; 122 private IFriendsModule m_friendsModule;
123 private IFriendsModule FriendsModule
124 {
125 get
126 {
127 if (m_friendsModule == null)
128 m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
129 return m_friendsModule;
130 }
131 }
118 private IGroupsModule m_groupsModule; 132 private IGroupsModule m_groupsModule;
119 private IMoapModule m_moapModule; 133 private IGroupsModule GroupsModule
134 {
135 get
136 {
137 if (m_groupsModule == null)
138 m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();
139 return m_groupsModule;
140 }
141 }
120 142
143 private IMoapModule m_moapModule;
144 private IMoapModule MoapModule
145 {
146 get
147 {
148 if (m_moapModule == null)
149 m_moapModule = m_scene.RequestModuleInterface<IMoapModule>();
150 return m_moapModule;
151 }
152 }
121 #endregion 153 #endregion
122 154
123 #region IRegionModule Members 155 #region INonSharedRegionModule Members
124 156
125 public void Initialise(Scene scene, IConfigSource config) 157 public void Initialise(IConfigSource config)
126 { 158 {
127 m_scene = scene;
128
129 IConfig myConfig = config.Configs["Startup"]; 159 IConfig myConfig = config.Configs["Startup"];
130 160
131 string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule"); 161 string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule");
@@ -135,6 +165,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
135 if (!modules.Contains("DefaultPermissionsModule")) 165 if (!modules.Contains("DefaultPermissionsModule"))
136 return; 166 return;
137 167
168 m_Enabled = true;
169
138 m_allowGridGods = myConfig.GetBoolean("allow_grid_gods", false); 170 m_allowGridGods = myConfig.GetBoolean("allow_grid_gods", false);
139 m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", true); 171 m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", true);
140 m_propagatePermissions = myConfig.GetBoolean("propagate_permissions", true); 172 m_propagatePermissions = myConfig.GetBoolean("propagate_permissions", true);
@@ -144,7 +176,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
144 176
145 m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false); 177 m_SimpleBuildPermissions = myConfig.GetBoolean("simple_build_permissions", false);
146 178
147 m_allowedScriptCreators 179 m_allowedScriptCreators
148 = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators); 180 = ParseUserSetConfigSetting(myConfig, "allowed_script_creators", m_allowedScriptCreators);
149 m_allowedScriptEditors 181 m_allowedScriptEditors
150 = ParseUserSetConfigSetting(myConfig, "allowed_script_editors", m_allowedScriptEditors); 182 = ParseUserSetConfigSetting(myConfig, "allowed_script_editors", m_allowedScriptEditors);
@@ -154,6 +186,64 @@ namespace OpenSim.Region.CoreModules.World.Permissions
154 else 186 else
155 m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks"); 187 m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks");
156 188
189 string grant = myConfig.GetString("GrantLSL", "");
190 if (grant.Length > 0)
191 {
192 foreach (string uuidl in grant.Split(','))
193 {
194 string uuid = uuidl.Trim(" \t".ToCharArray());
195 GrantLSL.Add(uuid, true);
196 }
197 }
198
199 grant = myConfig.GetString("GrantCS", "");
200 if (grant.Length > 0)
201 {
202 foreach (string uuidl in grant.Split(','))
203 {
204 string uuid = uuidl.Trim(" \t".ToCharArray());
205 GrantCS.Add(uuid, true);
206 }
207 }
208
209 grant = myConfig.GetString("GrantVB", "");
210 if (grant.Length > 0)
211 {
212 foreach (string uuidl in grant.Split(','))
213 {
214 string uuid = uuidl.Trim(" \t".ToCharArray());
215 GrantVB.Add(uuid, true);
216 }
217 }
218
219 grant = myConfig.GetString("GrantJS", "");
220 if (grant.Length > 0)
221 {
222 foreach (string uuidl in grant.Split(','))
223 {
224 string uuid = uuidl.Trim(" \t".ToCharArray());
225 GrantJS.Add(uuid, true);
226 }
227 }
228
229 grant = myConfig.GetString("GrantYP", "");
230 if (grant.Length > 0)
231 {
232 foreach (string uuidl in grant.Split(','))
233 {
234 string uuid = uuidl.Trim(" \t".ToCharArray());
235 GrantYP.Add(uuid, true);
236 }
237 }
238 }
239
240 public void AddRegion(Scene scene)
241 {
242 if (!m_Enabled)
243 return;
244
245 m_scene = scene;
246
157 scene.RegisterModuleInterface<IPermissionsModule>(this); 247 scene.RegisterModuleInterface<IPermissionsModule>(this);
158 248
159 //Register functions with Scene External Checks! 249 //Register functions with Scene External Checks!
@@ -169,44 +259,44 @@ namespace OpenSim.Region.CoreModules.World.Permissions
169 m_scene.Permissions.OnIsGridGod += IsGridGod; 259 m_scene.Permissions.OnIsGridGod += IsGridGod;
170 m_scene.Permissions.OnIsAdministrator += IsAdministrator; 260 m_scene.Permissions.OnIsAdministrator += IsAdministrator;
171 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; 261 m_scene.Permissions.OnDuplicateObject += CanDuplicateObject;
172 m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED 262 m_scene.Permissions.OnDeleteObject += CanDeleteObject;
173 m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED 263 m_scene.Permissions.OnEditObject += CanEditObject;
174 m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties; //MAYBE FULLY IMPLEMENTED 264 m_scene.Permissions.OnEditParcelProperties += CanEditParcelProperties;
175 m_scene.Permissions.OnInstantMessage += CanInstantMessage; 265 m_scene.Permissions.OnInstantMessage += CanInstantMessage;
176 m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED 266 m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer;
177 m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED 267 m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand;
178 m_scene.Permissions.OnMoveObject += CanMoveObject; //MAYBE FULLY IMPLEMENTED 268 m_scene.Permissions.OnMoveObject += CanMoveObject;
179 m_scene.Permissions.OnObjectEntry += CanObjectEntry; 269 m_scene.Permissions.OnObjectEntry += CanObjectEntry;
180 m_scene.Permissions.OnReturnObjects += CanReturnObjects; //NOT YET IMPLEMENTED 270 m_scene.Permissions.OnReturnObjects += CanReturnObjects;
181 m_scene.Permissions.OnRezObject += CanRezObject; //MAYBE FULLY IMPLEMENTED 271 m_scene.Permissions.OnRezObject += CanRezObject;
182 m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand; 272 m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand;
183 m_scene.Permissions.OnRunScript += CanRunScript; //NOT YET IMPLEMENTED 273 m_scene.Permissions.OnRunScript += CanRunScript;
184 m_scene.Permissions.OnCompileScript += CanCompileScript; 274 m_scene.Permissions.OnCompileScript += CanCompileScript;
185 m_scene.Permissions.OnSellParcel += CanSellParcel; 275 m_scene.Permissions.OnSellParcel += CanSellParcel;
186 m_scene.Permissions.OnTakeObject += CanTakeObject; 276 m_scene.Permissions.OnTakeObject += CanTakeObject;
187 m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject; 277 m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject;
188 m_scene.Permissions.OnTerraformLand += CanTerraformLand; 278 m_scene.Permissions.OnTerraformLand += CanTerraformLand;
189 m_scene.Permissions.OnLinkObject += CanLinkObject; //NOT YET IMPLEMENTED 279 m_scene.Permissions.OnLinkObject += CanLinkObject;
190 m_scene.Permissions.OnDelinkObject += CanDelinkObject; //NOT YET IMPLEMENTED 280 m_scene.Permissions.OnDelinkObject += CanDelinkObject;
191 m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED 281 m_scene.Permissions.OnBuyLand += CanBuyLand;
192 282
193 m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED 283 m_scene.Permissions.OnViewNotecard += CanViewNotecard;
194 m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED 284 m_scene.Permissions.OnViewScript += CanViewScript;
195 m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED 285 m_scene.Permissions.OnEditNotecard += CanEditNotecard;
196 m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED 286 m_scene.Permissions.OnEditScript += CanEditScript;
197 287
198 m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; 288 m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory;
199 m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED 289 m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;
200 m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED 290 m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory;
201 m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED 291 m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory;
202 m_scene.Permissions.OnResetScript += CanResetScript; 292 m_scene.Permissions.OnResetScript += CanResetScript;
203 293
204 m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; //NOT YET IMPLEMENTED 294 m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory;
205 m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; //NOT YET IMPLEMENTED 295 m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory;
206 m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; //NOT YET IMPLEMENTED 296 m_scene.Permissions.OnEditUserInventory += CanEditUserInventory;
207 m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED 297 m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory;
208 298
209 m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED 299 m_scene.Permissions.OnTeleport += CanTeleport;
210 300
211 m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia; 301 m_scene.Permissions.OnControlPrimMedia += CanControlPrimMedia;
212 m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia; 302 m_scene.Permissions.OnInteractWithPrimMedia += CanInteractWithPrimMedia;
@@ -226,52 +316,38 @@ namespace OpenSim.Region.CoreModules.World.Permissions
226 "Turn on permissions debugging", 316 "Turn on permissions debugging",
227 HandleDebugPermissions); 317 HandleDebugPermissions);
228 318
229 string grant = myConfig.GetString("GrantLSL",""); 319 }
230 if (grant.Length > 0) {
231 foreach (string uuidl in grant.Split(',')) {
232 string uuid = uuidl.Trim(" \t".ToCharArray());
233 GrantLSL.Add(uuid, true);
234 }
235 }
236 320
237 grant = myConfig.GetString("GrantCS",""); 321 public void RegionLoaded(Scene scene)
238 if (grant.Length > 0) { 322 {
239 foreach (string uuidl in grant.Split(',')) { 323 }
240 string uuid = uuidl.Trim(" \t".ToCharArray());
241 GrantCS.Add(uuid, true);
242 }
243 }
244 324
245 grant = myConfig.GetString("GrantVB",""); 325 public void RemoveRegion(Scene scene)
246 if (grant.Length > 0) { 326 {
247 foreach (string uuidl in grant.Split(',')) { 327 if (!m_Enabled)
248 string uuid = uuidl.Trim(" \t".ToCharArray()); 328 return;
249 GrantVB.Add(uuid, true);
250 }
251 }
252 329
253 grant = myConfig.GetString("GrantJS", ""); 330 m_scene.UnregisterModuleInterface<IPermissionsModule>(this);
254 if (grant.Length > 0) 331 }
255 {
256 foreach (string uuidl in grant.Split(','))
257 {
258 string uuid = uuidl.Trim(" \t".ToCharArray());
259 GrantJS.Add(uuid, true);
260 }
261 }
262 332
263 grant = myConfig.GetString("GrantYP", ""); 333 public void Close()
264 if (grant.Length > 0) 334 {
265 { 335 }
266 foreach (string uuidl in grant.Split(',')) 336
267 { 337 public string Name
268 string uuid = uuidl.Trim(" \t".ToCharArray()); 338 {
269 GrantYP.Add(uuid, true); 339 get { return "PermissionsModule"; }
270 } 340 }
271 }
272 341
342 public Type ReplaceableInterface
343 {
344 get { return null; }
273 } 345 }
274 346
347 #endregion
348
349 #region Console command handlers
350
275 public void HandleBypassPermissions(string module, string[] args) 351 public void HandleBypassPermissions(string module, string[] args)
276 { 352 {
277 if (m_scene.ConsoleScene() != null && 353 if (m_scene.ConsoleScene() != null &&
@@ -290,7 +366,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
290 m_bypassPermissions = val; 366 m_bypassPermissions = val;
291 367
292 m_log.InfoFormat( 368 m_log.InfoFormat(
293 "[PERMISSIONS]: Set permissions bypass to {0} for {1}", 369 "[PERMISSIONS]: Set permissions bypass to {0} for {1}",
294 m_bypassPermissions, m_scene.RegionInfo.RegionName); 370 m_bypassPermissions, m_scene.RegionInfo.RegionName);
295 } 371 }
296 } 372 }
@@ -343,39 +419,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
343 } 419 }
344 } 420 }
345 421
346 public void PostInitialise()
347 {
348 m_friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
349
350 if (m_friendsModule == null)
351 m_log.Debug("[PERMISSIONS]: Friends module not found, friend permissions will not work");
352
353 m_groupsModule = m_scene.RequestModuleInterface<IGroupsModule>();
354
355 if (m_groupsModule == null)
356 m_log.Debug("[PERMISSIONS]: Groups module not found, group permissions will not work");
357
358 m_moapModule = m_scene.RequestModuleInterface<IMoapModule>();
359
360 // This log line will be commented out when no longer required for debugging
361// if (m_moapModule == null)
362// m_log.Warn("[PERMISSIONS]: Media on a prim module not found, media on a prim permissions will not work");
363 }
364
365 public void Close()
366 {
367 }
368
369 public string Name
370 {
371 get { return "PermissionsModule"; }
372 }
373
374 public bool IsSharedModule
375 {
376 get { return false; }
377 }
378
379 #endregion 422 #endregion
380 423
381 #region Helper Functions 424 #region Helper Functions
@@ -400,10 +443,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
400 /// <returns></returns> 443 /// <returns></returns>
401 protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers) 444 protected bool IsGroupMember(UUID groupID, UUID userID, ulong powers)
402 { 445 {
403 if (null == m_groupsModule) 446 if (null == GroupsModule)
404 return false; 447 return false;
405 448
406 GroupMembershipData gmd = m_groupsModule.GetMembershipData(groupID, userID); 449 GroupMembershipData gmd = GroupsModule.GetMembershipData(groupID, userID);
407 450
408 if (gmd != null) 451 if (gmd != null)
409 { 452 {
@@ -503,10 +546,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions
503 if (user == UUID.Zero) 546 if (user == UUID.Zero)
504 return false; 547 return false;
505 548
506 if (m_friendsModule == null) 549 if (FriendsModule == null)
507 return false; 550 return false;
508 551
509 int friendPerms = m_friendsModule.GetRightsGrantedByFriend(user, objectOwner); 552 int friendPerms = FriendsModule.GetRightsGrantedByFriend(user, objectOwner);
510 return (friendPerms & (int)FriendRights.CanModifyObjects) != 0; 553 return (friendPerms & (int)FriendRights.CanModifyObjects) != 0;
511 } 554 }
512 555
@@ -1915,14 +1958,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1915// "[PERMISSONS]: Performing CanControlPrimMedia check with agentID {0}, primID {1}, face {2}", 1958// "[PERMISSONS]: Performing CanControlPrimMedia check with agentID {0}, primID {1}, face {2}",
1916// agentID, primID, face); 1959// agentID, primID, face);
1917 1960
1918 if (null == m_moapModule) 1961 if (null == MoapModule)
1919 return false; 1962 return false;
1920 1963
1921 SceneObjectPart part = m_scene.GetSceneObjectPart(primID); 1964 SceneObjectPart part = m_scene.GetSceneObjectPart(primID);
1922 if (null == part) 1965 if (null == part)
1923 return false; 1966 return false;
1924 1967
1925 MediaEntry me = m_moapModule.GetMediaEntry(part, face); 1968 MediaEntry me = MoapModule.GetMediaEntry(part, face);
1926 1969
1927 // If there is no existing media entry then it can be controlled (in this context, created). 1970 // If there is no existing media entry then it can be controlled (in this context, created).
1928 if (null == me) 1971 if (null == me)
@@ -1941,14 +1984,14 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1941// "[PERMISSONS]: Performing CanInteractWithPrimMedia check with agentID {0}, primID {1}, face {2}", 1984// "[PERMISSONS]: Performing CanInteractWithPrimMedia check with agentID {0}, primID {1}, face {2}",
1942// agentID, primID, face); 1985// agentID, primID, face);
1943 1986
1944 if (null == m_moapModule) 1987 if (null == MoapModule)
1945 return false; 1988 return false;
1946 1989
1947 SceneObjectPart part = m_scene.GetSceneObjectPart(primID); 1990 SceneObjectPart part = m_scene.GetSceneObjectPart(primID);
1948 if (null == part) 1991 if (null == part)
1949 return false; 1992 return false;
1950 1993
1951 MediaEntry me = m_moapModule.GetMediaEntry(part, face); 1994 MediaEntry me = MoapModule.GetMediaEntry(part, face);
1952 1995
1953 // If there is no existing media entry then it can be controlled (in this context, created). 1996 // If there is no existing media entry then it can be controlled (in this context, created).
1954 if (null == me) 1997 if (null == me)
diff --git a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
index fea4de0..249a40d 100644
--- a/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
+++ b/OpenSim/Region/CoreModules/World/Region/RestartModule.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Linq;
29using System.Reflection; 30using System.Reflection;
30using System.Timers; 31using System.Timers;
31using System.Threading; 32using System.Threading;
@@ -264,7 +265,10 @@ namespace OpenSim.Region.CoreModules.World.Region
264 for (int i = 4 ; i < args.Length ; i++) 265 for (int i = 4 ; i < args.Length ; i++)
265 times.Add(Convert.ToInt32(args[i])); 266 times.Add(Convert.ToInt32(args[i]));
266 267
268 MainConsole.Instance.OutputFormat(
269 "Region {0} scheduled for restart in {1} seconds", m_Scene.Name, times.Sum());
270
267 ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice); 271 ScheduleRestart(UUID.Zero, args[3], times.ToArray(), notice);
268 } 272 }
269 } 273 }
270} 274} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
index 0e861a1..e0247d9 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/SerialiserModule.cs
@@ -32,6 +32,7 @@ using System.Reflection;
32 32
33using log4net; 33using log4net;
34using Nini.Config; 34using Nini.Config;
35using Mono.Addins;
35 36
36using OpenMetaverse; 37using OpenMetaverse;
37using OpenSim.Region.CoreModules.Framework.InterfaceCommander; 38using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
@@ -41,6 +42,7 @@ using OpenSim.Region.Framework.Scenes.Serialization;
41 42
42namespace OpenSim.Region.CoreModules.World.Serialiser 43namespace OpenSim.Region.CoreModules.World.Serialiser
43{ 44{
45 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SerialiserModule")]
44 public class SerialiserModule : ISharedRegionModule, IRegionSerialiserModule 46 public class SerialiserModule : ISharedRegionModule, IRegionSerialiserModule
45 { 47 {
46 private static readonly ILog m_log = 48 private static readonly ILog m_log =
diff --git a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
index 7825e3e..bcb8e2f 100644
--- a/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
+++ b/OpenSim/Region/CoreModules/World/Serialiser/Tests/SerialiserTests.cs
@@ -39,7 +39,7 @@ using OpenSim.Tests.Common;
39namespace OpenSim.Region.CoreModules.World.Serialiser.Tests 39namespace OpenSim.Region.CoreModules.World.Serialiser.Tests
40{ 40{
41 [TestFixture] 41 [TestFixture]
42 public class SerialiserTests 42 public class SerialiserTests : OpenSimTestCase
43 { 43 {
44 private string xml = @" 44 private string xml = @"
45 <SceneObjectGroup> 45 <SceneObjectGroup>
diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
index a2f0950..089fcda 100644
--- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
+++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -24,56 +24,110 @@
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;
28using System.IO;
29using System.Collections.Generic;
30using System.Reflection;
31
29using Nini.Config; 32using Nini.Config;
30using OpenMetaverse; 33using OpenMetaverse;
34using log4net;
35using Mono.Addins;
36
31using OpenSim.Framework; 37using OpenSim.Framework;
32using OpenSim.Region.Framework.Interfaces; 38using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Region.Framework.Scenes; 39using OpenSim.Region.Framework.Scenes;
34using System.Reflection;
35using log4net;
36 40
37namespace OpenSim.Region.CoreModules.World.Sound 41namespace OpenSim.Region.CoreModules.World.Sound
38{ 42{
39 public class SoundModule : IRegionModule, ISoundModule 43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "SoundModule")]
44 public class SoundModule : INonSharedRegionModule, ISoundModule
40 { 45 {
41// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46// private static readonly ILog m_log = LogManager.GetLogger(
42 47// MethodBase.GetCurrentMethod().DeclaringType);
43 protected Scene m_scene; 48
44 49 private Scene m_scene;
45 public void Initialise(Scene scene, IConfigSource source) 50
51 public bool Enabled { get; private set; }
52
53 public float MaxDistance { get; private set; }
54
55 #region INonSharedRegionModule
56
57 public void Initialise(IConfigSource configSource)
58 {
59 IConfig config = configSource.Configs["Sounds"];
60
61 if (config == null)
62 {
63 Enabled = true;
64 MaxDistance = 100.0f;
65 }
66 else
67 {
68 Enabled = config.GetString("Module", "OpenSim.Region.CoreModules.dll:SoundModule") ==
69 Path.GetFileName(Assembly.GetExecutingAssembly().Location)
70 + ":" + MethodBase.GetCurrentMethod().DeclaringType.Name;
71 MaxDistance = config.GetFloat("MaxDistance", 100.0f);
72 }
73 }
74
75 public void AddRegion(Scene scene) { }
76
77 public void RemoveRegion(Scene scene)
46 { 78 {
79 m_scene.EventManager.OnClientLogin -= OnNewClient;
80 }
81
82 public void RegionLoaded(Scene scene)
83 {
84 if (!Enabled)
85 return;
86
47 m_scene = scene; 87 m_scene = scene;
48 88 m_scene.EventManager.OnClientLogin += OnNewClient;
49 m_scene.EventManager.OnNewClient += OnNewClient; 89
50
51 m_scene.RegisterModuleInterface<ISoundModule>(this); 90 m_scene.RegisterModuleInterface<ISoundModule>(this);
52 } 91 }
53 92
54 public void PostInitialise() {} 93 public void Close() { }
55 public void Close() {} 94
95 public Type ReplaceableInterface
96 {
97 get { return typeof(ISoundModule); }
98 }
99
56 public string Name { get { return "Sound Module"; } } 100 public string Name { get { return "Sound Module"; } }
57 public bool IsSharedModule { get { return false; } } 101
58 102 #endregion
103
104 #region Event Handlers
105
59 private void OnNewClient(IClientAPI client) 106 private void OnNewClient(IClientAPI client)
60 { 107 {
61 client.OnSoundTrigger += TriggerSound; 108 client.OnSoundTrigger += TriggerSound;
62 } 109 }
63 110
111 #endregion
112
113 #region ISoundModule
114
64 public virtual void PlayAttachedSound( 115 public virtual void PlayAttachedSound(
65 UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius) 116 UUID soundID, UUID ownerID, UUID objectID, double gain, Vector3 position, byte flags, float radius)
66 { 117 {
67 SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); 118 SceneObjectPart part;
68 if (part == null) 119 if (!m_scene.TryGetSceneObjectPart(objectID, out part))
69 return; 120 return;
70 121
71 SceneObjectGroup grp = part.ParentGroup; 122 SceneObjectGroup grp = part.ParentGroup;
72 123
124 if (radius == 0)
125 radius = MaxDistance;
126
73 m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) 127 m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
74 { 128 {
75 double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); 129 double dis = Util.GetDistanceTo(sp.AbsolutePosition, position);
76 if (dis > 100.0) // Max audio distance 130 if (dis > MaxDistance) // Max audio distance
77 return; 131 return;
78 132
79 if (grp.IsAttachment) 133 if (grp.IsAttachment)
@@ -85,26 +139,22 @@ namespace OpenSim.Region.CoreModules.World.Sound
85 dis = 0; 139 dis = 0;
86 } 140 }
87 141
88 float thisSpGain;
89
90 // Scale by distance 142 // Scale by distance
91 if (radius == 0) 143 double thisSpGain = gain * ((radius - dis) / radius);
92 thisSpGain = (float)((double)gain * ((100.0 - dis) / 100.0));
93 else
94 thisSpGain = (float)((double)gain * ((radius - dis) / radius));
95 144
96 sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, thisSpGain, flags); 145 sp.ControllingClient.SendPlayAttachedSound(soundID, objectID,
146 ownerID, (float)thisSpGain, flags);
97 }); 147 });
98 } 148 }
99 149
100 public virtual void TriggerSound( 150 public virtual void TriggerSound(
101 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius) 151 UUID soundId, UUID ownerID, UUID objectID, UUID parentID, double gain, Vector3 position, UInt64 handle, float radius)
102 { 152 {
103 SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); 153 SceneObjectPart part;
104 if (part == null) 154 if (!m_scene.TryGetSceneObjectPart(objectID, out part))
105 { 155 {
106 ScenePresence sp; 156 ScenePresence sp;
107 if (!m_scene.TryGetScenePresence(objectID, out sp)) 157 if (!m_scene.TryGetScenePresence(ownerID, out sp))
108 return; 158 return;
109 } 159 }
110 else 160 else
@@ -118,24 +168,207 @@ namespace OpenSim.Region.CoreModules.World.Sound
118 } 168 }
119 } 169 }
120 170
171 if (radius == 0)
172 radius = MaxDistance;
173
121 m_scene.ForEachRootScenePresence(delegate(ScenePresence sp) 174 m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
122 { 175 {
123 double dis = Util.GetDistanceTo(sp.AbsolutePosition, position); 176 double dis = Util.GetDistanceTo(sp.AbsolutePosition, position);
124 177
125 if (dis > 100.0) // Max audio distance 178 if (dis > MaxDistance) // Max audio distance
126 return; 179 return;
127 180
128 float thisSpGain;
129
130 // Scale by distance 181 // Scale by distance
131 if (radius == 0) 182 double thisSpGain = gain * ((radius - dis) / radius);
132 thisSpGain = (float)((double)gain * ((100.0 - dis) / 100.0)); 183
184 sp.ControllingClient.SendTriggeredSound(soundId, ownerID,
185 objectID, parentID, handle, position,
186 (float)thisSpGain);
187 });
188 }
189
190 public virtual void StopSound(UUID objectID)
191 {
192 SceneObjectPart m_host;
193 if (!m_scene.TryGetSceneObjectPart(objectID, out m_host))
194 return;
195
196 StopSound(m_host);
197 }
198
199 private static void StopSound(SceneObjectPart m_host)
200 {
201 m_host.AdjustSoundGain(0);
202 // Xantor 20080528: Clear prim data of sound instead
203 if (m_host.ParentGroup.LoopSoundSlavePrims.Contains(m_host))
204 {
205 if (m_host.ParentGroup.LoopSoundMasterPrim == m_host)
206 {
207 foreach (SceneObjectPart part in m_host.ParentGroup.LoopSoundSlavePrims)
208 {
209 part.Sound = UUID.Zero;
210 part.SoundFlags = 1 << 5;
211 part.SoundRadius = 0;
212 part.ScheduleFullUpdate();
213 part.SendFullUpdateToAllClients();
214 }
215 m_host.ParentGroup.LoopSoundMasterPrim = null;
216 m_host.ParentGroup.LoopSoundSlavePrims.Clear();
217 }
133 else 218 else
134 thisSpGain = (float)((double)gain * ((radius - dis) / radius)); 219 {
220 m_host.Sound = UUID.Zero;
221 m_host.SoundFlags = 1 << 5;
222 m_host.SoundRadius = 0;
223 m_host.ScheduleFullUpdate();
224 m_host.SendFullUpdateToAllClients();
225 }
226 }
227 else
228 {
229 m_host.Sound = UUID.Zero;
230 m_host.SoundFlags = 1 << 5;
231 m_host.SoundRadius = 0;
232 m_host.ScheduleFullUpdate();
233 m_host.SendFullUpdateToAllClients();
234 }
235 }
135 236
136 sp.ControllingClient.SendTriggeredSound( 237 public virtual void PreloadSound(UUID objectID, UUID soundID, float radius)
137 soundId, ownerID, objectID, parentID, handle, position, thisSpGain); 238 {
239 SceneObjectPart part;
240 if (soundID == UUID.Zero
241 || !m_scene.TryGetSceneObjectPart(objectID, out part))
242 {
243 return;
244 }
245
246 if (radius == 0)
247 radius = MaxDistance;
248
249 m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
250 {
251 if (!(Util.GetDistanceTo(sp.AbsolutePosition, part.AbsolutePosition) >= MaxDistance))
252 sp.ControllingClient.SendPreLoadSound(objectID, objectID, soundID);
138 }); 253 });
139 } 254 }
255
256 // Xantor 20080528 we should do this differently.
257 // 1) apply the sound to the object
258 // 2) schedule full update
259 // just sending the sound out once doesn't work so well when other avatars come in view later on
260 // or when the prim gets moved, changed, sat on, whatever
261 // see large number of mantises (mantes?)
262 // 20080530 Updated to remove code duplication
263 // 20080530 Stop sound if there is one, otherwise volume only changes don't work
264 public void LoopSound(UUID objectID, UUID soundID,
265 double volume, double radius, bool isMaster)
266 {
267 SceneObjectPart m_host;
268 if (!m_scene.TryGetSceneObjectPart(objectID, out m_host))
269 return;
270
271 if (isMaster)
272 m_host.ParentGroup.LoopSoundMasterPrim = m_host;
273
274 if (m_host.Sound != UUID.Zero)
275 StopSound(m_host);
276
277 m_host.Sound = soundID;
278 m_host.SoundGain = volume;
279 m_host.SoundFlags = 1; // looping
280 m_host.SoundRadius = radius;
281
282 m_host.ScheduleFullUpdate();
283 m_host.SendFullUpdateToAllClients();
284 }
285
286 public void SendSound(UUID objectID, UUID soundID, double volume,
287 bool triggered, byte flags, float radius, bool useMaster,
288 bool isMaster)
289 {
290 if (soundID == UUID.Zero)
291 return;
292
293 SceneObjectPart part;
294 if (!m_scene.TryGetSceneObjectPart(objectID, out part))
295 return;
296
297 volume = Util.Clip((float)volume, 0, 1);
298
299 UUID parentID = part.ParentGroup.UUID;
300
301 Vector3 position = part.AbsolutePosition; // region local
302 ulong regionHandle = m_scene.RegionInfo.RegionHandle;
303
304 if (useMaster)
305 {
306 if (isMaster)
307 {
308 if (triggered)
309 TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius);
310 else
311 PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius);
312 part.ParentGroup.PlaySoundMasterPrim = part;
313 if (triggered)
314 TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius);
315 else
316 PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius);
317 foreach (SceneObjectPart prim in part.ParentGroup.PlaySoundSlavePrims)
318 {
319 position = prim.AbsolutePosition; // region local
320 if (triggered)
321 TriggerSound(soundID, part.OwnerID, prim.UUID, parentID, volume, position, regionHandle, radius);
322 else
323 PlayAttachedSound(soundID, part.OwnerID, prim.UUID, volume, position, flags, radius);
324 }
325 part.ParentGroup.PlaySoundSlavePrims.Clear();
326 part.ParentGroup.PlaySoundMasterPrim = null;
327 }
328 else
329 {
330 part.ParentGroup.PlaySoundSlavePrims.Add(part);
331 }
332 }
333 else
334 {
335 if (triggered)
336 TriggerSound(soundID, part.OwnerID, part.UUID, parentID, volume, position, regionHandle, radius);
337 else
338 PlayAttachedSound(soundID, part.OwnerID, part.UUID, volume, position, flags, radius);
339 }
340 }
341
342 public void TriggerSoundLimited(UUID objectID, UUID sound,
343 double volume, Vector3 min, Vector3 max)
344 {
345 if (sound == UUID.Zero)
346 return;
347
348 SceneObjectPart part;
349 if (!m_scene.TryGetSceneObjectPart(objectID, out part))
350 return;
351
352 m_scene.ForEachRootScenePresence(delegate(ScenePresence sp)
353 {
354 double dis = Util.GetDistanceTo(sp.AbsolutePosition,
355 part.AbsolutePosition);
356
357 if (dis > MaxDistance) // Max audio distance
358 return;
359 else if (!Util.IsInsideBox(sp.AbsolutePosition, min, max))
360 return;
361
362 // Scale by distance
363 double thisSpGain = volume * ((MaxDistance - dis) / MaxDistance);
364
365 sp.ControllingClient.SendTriggeredSound(sound, part.OwnerID,
366 part.UUID, part.ParentGroup.UUID,
367 m_scene.RegionInfo.RegionHandle,
368 part.AbsolutePosition, (float)thisSpGain);
369 });
370 }
371
372 #endregion
140 } 373 }
141} 374}
diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs
index 9a954b8..a321c09 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", Id = "SunModule")]
40 public class SunModule : ISunModule 42 public class SunModule : ISunModule
41 { 43 {
42 /// <summary> 44 /// <summary>
@@ -267,26 +269,17 @@ namespace OpenSim.Region.CoreModules
267 return GetCurrentSunHour() + 6.0f; 269 return GetCurrentSunHour() + 6.0f;
268 } 270 }
269 271
270 #region IRegion Methods 272 #region INonSharedRegion Methods
271 273
272 // Called immediately after the module is loaded for a given region 274 // Called immediately after the module is loaded for a given region
273 // i.e. Immediately after instance creation. 275 // i.e. Immediately after instance creation.
274 public void Initialise(Scene scene, IConfigSource config) 276 public void Initialise(IConfigSource config)
275 { 277 {
276 m_scene = scene;
277 m_frame = 0; 278 m_frame = 0;
278 279
279 // This one puts an entry in the main help screen 280 // This one puts an entry in the main help screen
280// m_scene.AddCommand("Regions", this, "sun", "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null); 281// m_scene.AddCommand("Regions", this, "sun", "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null);
281 282
282 // This one enables the ability to type just "sun" without any parameters
283// m_scene.AddCommand("Regions", this, "sun", "", "", HandleSunConsoleCommand);
284 foreach (KeyValuePair<string, string> kvp in GetParamList())
285 {
286 string sunCommand = string.Format("sun {0}", kvp.Key);
287 m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} [<value>]", sunCommand), kvp.Value, "", HandleSunConsoleCommand);
288 }
289
290 TimeZone local = TimeZone.CurrentTimeZone; 283 TimeZone local = TimeZone.CurrentTimeZone;
291 TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; 284 TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks;
292 m_log.DebugFormat("[SUN]: localtime offset is {0}", TicksUTCOffset); 285 m_log.DebugFormat("[SUN]: localtime offset is {0}", TicksUTCOffset);
@@ -358,15 +351,6 @@ namespace OpenSim.Region.CoreModules
358 HorizonShift = m_HorizonShift; // Z axis translation 351 HorizonShift = m_HorizonShift; // Z axis translation
359 // HoursToRadians = (SunCycle/24)*VWTimeRatio; 352 // HoursToRadians = (SunCycle/24)*VWTimeRatio;
360 353
361 // Insert our event handling hooks
362
363 scene.EventManager.OnFrame += SunUpdate;
364 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
365 scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate;
366 scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour;
367
368 ready = true;
369
370 m_log.Debug("[SUN]: Mode is " + m_RegionMode); 354 m_log.Debug("[SUN]: Mode is " + m_RegionMode);
371 m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days"); 355 m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days");
372 m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift); 356 m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift);
@@ -376,14 +360,37 @@ namespace OpenSim.Region.CoreModules
376 break; 360 break;
377 } 361 }
378 362
379 scene.RegisterModuleInterface<ISunModule>(this);
380 } 363 }
381 364
382 public void PostInitialise() 365 public Type ReplaceableInterface
383 { 366 {
367 get { return null; }
384 } 368 }
385 369
386 public void Close() 370 public void AddRegion(Scene scene)
371 {
372 m_scene = scene;
373 // Insert our event handling hooks
374
375 scene.EventManager.OnFrame += SunUpdate;
376 scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel;
377 scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate;
378 scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour;
379
380 scene.RegisterModuleInterface<ISunModule>(this);
381
382 // This one enables the ability to type just "sun" without any parameters
383 // m_scene.AddCommand("Regions", this, "sun", "", "", HandleSunConsoleCommand);
384 foreach (KeyValuePair<string, string> kvp in GetParamList())
385 {
386 string sunCommand = string.Format("sun {0}", kvp.Key);
387 m_scene.AddCommand("Regions", this, sunCommand, string.Format("{0} [<value>]", sunCommand), kvp.Value, "", HandleSunConsoleCommand);
388 }
389
390 ready = true;
391 }
392
393 public void RemoveRegion(Scene scene)
387 { 394 {
388 ready = false; 395 ready = false;
389 396
@@ -394,14 +401,17 @@ namespace OpenSim.Region.CoreModules
394 m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; 401 m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour;
395 } 402 }
396 403
397 public string Name 404 public void RegionLoaded(Scene scene)
398 { 405 {
399 get { return "SunModule"; }
400 } 406 }
401 407
402 public bool IsSharedModule 408 public void Close()
403 { 409 {
404 get { return false; } 410 }
411
412 public string Name
413 {
414 get { return "SunModule"; }
405 } 415 }
406 416
407 #endregion 417 #endregion
diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
index 4694b14..52b4313 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs
@@ -33,6 +33,7 @@ using System.Net;
33using log4net; 33using log4net;
34using Nini.Config; 34using Nini.Config;
35using OpenMetaverse; 35using OpenMetaverse;
36using Mono.Addins;
36using OpenSim.Framework; 37using OpenSim.Framework;
37using OpenSim.Region.CoreModules.Framework.InterfaceCommander; 38using OpenSim.Region.CoreModules.Framework.InterfaceCommander;
38using OpenSim.Region.CoreModules.World.Terrain.FileLoaders; 39using OpenSim.Region.CoreModules.World.Terrain.FileLoaders;
@@ -43,6 +44,7 @@ using OpenSim.Region.Framework.Scenes;
43 44
44namespace OpenSim.Region.CoreModules.World.Terrain 45namespace OpenSim.Region.CoreModules.World.Terrain
45{ 46{
47 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "TerrainModule")]
46 public class TerrainModule : INonSharedRegionModule, ICommandableModule, ITerrainModule 48 public class TerrainModule : INonSharedRegionModule, ICommandableModule, ITerrainModule
47 { 49 {
48 #region StandardTerrainEffects enum 50 #region StandardTerrainEffects enum
diff --git a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
index 3d4f762..be719ea 100644
--- a/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
+++ b/OpenSim/Region/CoreModules/World/Terrain/Tests/TerrainTest.cs
@@ -30,11 +30,12 @@ using NUnit.Framework;
30using OpenSim.Framework; 30using OpenSim.Framework;
31using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes; 31using OpenSim.Region.CoreModules.World.Terrain.PaintBrushes;
32using OpenSim.Region.Framework.Scenes; 32using OpenSim.Region.Framework.Scenes;
33using OpenSim.Tests.Common;
33 34
34namespace OpenSim.Region.CoreModules.World.Terrain.Tests 35namespace OpenSim.Region.CoreModules.World.Terrain.Tests
35{ 36{
36 [TestFixture] 37 [TestFixture]
37 public class TerrainTest 38 public class TerrainTest : OpenSimTestCase
38 { 39 {
39 [Test] 40 [Test]
40 public void BrushTest() 41 public void BrushTest()
diff --git a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
index f5f35bb..3f5d375 100644
--- a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
+++ b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs
@@ -28,15 +28,17 @@
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;
34using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
36 37
37namespace OpenSim.Region.CoreModules.Avatar.Vegetation 38namespace OpenSim.Region.CoreModules.World.Vegetation
38{ 39{
39 public class VegetationModule : IRegionModule, IVegetationModule 40 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "VegetationModule")]
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,16 +47,32 @@ 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 }
53 59
54 public void PostInitialise() {} 60 public void RemoveRegion(Scene scene)
61 {
62 m_scene.UnregisterModuleInterface<IVegetationModule>(this);
63 }
64
55 public void Close() {} 65 public void Close() {}
56 public string Name { get { return "Vegetation Module"; } } 66 public string Name { get { return "Vegetation Module"; } }
57 public bool IsSharedModule { get { return false; } } 67
68 public Type ReplaceableInterface
69 {
70 get { return null; }
71 }
72
73 public void RegionLoaded(Scene scene)
74 {
75 }
58 76
59 public SceneObjectGroup AddTree( 77 public SceneObjectGroup AddTree(
60 UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree) 78 UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree)
diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
index 2d762fb..5e0dfa7 100644
--- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
+++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs
@@ -35,6 +35,7 @@ using CSJ2K;
35using Nini.Config; 35using Nini.Config;
36using log4net; 36using log4net;
37using Rednettle.Warp3D; 37using Rednettle.Warp3D;
38using Mono.Addins;
38using OpenMetaverse; 39using OpenMetaverse;
39using OpenMetaverse.Imaging; 40using OpenMetaverse.Imaging;
40using OpenMetaverse.Rendering; 41using OpenMetaverse.Rendering;
@@ -49,6 +50,7 @@ using WarpRenderer = global::Warp3D.Warp3D;
49 50
50namespace OpenSim.Region.CoreModules.World.Warp3DMap 51namespace OpenSim.Region.CoreModules.World.Warp3DMap
51{ 52{
53 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "Warp3DImageModule")]
52 public class Warp3DImageModule : IMapImageGenerator, INonSharedRegionModule 54 public class Warp3DImageModule : IMapImageGenerator, INonSharedRegionModule
53 { 55 {
54 private static readonly UUID TEXTURE_METADATA_MAGIC = new UUID("802dc0e0-f080-4931-8b57-d1be8611c4f3"); 56 private static readonly UUID TEXTURE_METADATA_MAGIC = new UUID("802dc0e0-f080-4931-8b57-d1be8611c4f3");
@@ -63,7 +65,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
63 private bool m_useAntiAliasing = false; // TODO: Make this a config option 65 private bool m_useAntiAliasing = false; // TODO: Make this a config option
64 private bool m_Enabled = false; 66 private bool m_Enabled = false;
65 67
66 #region IRegionModule Members 68 #region Region Module interface
67 69
68 public void Initialise(IConfigSource source) 70 public void Initialise(IConfigSource source)
69 { 71 {
diff --git a/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs b/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs
index 9d47e19..6af4050 100644
--- a/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/Plugins/ConfigurableWind.cs
@@ -31,12 +31,14 @@ using System.Reflection;
31 31
32using log4net; 32using log4net;
33using OpenMetaverse; 33using OpenMetaverse;
34using Mono.Addins;
34 35
35using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.CoreModules.World.Wind; 37using OpenSim.Region.CoreModules.World.Wind;
37 38
38namespace OpenSim.Region.CoreModules.World.Wind.Plugins 39namespace OpenSim.Region.CoreModules.World.Wind.Plugins
39{ 40{
41 [Extension(Path = "/OpenSim/WindModule", NodeName = "WindModel", Id = "ConfigurableWind")]
40 class ConfigurableWind : Mono.Addins.TypeExtensionNode, IWindModelPlugin 42 class ConfigurableWind : Mono.Addins.TypeExtensionNode, IWindModelPlugin
41 { 43 {
42 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 44 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
diff --git a/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs b/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs
index 071e20b..fcb0c10 100644
--- a/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/Plugins/SimpleRandomWind.cs
@@ -29,11 +29,13 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30 30
31using OpenMetaverse; 31using OpenMetaverse;
32using Mono.Addins;
32 33
33using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
34 35
35namespace OpenSim.Region.CoreModules.World.Wind.Plugins 36namespace OpenSim.Region.CoreModules.World.Wind.Plugins
36{ 37{
38 [Extension(Path = "/OpenSim/WindModule", NodeName = "WindModel", Id = "SimpleRandomWind")]
37 class SimpleRandomWind : Mono.Addins.TypeExtensionNode, IWindModelPlugin 39 class SimpleRandomWind : Mono.Addins.TypeExtensionNode, IWindModelPlugin
38 { 40 {
39 private Vector2[] m_windSpeeds = new Vector2[16 * 16]; 41 private Vector2[] m_windSpeeds = new Vector2[16 * 16];
diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
index 7b6fbda..9de588c 100644
--- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
+++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs
@@ -40,6 +40,7 @@ using OpenSim.Region.CoreModules.World.Wind;
40 40
41namespace OpenSim.Region.CoreModules 41namespace OpenSim.Region.CoreModules
42{ 42{
43 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WindModule")]
43 public class WindModule : IWindModule 44 public class WindModule : IWindModule
44 { 45 {
45 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -52,31 +53,31 @@ namespace OpenSim.Region.CoreModules
52 private bool m_ready = false; 53 private bool m_ready = false;
53 54
54 private bool m_enabled = false; 55 private bool m_enabled = false;
55 56 private IConfig m_windConfig;
56 private IWindModelPlugin m_activeWindPlugin = null; 57 private IWindModelPlugin m_activeWindPlugin = null;
57 private const string m_dWindPluginName = "SimpleRandomWind"; 58 private string m_dWindPluginName = "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];
62 63
63 #region IRegion Methods 64 #region INonSharedRegionModule Methods
64 65
65 public void Initialise(Scene scene, IConfigSource config) 66 public void Initialise(IConfigSource config)
66 { 67 {
67 IConfig windConfig = config.Configs["Wind"]; 68 m_windConfig = config.Configs["Wind"];
68 string desiredWindPlugin = m_dWindPluginName; 69// string desiredWindPlugin = m_dWindPluginName;
69 70
70 if (windConfig != null) 71 if (m_windConfig != null)
71 { 72 {
72 m_enabled = windConfig.GetBoolean("enabled", true); 73 m_enabled = m_windConfig.GetBoolean("enabled", true);
73 74
74 m_frameUpdateRate = windConfig.GetInt("wind_update_rate", 150); 75 m_frameUpdateRate = m_windConfig.GetInt("wind_update_rate", 150);
75 76
76 // Determine which wind model plugin is desired 77 // Determine which wind model plugin is desired
77 if (windConfig.Contains("wind_plugin")) 78 if (m_windConfig.Contains("wind_plugin"))
78 { 79 {
79 desiredWindPlugin = windConfig.GetString("wind_plugin"); 80 m_dWindPluginName = m_windConfig.GetString("wind_plugin", m_dWindPluginName);
80 } 81 }
81 } 82 }
82 83
@@ -84,104 +85,111 @@ namespace OpenSim.Region.CoreModules
84 { 85 {
85 m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate); 86 m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate);
86 87
87 m_scene = scene; 88 }
88 m_frame = 0;
89
90 // Register all the Wind Model Plug-ins
91 foreach (IWindModelPlugin windPlugin in AddinManager.GetExtensionObjects("/OpenSim/WindModule", false))
92 {
93 m_log.InfoFormat("[WIND] Found Plugin: {0}", windPlugin.Name);
94 m_availableWindPlugins.Add(windPlugin.Name, windPlugin);
95 }
96 89
97 // Check for desired plugin 90 }
98 if (m_availableWindPlugins.ContainsKey(desiredWindPlugin))
99 {
100 m_activeWindPlugin = m_availableWindPlugins[desiredWindPlugin];
101 91
102 m_log.InfoFormat("[WIND] {0} plugin found, initializing.", desiredWindPlugin); 92 public void AddRegion(Scene scene)
93 {
94 if (!m_enabled)
95 return;
103 96
104 if (windConfig != null) 97 m_scene = scene;
105 { 98 m_frame = 0;
106 m_activeWindPlugin.Initialise();
107 m_activeWindPlugin.WindConfig(m_scene, windConfig);
108 }
109 }
110 99
100 // Register all the Wind Model Plug-ins
101 foreach (IWindModelPlugin windPlugin in AddinManager.GetExtensionObjects("/OpenSim/WindModule", false))
102 {
103 m_log.InfoFormat("[WIND] Found Plugin: {0}", windPlugin.Name);
104 m_availableWindPlugins.Add(windPlugin.Name, windPlugin);
105 }
111 106
112 // if the plug-in wasn't found, default to no wind. 107 // Check for desired plugin
113 if (m_activeWindPlugin == null) 108 if (m_availableWindPlugins.ContainsKey(m_dWindPluginName))
114 { 109 {
115 m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", desiredWindPlugin); 110 m_activeWindPlugin = m_availableWindPlugins[m_dWindPluginName];
116 m_log.ErrorFormat("[WIND] Defaulting to no wind.");
117 }
118 111
119 // This one puts an entry in the main help screen 112 m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_dWindPluginName);
120// m_scene.AddCommand("Regions", this, "wind", "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null);
121
122 // This one enables the ability to type just the base command without any parameters
123// m_scene.AddCommand("Regions", this, "wind", "", "", HandleConsoleCommand);
124 113
125 // Get a list of the parameters for each plugin 114 if (m_windConfig != null)
126 foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values)
127 { 115 {
128// m_scene.AddCommand("Regions", this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); 116 m_activeWindPlugin.Initialise();
129 m_scene.AddCommand( 117 m_activeWindPlugin.WindConfig(m_scene, m_windConfig);
130 "Regions",
131 this,
132 "wind base wind_update_rate",
133 "wind base wind_update_rate [<value>]",
134 "Get or set the wind update rate.",
135 "",
136 HandleConsoleBaseCommand);
137
138 foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams())
139 {
140 string windCommand = String.Format("wind {0} {1}", windPlugin.Name, kvp.Key);
141 m_scene.AddCommand("Regions", this, windCommand, string.Format("{0} [<value>]", windCommand), kvp.Value, "", HandleConsoleParamCommand);
142 }
143 } 118 }
119 }
144 120
145 // Register event handlers for when Avatars enter the region, and frame ticks
146 m_scene.EventManager.OnFrame += WindUpdate;
147 m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion;
148 121
149 // Register the wind module 122 // if the plug-in wasn't found, default to no wind.
150 m_scene.RegisterModuleInterface<IWindModule>(this); 123 if (m_activeWindPlugin == null)
124 {
125 m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", m_dWindPluginName);
126 m_log.ErrorFormat("[WIND] Defaulting to no wind.");
127 }
151 128
152 // Generate initial wind values 129 // This one puts an entry in the main help screen
153 GenWindPos(); 130 // m_scene.AddCommand("Regions", this, "wind", "wind", "Usage: wind <plugin> <param> [value] - Get or Update Wind paramaters", null);
154 131
155 // Mark Module Ready for duty 132 // This one enables the ability to type just the base command without any parameters
156 m_ready = true; 133 // m_scene.AddCommand("Regions", this, "wind", "", "", HandleConsoleCommand);
157 134
135 // Get a list of the parameters for each plugin
136 foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values)
137 {
138 // m_scene.AddCommand("Regions", this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand);
139 m_scene.AddCommand(
140 "Regions",
141 this,
142 "wind base wind_update_rate",
143 "wind base wind_update_rate [<value>]",
144 "Get or set the wind update rate.",
145 "",
146 HandleConsoleBaseCommand);
147
148 foreach (KeyValuePair<string, string> kvp in windPlugin.WindParams())
149 {
150 string windCommand = String.Format("wind {0} {1}", windPlugin.Name, kvp.Key);
151 m_scene.AddCommand("Regions", this, windCommand, string.Format("{0} [<value>]", windCommand), kvp.Value, "", HandleConsoleParamCommand);
152 }
158 } 153 }
159 154
160 } 155 // Register event handlers for when Avatars enter the region, and frame ticks
156 m_scene.EventManager.OnFrame += WindUpdate;
157 m_scene.EventManager.OnMakeRootAgent += OnAgentEnteredRegion;
161 158
162 public void PostInitialise() 159 // Register the wind module
163 { 160 m_scene.RegisterModuleInterface<IWindModule>(this);
161
162 // Generate initial wind values
163 GenWindPos();
164
165 // Mark Module Ready for duty
166 m_ready = true;
164 } 167 }
165 168
166 public void Close() 169 public void RemoveRegion(Scene scene)
167 { 170 {
168 if (m_enabled) 171 if (!m_enabled)
172 return;
173
174 m_ready = false;
175
176 // REVIEW: If a region module is closed, is there a possibility that it'll re-open/initialize ??
177 m_activeWindPlugin = null;
178 foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values)
169 { 179 {
170 m_ready = false; 180 windPlugin.Dispose();
181 }
171 182
172 // REVIEW: If a region module is closed, is there a possibility that it'll re-open/initialize ?? 183 m_availableWindPlugins.Clear();
173 m_activeWindPlugin = null;
174 foreach (IWindModelPlugin windPlugin in m_availableWindPlugins.Values)
175 {
176 windPlugin.Dispose();
177 }
178 184
179 m_availableWindPlugins.Clear(); 185 // Remove our hooks
186 m_scene.EventManager.OnFrame -= WindUpdate;
187 m_scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion;
180 188
181 // Remove our hooks 189 }
182 m_scene.EventManager.OnFrame -= WindUpdate; 190
183 m_scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion; 191 public void Close()
184 } 192 {
185 } 193 }
186 194
187 public string Name 195 public string Name
@@ -189,11 +197,14 @@ namespace OpenSim.Region.CoreModules
189 get { return "WindModule"; } 197 get { return "WindModule"; }
190 } 198 }
191 199
192 public bool IsSharedModule 200 public Type ReplaceableInterface
193 { 201 {
194 get { return false; } 202 get { return null; }
195 } 203 }
196 204
205 public void RegionLoaded(Scene scene)
206 {
207 }
197 208
198 #endregion 209 #endregion
199 210
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
index f37dd94..708a9a2 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs
@@ -24,11 +24,13 @@
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 */
27using System;
27using System.Collections.Generic; 28using System.Collections.Generic;
28using System.Reflection; 29using System.Reflection;
29using log4net; 30using log4net;
30using Nini.Config; 31using Nini.Config;
31using OpenMetaverse; 32using OpenMetaverse;
33using Mono.Addins;
32using OpenSim.Framework; 34using OpenSim.Framework;
33using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
34using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
@@ -37,16 +39,22 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
37 39
38namespace OpenSim.Region.CoreModules.World.WorldMap 40namespace OpenSim.Region.CoreModules.World.WorldMap
39{ 41{
40 public class MapSearchModule : IRegionModule 42 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "MapSearchModule")]
43 public class MapSearchModule : ISharedRegionModule
41 { 44 {
42 private static readonly ILog m_log = 45 private static readonly ILog m_log =
43 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 47
45 Scene m_scene = null; // only need one for communication with GridService 48 Scene m_scene = null; // only need one for communication with GridService
46 List<Scene> m_scenes = new List<Scene>(); 49 List<Scene> m_scenes = new List<Scene>();
50 List<UUID> m_Clients;
47 51
48 #region IRegionModule Members 52 #region ISharedRegionModule Members
49 public void Initialise(Scene scene, IConfigSource source) 53 public void Initialise(IConfigSource source)
54 {
55 }
56
57 public void AddRegion(Scene scene)
50 { 58 {
51 if (m_scene == null) 59 if (m_scene == null)
52 { 60 {
@@ -55,6 +63,16 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
55 63
56 m_scenes.Add(scene); 64 m_scenes.Add(scene);
57 scene.EventManager.OnNewClient += OnNewClient; 65 scene.EventManager.OnNewClient += OnNewClient;
66 m_Clients = new List<UUID>();
67 }
68
69 public void RemoveRegion(Scene scene)
70 {
71 m_scenes.Remove(scene);
72 if (m_scene == scene && m_scenes.Count > 0)
73 m_scene = m_scenes[0];
74
75 scene.EventManager.OnNewClient -= OnNewClient;
58 } 76 }
59 77
60 public void PostInitialise() 78 public void PostInitialise()
@@ -72,26 +90,59 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
72 get { return "MapSearchModule"; } 90 get { return "MapSearchModule"; }
73 } 91 }
74 92
75 public bool IsSharedModule 93 public Type ReplaceableInterface
76 { 94 {
77 get { return true; } 95 get { return null; }
78 } 96 }
79 97
98 public void RegionLoaded(Scene scene)
99 {
100 }
80 #endregion 101 #endregion
81 102
82 private void OnNewClient(IClientAPI client) 103 private void OnNewClient(IClientAPI client)
83 { 104 {
84 client.OnMapNameRequest += OnMapNameRequest; 105 client.OnMapNameRequest += OnMapNameRequestHandler;
106 }
107
108 private void OnMapNameRequestHandler(IClientAPI remoteClient, string mapName, uint flags)
109 {
110 lock (m_Clients)
111 {
112 if (m_Clients.Contains(remoteClient.AgentId))
113 return;
114
115 m_Clients.Add(remoteClient.AgentId);
116 }
117
118 try
119 {
120 OnMapNameRequest(remoteClient, mapName, flags);
121 }
122 finally
123 {
124 lock (m_Clients)
125 m_Clients.Remove(remoteClient.AgentId);
126 }
85 } 127 }
86 128
87 private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags) 129 private void OnMapNameRequest(IClientAPI remoteClient, string mapName, uint flags)
88 { 130 {
89 if (mapName.Length < 3) 131 List<MapBlockData> blocks = new List<MapBlockData>();
132 MapBlockData data;
133 if (mapName.Length < 3 || (mapName.EndsWith("#") && mapName.Length < 4))
90 { 134 {
135 // final block, closing the search result
136 AddFinalBlock(blocks);
137
138 // flags are agent flags sent from the viewer.
139 // they have different values depending on different viewers, apparently
140 remoteClient.SendMapBlock(blocks, flags);
91 remoteClient.SendAlertMessage("Use a search string with at least 3 characters"); 141 remoteClient.SendAlertMessage("Use a search string with at least 3 characters");
92 return; 142 return;
93 } 143 }
94 144
145
95 //m_log.DebugFormat("MAP NAME=({0})", mapName); 146 //m_log.DebugFormat("MAP NAME=({0})", mapName);
96 147
97 // Hack to get around the fact that ll V3 now drops the port from the 148 // Hack to get around the fact that ll V3 now drops the port from the
@@ -112,13 +163,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
112 163
113 // try to fetch from GridServer 164 // try to fetch from GridServer
114 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20); 165 List<GridRegion> regionInfos = m_scene.GridService.GetRegionsByName(m_scene.RegionInfo.ScopeID, mapName, 20);
115 if (regionInfos.Count == 0)
116 remoteClient.SendAlertMessage("Hyperlink could not be established.");
117 166
118 m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags); 167 m_log.DebugFormat("[MAPSEARCHMODULE]: search {0} returned {1} regions. Flags={2}", mapName, regionInfos.Count, flags);
119 List<MapBlockData> blocks = new List<MapBlockData>();
120
121 MapBlockData data;
122 if (regionInfos.Count > 0) 168 if (regionInfos.Count > 0)
123 { 169 {
124 foreach (GridRegion info in regionInfos) 170 foreach (GridRegion info in regionInfos)
@@ -145,16 +191,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
145 } 191 }
146 192
147 // final block, closing the search result 193 // final block, closing the search result
148 data = new MapBlockData(); 194 AddFinalBlock(blocks);
149 data.Agents = 0;
150 data.Access = 255;
151 data.MapImageId = UUID.Zero;
152 data.Name = ""; // mapName;
153 data.RegionFlags = 0;
154 data.WaterHeight = 0; // not used
155 data.X = 0;
156 data.Y = 0;
157 blocks.Add(data);
158 195
159 // flags are agent flags sent from the viewer. 196 // flags are agent flags sent from the viewer.
160 // they have different values depending on different viewers, apparently 197 // they have different values depending on different viewers, apparently
@@ -166,12 +203,26 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
166 if (flags == 2) 203 if (flags == 2)
167 { 204 {
168 if (regionInfos.Count == 0) 205 if (regionInfos.Count == 0)
169 remoteClient.SendAgentAlertMessage("No regions found with that name.", true); 206 remoteClient.SendAlertMessage("No regions found with that name.");
170 else if (regionInfos.Count == 1) 207 else if (regionInfos.Count == 1)
171 remoteClient.SendAgentAlertMessage("Region found!", false); 208 remoteClient.SendAlertMessage("Region found!");
172 } 209 }
173 } 210 }
174 211
212 private void AddFinalBlock(List<MapBlockData> blocks)
213 {
214 // final block, closing the search result
215 MapBlockData data = new MapBlockData();
216 data.Agents = 0;
217 data.Access = 255;
218 data.MapImageId = UUID.Zero;
219 data.Name = "";
220 data.RegionFlags = 0;
221 data.WaterHeight = 0; // not used
222 data.X = 0;
223 data.Y = 0;
224 blocks.Add(data);
225 }
175// private Scene GetClientScene(IClientAPI client) 226// private Scene GetClientScene(IClientAPI client)
176// { 227// {
177// foreach (Scene s in m_scenes) 228// foreach (Scene s in m_scenes)
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index dfba3ff..e2f525c 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -40,6 +40,7 @@ using Nini.Config;
40using OpenMetaverse; 40using OpenMetaverse;
41using OpenMetaverse.Imaging; 41using OpenMetaverse.Imaging;
42using OpenMetaverse.StructuredData; 42using OpenMetaverse.StructuredData;
43using Mono.Addins;
43using OpenSim.Framework; 44using OpenSim.Framework;
44using OpenSim.Framework.Capabilities; 45using OpenSim.Framework.Capabilities;
45using OpenSim.Framework.Monitoring; 46using OpenSim.Framework.Monitoring;
@@ -55,6 +56,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion;
55 56
56namespace OpenSim.Region.CoreModules.World.WorldMap 57namespace OpenSim.Region.CoreModules.World.WorldMap
57{ 58{
59 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "WorldMapModule")]
58 public class WorldMapModule : INonSharedRegionModule, IWorldMapModule 60 public class WorldMapModule : INonSharedRegionModule, IWorldMapModule
59 { 61 {
60 private static readonly ILog m_log = 62 private static readonly ILog m_log =