From f9807884a425c2d91e8f2035993a0ca5e210eb43 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 25 Nov 2009 15:28:43 +0000 Subject: Add MIT/X11 licensed NDesk.Options (http://www.ndesk.org/Options) DLL to aid command line parsing --- OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 181f4c6..98fdec3 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs @@ -26,9 +26,11 @@ */ using System; +using System.Collections.Generic; using System.IO; using System.Reflection; using log4net; +using NDesk.Options; using Nini.Config; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -91,7 +93,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// public void HandleLoadOarConsoleCommand(string module, string[] cmdparams) { - if (cmdparams.Length > 2) + OptionSet options = new OptionSet() {}; + List mainParams = options.Parse(cmdparams); + + foreach (string param in mainParams) + m_log.DebugFormat("Found param [{0}]", param); + + if (mainParams.Count > 2) { DearchiveRegion(cmdparams[2]); } -- cgit v1.1 From c18422ad3a09cfabd86eb86403a77a6c720980f0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 25 Nov 2009 16:02:47 +0000 Subject: Implement oar merging An oar can now be merged with existing region contents by using the --merge option For example, load oar --merge my.oar Existing terrain, region settings and parcel data is left in place when an oar is merged. See http://opensimulator.org/wiki/OpenSim_Archives#Usage for more information --- .../Region/CoreModules/World/Archiver/ArchiverModule.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 98fdec3..27763bb 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs @@ -93,19 +93,23 @@ namespace OpenSim.Region.CoreModules.World.Archiver /// public void HandleLoadOarConsoleCommand(string module, string[] cmdparams) { - OptionSet options = new OptionSet() {}; + bool mergeOar = false; + + OptionSet options = new OptionSet().Add("m|merge", delegate (string v) { mergeOar = v != null; }); List mainParams = options.Parse(cmdparams); - - foreach (string param in mainParams) - m_log.DebugFormat("Found param [{0}]", param); + +// m_log.DebugFormat("MERGE OAR IS [{0}]", mergeOar); +// +// foreach (string param in mainParams) +// m_log.DebugFormat("GOT PARAM [{0}]", param); if (mainParams.Count > 2) { - DearchiveRegion(cmdparams[2]); + DearchiveRegion(mainParams[2], mergeOar, Guid.Empty); } else { - DearchiveRegion(DEFAULT_OAR_BACKUP_FILENAME); + DearchiveRegion(DEFAULT_OAR_BACKUP_FILENAME, mergeOar, Guid.Empty); } } -- cgit v1.1 From a4d2a97bc6ead3aeba4e1be419d976925e5ee470 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 25 Nov 2009 16:14:08 +0000 Subject: minor: remove some mono compiler warnings, add --merge load oar switch to help information --- OpenSim/Region/Application/HGCommands.cs | 2 +- OpenSim/Region/Application/OpenSim.cs | 2 +- OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/HGCommands.cs b/OpenSim/Region/Application/HGCommands.cs index f503db7..7ae161d 100644 --- a/OpenSim/Region/Application/HGCommands.cs +++ b/OpenSim/Region/Application/HGCommands.cs @@ -42,7 +42,7 @@ namespace OpenSim { public class HGCommands { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); public static Scene CreateScene(RegionInfo regionInfo, AgentCircuitManager circuitManager, CommunicationsManager m_commsManager, StorageManager storageManager, ModuleLoader m_moduleLoader, ConfigSettings m_configSettings, OpenSimConfigSource m_config, string m_version) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index f9be1e2..5228e4b 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -232,7 +232,7 @@ namespace OpenSim "Save named prim to XML2", SavePrimsXml2); m_console.Commands.AddCommand("region", false, "load oar", - "load oar ", + "load oar [--merge] ", "Load a region's data from OAR archive", LoadOar); m_console.Commands.AddCommand("region", false, "save oar", diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index cd59bdb..f4da910 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -57,7 +57,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat #region ISharedRegionModule Members public virtual void Initialise(IConfigSource config) { - m_config = config.Configs["Chat"]; if (null == m_config) -- cgit v1.1 From 40464f6cc6ffc04bb5e4ede3d832e1cde75e9b5b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 25 Nov 2009 16:23:37 +0000 Subject: Change chat config code so that enabled = false actually does disable the chat module --- OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs index f4da910..6dacbba 100644 --- a/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Chat/ChatModule.cs @@ -62,15 +62,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Chat if (null == m_config) { m_log.Info("[CHAT]: no config found, plugin disabled"); + m_enabled = false; return; } - if (!m_config.GetBoolean("enabled", false)) + if (!m_config.GetBoolean("enabled", true)) { m_log.Info("[CHAT]: plugin disabled by configuration"); + m_enabled = false; return; } - m_enabled = true; m_whisperdistance = config.Configs["Chat"].GetInt("whisper_distance", m_whisperdistance); m_saydistance = config.Configs["Chat"].GetInt("say_distance", m_saydistance); -- cgit v1.1 From 0b380f68d81267550b5adf45e16378e4648df933 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 25 Nov 2009 17:01:41 +0000 Subject: Change osTeleportAgent parameters from long to int. That numerical range is not even supported by the underlying type, so there is no need to ask for a type the script can not even supply. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++-- OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 +- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 7fdbac8..e72fa70 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -636,13 +636,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } // Teleport functions - public void osTeleportAgent(string agent, uint regionX, uint regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) + public void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) { // High because there is no security check. High griefer potential // CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); - ulong regionHandle = Util.UIntsToLong((regionX * (uint)Constants.RegionSize), (regionY * (uint)Constants.RegionSize)); + ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); m_host.AddScriptLPS(1); UUID agentId = new UUID(); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 2a403bf..470946a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -83,7 +83,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces // Teleport commands void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); - void osTeleportAgent(string agent, uint regionX, uint regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); + void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); // Animation commands diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 4928e90..6b88834 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -201,9 +201,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osTeleportAgent(agent, regionName, position, lookat); } - public void osTeleportAgent(string agent, long regionX, long regionY, vector position, vector lookat) + public void osTeleportAgent(string agent, int regionX, int regionY, vector position, vector lookat) { - m_OSSL_Functions.osTeleportAgent(agent, (uint) regionX, (uint) regionY, position, lookat); + m_OSSL_Functions.osTeleportAgent(agent, regionX, regionY, position, lookat); } public void osTeleportAgent(string agent, vector position, vector lookat) -- cgit v1.1 From 59caa68e08691d8fac221e2bd42c712d5bcf69aa Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 25 Nov 2009 17:49:38 +0000 Subject: minor: add doc to a few parcel methods --- .../Archiver/ArchiveWriteRequestPreparation.cs | 10 +++++++++ .../Region/CoreModules/World/Land/LandChannel.cs | 3 ++- .../CoreModules/World/Land/LandManagementModule.cs | 12 ++++++++++- .../Region/Framework/Interfaces/ILandChannel.cs | 25 +++++++++++++++++----- .../RegionCombinerLargeLandChannel.cs | 1 + 5 files changed, 44 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs index f08d8ec..71bfe57 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequestPreparation.cs @@ -93,6 +93,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver List entities = m_scene.GetEntities(); List sceneObjects = new List(); + /* + foreach (ILandObject lo in m_scene.LandChannel.AllParcels()) + { + if (name == lo.LandData.Name) + { + // This is the parcel we want + } + } + */ + // Filter entities so that we only have scene objects. // FIXME: Would be nicer to have this as a proper list in SceneGraph, since lots of methods // end up having to do this diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs index 4ed23bb..81024db 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs @@ -105,7 +105,7 @@ namespace OpenSim.Region.CoreModules.World.Land ILandObject obj = new LandObject(UUID.Zero, false, m_scene); obj.LandData.Name = "NO LAND"; return obj; - } + } public List AllParcels() { @@ -154,6 +154,7 @@ namespace OpenSim.Region.CoreModules.World.Land m_landManagementModule.UpdateLandObject(localID, data); } } + public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient) { if (m_landManagementModule != null) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 968f46a..9a2ef50 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -67,7 +67,14 @@ namespace OpenSim.Region.CoreModules.World.Land private const int landArrayMax = ((int)((int)Constants.RegionSize / 4) >= 64) ? (int)((int)Constants.RegionSize / 4) : 64; #pragma warning restore 0429 + /// + /// Local land ids at specified region co-ordinates (region size / 4) + /// private readonly int[,] m_landIDList = new int[landArrayMax, landArrayMax]; + + /// + /// Land objects keyed by local id + /// private readonly Dictionary m_landList = new Dictionary(); private bool m_landPrimCountTainted; @@ -570,6 +577,7 @@ namespace OpenSim.Region.CoreModules.World.Land if (x_float > Constants.RegionSize || x_float <= 0 || y_float > Constants.RegionSize || y_float <= 0) return null; + try { x = Convert.ToInt32(Math.Floor(Convert.ToDouble(x_float) / 4.0)); @@ -584,6 +592,7 @@ namespace OpenSim.Region.CoreModules.World.Land { return null; } + lock (m_landList) { // Corner case. If an autoreturn happens during sim startup @@ -603,6 +612,7 @@ namespace OpenSim.Region.CoreModules.World.Land // they happen every time at border crossings throw new Exception("Error: Parcel not found at point " + x + ", " + y); } + lock (m_landIDList) { try @@ -617,7 +627,7 @@ namespace OpenSim.Region.CoreModules.World.Land return null; } } - } + } #endregion diff --git a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs index 74f404f..6fe6118 100644 --- a/OpenSim/Region/Framework/Interfaces/ILandChannel.cs +++ b/OpenSim/Region/Framework/Interfaces/ILandChannel.cs @@ -33,26 +33,41 @@ namespace OpenSim.Region.Framework.Interfaces { public interface ILandChannel { - List ParcelsNearPoint(Vector3 position); + /// + /// Get all parcels + /// + /// List AllParcels(); /// - /// Get the land object at the specified point + /// Get the parcel at the specified point /// /// Value between 0 - 256 on the x axis of the point /// Value between 0 - 256 on the y axis of the point /// Land object at the point supplied ILandObject GetLandObject(int x, int y); - ILandObject GetLandObject(int localID); - /// - /// Get the land object at the specified point + /// Get the parcel at the specified point /// /// Value between 0 - 256 on the x axis of the point /// Value between 0 - 256 on the y axis of the point /// Land object at the point supplied ILandObject GetLandObject(float x, float y); + + /// + /// Get the parcels near the specified point + /// + /// + /// + List ParcelsNearPoint(Vector3 position); + + /// + /// Get the parcel given the land's local id. + /// + /// + /// + ILandObject GetLandObject(int localID); bool IsLandPrimCountTainted(); bool IsForcefulBansAllowed(); diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs index 146ec66..9da818a 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerLargeLandChannel.cs @@ -118,6 +118,7 @@ public class RegionCombinerLargeLandChannel : ILandChannel return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY); } } + ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene); obj.LandData.Name = "NO LAND"; return obj; -- cgit v1.1