From e712678689f37f7a58e02547a5dbe6a214680db2 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Mon, 14 Jul 2008 01:27:47 +0000 Subject: Patch #9147 Patch #4 of the region settings series. Partial functionality of the new storage system. More patches to follow. --- OpenSim/Framework/EstateSettings.cs | 162 --------------------- OpenSim/Framework/RegionSettings.cs | 2 +- .../Region/ClientStack/RegionApplicationBase.cs | 2 +- .../Communications/Local/LocalBackEndServices.cs | 2 +- OpenSim/Region/DataSnapshot/SnapshotStore.cs | 4 +- .../Region/Environment/Interfaces/IEstateModule.cs | 38 +++++ .../Modules/World/Estate/EstateManagementModule.cs | 132 +++++++++-------- .../Environment/Modules/World/Land/LandObject.cs | 14 +- .../Modules/World/Terrain/TerrainModule.cs | 4 +- OpenSim/Region/Environment/Scenes/Scene.cs | 25 +--- .../Scenes/SceneObjectGroup.Inventory.cs | 2 +- .../Scenes/SceneObjectPart.Inventory.cs | 2 +- .../Region/Environment/Scenes/SimStatsReporter.cs | 11 +- .../ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 17 ++- .../Shared/Api/Implementation/LSL_Api.cs | 17 ++- 15 files changed, 163 insertions(+), 271 deletions(-) create mode 100644 OpenSim/Region/Environment/Interfaces/IEstateModule.cs diff --git a/OpenSim/Framework/EstateSettings.cs b/OpenSim/Framework/EstateSettings.cs index aa8688b..35ade66 100644 --- a/OpenSim/Framework/EstateSettings.cs +++ b/OpenSim/Framework/EstateSettings.cs @@ -53,17 +53,11 @@ namespace OpenSim.Framework private LLUUID m_estateManager8; private LLUUID m_estateManager9; private string m_estateName; - private byte m_maxAgents; - private float m_objectBonusFactor; private uint m_parentEstateID; private int m_pricePerMeter; private int m_redirectGridX; private int m_redirectGridY; - private bool m_regionAllowTerraform; - private Simulator.RegionFlags m_regionFlags; - private float m_regionWaterHeight; - private Simulator.SimAccess m_simAccess; private float m_sunHour; private LLVector3 m_sunPosition; private LLUUID m_terrainBase0; @@ -80,15 +74,11 @@ namespace OpenSim.Framework private float m_terrainHeightRange2; private float m_terrainHeightRange3; private LLUUID m_terrainImageID; - private float m_terrainLowerLimit; private double m_terrainMultiplier; - private float m_terrainRaiseLimit; private float m_terrainStartHeight0; private float m_terrainStartHeight1; private float m_terrainStartHeight2; private float m_terrainStartHeight3; - private bool m_useFixedSun; - private float m_waterHeight; public EstateSettings() { @@ -132,26 +122,6 @@ namespace OpenSim.Framework } } - public byte maxAgents - { - get { return m_maxAgents; } - set - { - m_maxAgents = value; - configMember.forceSetConfigurationOption("max_agents", m_maxAgents.ToString()); - } - } - - public float objectBonusFactor - { - get { return m_objectBonusFactor; } - set - { - m_objectBonusFactor = value; - configMember.forceSetConfigurationOption("object_bonus_factor", m_objectBonusFactor.ToString()); - } - } - public int redirectGridX { get { return m_redirectGridX; } @@ -172,36 +142,12 @@ namespace OpenSim.Framework } } - public Simulator.RegionFlags regionFlags - { - get { return m_regionFlags; } - set - { - //m_regionFlags = (Simulator.RegionFlags)0x400000; - m_regionFlags = value; - configMember.forceSetConfigurationOption("region_flags", ((uint) m_regionFlags).ToString()); - } - } - - public Simulator.SimAccess simAccess - { - get { return m_simAccess; } - set - { - m_simAccess = value; - configMember.forceSetConfigurationOption("sim_access", ((byte) m_simAccess).ToString()); - } - } - public float sunHour { get { return m_sunHour; } set { m_sunHour = value; - - if (useFixedSun) - configMember.forceSetConfigurationOption("sun_hour", m_sunHour.ToString()); } } @@ -215,36 +161,6 @@ namespace OpenSim.Framework } } - public float terrainRaiseLimit - { - get { return m_terrainRaiseLimit; } - set - { - m_terrainRaiseLimit = value; - configMember.forceSetConfigurationOption("terrain_raise_limit", m_terrainRaiseLimit.ToString()); - } - } - - public float terrainLowerLimit - { - get { return m_terrainLowerLimit; } - set - { - m_terrainLowerLimit = value; - configMember.forceSetConfigurationOption("terrain_lower_limit", m_terrainLowerLimit.ToString()); - } - } - - public bool useFixedSun - { - get { return m_useFixedSun; } - set - { - m_useFixedSun = value; - configMember.forceSetConfigurationOption("use_fixed_sun", m_useFixedSun.ToString()); - } - } - public int pricePerMeter { get { return m_pricePerMeter; } @@ -256,28 +172,6 @@ namespace OpenSim.Framework } - public float regionWaterHeight - { - get { return m_regionWaterHeight; } - set - { - m_regionWaterHeight = value; - configMember.forceSetConfigurationOption("region_water_height", m_regionWaterHeight.ToString()); - } - } - - - public bool regionAllowTerraform - { - get { return m_regionAllowTerraform; } - set - { - m_regionAllowTerraform = value; - configMember.forceSetConfigurationOption("region_allow_terraform", m_regionAllowTerraform.ToString()); - } - } - - // Region Information // Low resolution 'base' textures. No longer used. @@ -473,16 +367,6 @@ namespace OpenSim.Framework } } - public float waterHeight - { - get { return m_waterHeight; } - set - { - m_waterHeight = value; - configMember.forceSetConfigurationOption("water_height", m_waterHeight.ToString()); - } - } - public LLUUID terrainImageID { get { return m_terrainImageID; } @@ -760,30 +644,16 @@ namespace OpenSim.Framework configMember.addConfigurationOption("max_agents", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, String.Empty, "40", true); - configMember.addConfigurationOption("object_bonus_factor", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, - String.Empty, "1.0", true); configMember.addConfigurationOption("redirect_grid_x", ConfigurationOption.ConfigurationTypes.TYPE_INT32, String.Empty, "0", true); configMember.addConfigurationOption("redirect_grid_y", ConfigurationOption.ConfigurationTypes.TYPE_INT32, String.Empty, "0", true); - configMember.addConfigurationOption("region_flags", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, String.Empty, - "336723974", true); //Taken from a Linden sim for the moment. - configMember.addConfigurationOption("sim_access", ConfigurationOption.ConfigurationTypes.TYPE_BYTE, String.Empty, "21", - true); configMember.addConfigurationOption("sun_hour", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, String.Empty, "0", true); - configMember.addConfigurationOption("terrain_raise_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, - String.Empty, "4.0", true); //4 is the LL default - configMember.addConfigurationOption("terrain_lower_limit", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, - String.Empty, "-4.0", true); //-4.0 is the LL default configMember.addConfigurationOption("use_fixed_sun", ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, String.Empty, "false", true); configMember.addConfigurationOption("price_per_meter", ConfigurationOption.ConfigurationTypes.TYPE_UINT32, String.Empty, "1", true); - configMember.addConfigurationOption("region_water_height", - ConfigurationOption.ConfigurationTypes.TYPE_FLOAT, String.Empty, "20", true); - configMember.addConfigurationOption("region_allow_terraform", - ConfigurationOption.ConfigurationTypes.TYPE_BOOLEAN, String.Empty, "true", true); configMember.addConfigurationOption("terrain_base_0", ConfigurationOption.ConfigurationTypes.TYPE_LLUUID, String.Empty, "b8d3965a-ad78-bf43-699b-bff8eca6c975", true); @@ -868,46 +738,18 @@ namespace OpenSim.Framework case "parent_estate_id": m_parentEstateID = (uint) configuration_result; break; - case "max_agents": - m_maxAgents = (byte) configuration_result; - break; - - case "object_bonus_factor": - m_objectBonusFactor = (float) configuration_result; - break; case "redirect_grid_x": m_redirectGridX = (int) configuration_result; break; case "redirect_grid_y": m_redirectGridY = (int) configuration_result; break; - case "region_flags": - m_regionFlags = (Simulator.RegionFlags) ((uint) configuration_result); - break; - case "sim_access": - m_simAccess = (Simulator.SimAccess) ((byte) configuration_result); - break; case "sun_hour": m_sunHour = (float) configuration_result; break; - case "terrain_raise_limit": - m_terrainRaiseLimit = (float) configuration_result; - break; - case "terrain_lower_limit": - m_terrainLowerLimit = (float) configuration_result; - break; - case "use_fixed_sun": - m_useFixedSun = (bool) configuration_result; - break; case "price_per_meter": m_pricePerMeter = Convert.ToInt32(configuration_result); break; - case "region_water_height": - m_regionWaterHeight = (float) configuration_result; - break; - case "region_allow_terraform": - m_regionAllowTerraform = (bool) configuration_result; - break; case "terrain_base_0": m_terrainBase0 = (LLUUID) configuration_result; @@ -970,10 +812,6 @@ namespace OpenSim.Framework case "terrain_multiplier": m_terrainMultiplier = Convert.ToDouble(configuration_result); break; - case "water_height": - double tmpVal = (double) configuration_result; - m_waterHeight = (float) tmpVal; - break; case "terrain_image_id": m_terrainImageID = (LLUUID) configuration_result; break; diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs index 06cf7bf..f525da0 100644 --- a/OpenSim/Framework/RegionSettings.cs +++ b/OpenSim/Framework/RegionSettings.cs @@ -458,7 +458,7 @@ namespace OpenSim.Framework set { m_TerrainRaiseLimit = value; } } - private double m_TerrainLowerLimit = 100; + private double m_TerrainLowerLimit = -100; public double TerrainLowerLimit { diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs index 621d0ef..dadaf88 100644 --- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs +++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs @@ -136,7 +136,7 @@ namespace OpenSim.Region.ClientStack scene.PhysicsScene = GetPhysicsScene(); scene.PhysicsScene.SetTerrain(scene.Heightmap.GetFloatsSerialised()); - scene.PhysicsScene.SetWaterLevel(regionInfo.EstateSettings.waterHeight); + scene.PhysicsScene.SetWaterLevel((float)regionInfo.RegionSettings.WaterHeight); //Master Avatar Setup UserProfileData masterAvatar; diff --git a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs index 47606c2..782465e 100644 --- a/OpenSim/Region/Communications/Local/LocalBackEndServices.cs +++ b/OpenSim/Region/Communications/Local/LocalBackEndServices.cs @@ -207,7 +207,7 @@ namespace OpenSim.Region.Communications.Local map.Name = regInfo.RegionName; map.X = (ushort) regInfo.RegionLocX; map.Y = (ushort) regInfo.RegionLocY; - map.WaterHeight = (byte) regInfo.EstateSettings.waterHeight; + map.WaterHeight = (byte) regInfo.RegionSettings.WaterHeight; map.MapImageId = regInfo.EstateSettings.terrainImageID; map.Agents = 1; map.RegionFlags = 72458694; diff --git a/OpenSim/Region/DataSnapshot/SnapshotStore.cs b/OpenSim/Region/DataSnapshot/SnapshotStore.cs index 4f4beea..769b3ac 100644 --- a/OpenSim/Region/DataSnapshot/SnapshotStore.cs +++ b/OpenSim/Region/DataSnapshot/SnapshotStore.cs @@ -258,11 +258,11 @@ namespace OpenSim.Region.DataSnapshot // "PG" - Mormontown // "Mature" - Sodom and Gomorrah // (Depreciated) "Patriotic Nigra Testing Sandbox" - Abandon Hope All Ye Who Enter Here - if ((scene.RegionInfo.EstateSettings.simAccess & Simulator.SimAccess.Mature) == Simulator.SimAccess.Mature) + if (scene.RegionInfo.RegionSettings.Maturity == 1) { return "Mature"; } - else if ((scene.RegionInfo.EstateSettings.simAccess & Simulator.SimAccess.PG) == Simulator.SimAccess.PG) + else if (scene.RegionInfo.RegionSettings.Maturity == 0) { return "PG"; } diff --git a/OpenSim/Region/Environment/Interfaces/IEstateModule.cs b/OpenSim/Region/Environment/Interfaces/IEstateModule.cs new file mode 100644 index 0000000..070b804 --- /dev/null +++ b/OpenSim/Region/Environment/Interfaces/IEstateModule.cs @@ -0,0 +1,38 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSim Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using OpenSim.Framework; +using libsecondlife; + +namespace OpenSim.Region.Environment.Interfaces +{ + public interface IEstateModule : IRegionModule + { + uint GetRegionFlags(); + } +} diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs index 9ef3e10..15141e5 100644 --- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs @@ -37,7 +37,7 @@ using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.Environment.Modules.World.Estate { - public class EstateManagementModule : IRegionModule + public class EstateManagementModule : IEstateModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -57,50 +57,46 @@ namespace OpenSim.Region.Environment.Modules.World.Estate private void estateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor, int matureLevel, bool restrictPushObject, bool allowParcelChanges) { - m_scene.RegionInfo.EstateSettings.regionFlags = Simulator.RegionFlags.None; - if (blockTerraform) - { - m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | - Simulator.RegionFlags.BlockTerraform; - } + m_scene.RegionInfo.RegionSettings.BlockTerraform = true; + else + m_scene.RegionInfo.RegionSettings.BlockTerraform = false; if (noFly) - { - m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | - Simulator.RegionFlags.NoFly; - } + m_scene.RegionInfo.RegionSettings.BlockFly = true; + else + m_scene.RegionInfo.RegionSettings.BlockFly = false; if (allowDamage) - { - m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | - Simulator.RegionFlags.AllowDamage; - } + m_scene.RegionInfo.RegionSettings.AllowDamage = true; + else + m_scene.RegionInfo.RegionSettings.AllowDamage = false; if (blockLandResell) - { - m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | - Simulator.RegionFlags.BlockLandResell; - } - - m_scene.RegionInfo.EstateSettings.maxAgents = (byte) maxAgents; + m_scene.RegionInfo.RegionSettings.AllowLandResell = false; + else + m_scene.RegionInfo.RegionSettings.AllowLandResell = true; - m_scene.RegionInfo.EstateSettings.objectBonusFactor = objectBonusFactor; + m_scene.RegionInfo.RegionSettings.AgentLimit = (byte) maxAgents; - m_scene.RegionInfo.EstateSettings.simAccess = (Simulator.SimAccess) matureLevel; + m_scene.RegionInfo.RegionSettings.ObjectBonus = objectBonusFactor; + if(matureLevel <= 13) + m_scene.RegionInfo.RegionSettings.Maturity = 0; + else + m_scene.RegionInfo.RegionSettings.Maturity = 1; if (restrictPushObject) - { - m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | - Simulator.RegionFlags.RestrictPushObject; - } + m_scene.RegionInfo.RegionSettings.RestrictPushing = true; + else + m_scene.RegionInfo.RegionSettings.RestrictPushing = false; if (allowParcelChanges) - { - m_scene.RegionInfo.EstateSettings.regionFlags = m_scene.RegionInfo.EstateSettings.regionFlags | - Simulator.RegionFlags.AllowParcelChanges; - } + m_scene.RegionInfo.RegionSettings.AllowLandJoinDivide = true; + else + m_scene.RegionInfo.RegionSettings.AllowLandJoinDivide = false; + + m_scene.RegionInfo.RegionSettings.Save(); sendRegionInfoPacketToAll(); } @@ -175,19 +171,20 @@ namespace OpenSim.Region.Environment.Modules.World.Estate bool UseFixedSun, float SunHour) { // Water Height - m_scene.RegionInfo.EstateSettings.waterHeight = WaterHeight; + m_scene.RegionInfo.RegionSettings.WaterHeight = WaterHeight; // Terraforming limits - m_scene.RegionInfo.EstateSettings.terrainRaiseLimit = TerrainRaiseLimit; - m_scene.RegionInfo.EstateSettings.terrainLowerLimit = TerrainLowerLimit; + m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit = TerrainRaiseLimit; + m_scene.RegionInfo.RegionSettings.TerrainLowerLimit = TerrainLowerLimit; // Time of day / fixed sun - m_scene.RegionInfo.EstateSettings.useFixedSun = UseFixedSun; + m_scene.RegionInfo.RegionSettings.FixedSun = UseFixedSun; m_scene.RegionInfo.EstateSettings.sunHour = SunHour; m_scene.EventManager.TriggerEstateToolsTimeUpdate(m_scene.RegionInfo.RegionHandle, UseFixedSun, UseFixedSun, SunHour); //m_log.Debug("[ESTATE]: UFS: " + UseFixedSun.ToString()); //m_log.Debug("[ESTATE]: SunHour: " + SunHour.ToString()); sendRegionInfoPacketToAll(); + m_scene.RegionInfo.RegionSettings.Save(); } private void handleEstateRestartSimRequest(IClientAPI remoteClient, int timeInSeconds) @@ -339,23 +336,22 @@ namespace OpenSim.Region.Environment.Modules.World.Estate private void handleEstateDebugRegionRequest(IClientAPI remote_client, LLUUID invoice, LLUUID senderID, bool scripted, bool collisionEvents, bool physics) { if (physics) - { - m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipPhysics; - } + m_scene.RegionInfo.RegionSettings.DisablePhysics = true; else - { - m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipPhysics; - } + m_scene.RegionInfo.RegionSettings.DisablePhysics = false; if (scripted) - { - m_scene.RegionInfo.EstateSettings.regionFlags |= Simulator.RegionFlags.SkipScripts; - } + m_scene.RegionInfo.RegionSettings.DisableScripts = true; else - { - m_scene.RegionInfo.EstateSettings.regionFlags &= ~Simulator.RegionFlags.SkipScripts; - } + m_scene.RegionInfo.RegionSettings.DisableScripts = false; + + if (collisionEvents) + m_scene.RegionInfo.RegionSettings.DisableCollisions = true; + else + m_scene.RegionInfo.RegionSettings.DisableCollisions = false; + + m_scene.RegionInfo.RegionSettings.Save(); m_scene.SetSceneCoreDebug(scripted, collisionEvents, physics); } @@ -378,24 +374,27 @@ namespace OpenSim.Region.Environment.Modules.World.Estate RegionInfoForEstateMenuArgs args = new RegionInfoForEstateMenuArgs(); args.billableFactor = m_scene.RegionInfo.EstateSettings.billableFactor; args.estateID = m_scene.RegionInfo.EstateSettings.estateID; - args.maxAgents = m_scene.RegionInfo.EstateSettings.maxAgents; - args.objectBonusFactor = m_scene.RegionInfo.EstateSettings.objectBonusFactor; + args.maxAgents = (byte)m_scene.RegionInfo.RegionSettings.AgentLimit; + args.objectBonusFactor = (float)m_scene.RegionInfo.RegionSettings.ObjectBonus; args.parentEstateID = m_scene.RegionInfo.EstateSettings.parentEstateID; args.pricePerMeter = m_scene.RegionInfo.EstateSettings.pricePerMeter; args.redirectGridX = m_scene.RegionInfo.EstateSettings.redirectGridX; args.redirectGridY = m_scene.RegionInfo.EstateSettings.redirectGridY; - args.regionFlags = (uint)(m_scene.RegionInfo.EstateSettings.regionFlags); - args.simAccess = (byte)m_scene.RegionInfo.EstateSettings.simAccess; + args.regionFlags = GetRegionFlags(); + byte mature = 13; + if(m_scene.RegionInfo.RegionSettings.Maturity == 1) + mature = 21; + args.simAccess = mature; - if (m_scene.RegionInfo.EstateSettings.useFixedSun) + if (m_scene.RegionInfo.RegionSettings.FixedSun) args.sunHour = m_scene.RegionInfo.EstateSettings.sunHour; else args.sunHour = m_scene.EventManager.GetSunLindenHour(); - args.terrainLowerLimit = m_scene.RegionInfo.EstateSettings.terrainLowerLimit; - args.terrainRaiseLimit = m_scene.RegionInfo.EstateSettings.terrainRaiseLimit; - args.useEstateSun = !m_scene.RegionInfo.EstateSettings.useFixedSun; - args.waterHeight = m_scene.RegionInfo.EstateSettings.waterHeight; + args.terrainLowerLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainLowerLimit; + args.terrainRaiseLimit = (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit; + args.useEstateSun = !m_scene.RegionInfo.RegionSettings.FixedSun; + args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; args.simName = m_scene.RegionInfo.RegionName; @@ -541,10 +540,13 @@ namespace OpenSim.Region.Environment.Modules.World.Estate args.terrainStartHeight1 = m_scene.RegionInfo.EstateSettings.terrainStartHeight1; args.terrainStartHeight2 = m_scene.RegionInfo.EstateSettings.terrainStartHeight2; args.terrainStartHeight3 = m_scene.RegionInfo.EstateSettings.terrainStartHeight3; - args.simAccess = (byte)m_scene.RegionInfo.EstateSettings.simAccess; - args.waterHeight = m_scene.RegionInfo.EstateSettings.waterHeight; + byte mature = 13; + if(m_scene.RegionInfo.RegionSettings.Maturity == 1) + mature = 21; + args.simAccess = mature; + args.waterHeight = (float)m_scene.RegionInfo.RegionSettings.WaterHeight; - args.regionFlags = (uint)m_scene.RegionInfo.EstateSettings.regionFlags; + args.regionFlags = GetRegionFlags(); args.regionName = m_scene.RegionInfo.RegionName; args.SimOwner = m_scene.RegionInfo.MasterAvatarAssignedUUID; args.terrainBase0 = m_scene.RegionInfo.EstateSettings.terrainBase0; @@ -573,6 +575,7 @@ namespace OpenSim.Region.Environment.Modules.World.Estate public void Initialise(Scene scene, IConfigSource source) { m_scene = scene; + m_scene.RegisterModuleInterface(this); m_scene.EventManager.OnNewClient += EventManager_OnNewClient; m_scene.EventManager.OnRequestChangeWaterHeight += changeWaterHeight; } @@ -602,8 +605,8 @@ namespace OpenSim.Region.Environment.Modules.World.Estate public void changeWaterHeight(float height) { - setRegionTerrainSettings(height, m_scene.RegionInfo.EstateSettings.terrainRaiseLimit, m_scene.RegionInfo.EstateSettings.terrainLowerLimit, - m_scene.RegionInfo.EstateSettings.useFixedSun, m_scene.RegionInfo.EstateSettings.sunHour); + setRegionTerrainSettings(height, (float)m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit, (float)m_scene.RegionInfo.RegionSettings.TerrainLowerLimit, + m_scene.RegionInfo.RegionSettings.FixedSun, m_scene.RegionInfo.EstateSettings.sunHour); sendRegionInfoPacketToAll(); } @@ -631,5 +634,12 @@ namespace OpenSim.Region.Environment.Modules.World.Estate client.OnLandStatRequest += HandleLandStatRequest; sendRegionHandshake(client); } + + public uint GetRegionFlags() + { + Simulator.RegionFlags flags = Simulator.RegionFlags.None; + //m_scene.RegionInfo.RegionSettings. + return (uint)flags; + } } } diff --git a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs index 2b24435..4a5948f 100644 --- a/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs +++ b/OpenSim/Region/Environment/Modules/World/Land/LandObject.cs @@ -140,7 +140,7 @@ namespace OpenSim.Region.Environment.Modules.World.Land //Normal Calculations return Convert.ToInt32( Math.Round((Convert.ToDecimal(landData.area) / Convert.ToDecimal(65536)) * m_scene.objectCapacity * - Convert.ToDecimal(m_scene.RegionInfo.EstateSettings.objectBonusFactor))); ; + Convert.ToDecimal(m_scene.RegionInfo.RegionSettings.ObjectBonus))); ; } } public int getSimulatorMaxPrimCount(ILandObject thisObject) @@ -161,7 +161,15 @@ namespace OpenSim.Region.Environment.Modules.World.Land public void sendLandProperties(int sequence_id, bool snap_selection, int request_result, IClientAPI remote_client) { - remote_client.SendLandProperties(remote_client, sequence_id, snap_selection, request_result, landData, m_scene.RegionInfo.EstateSettings.objectBonusFactor, getParcelMaxPrimCount(this), getSimulatorMaxPrimCount(this), (uint)m_scene.RegionInfo.EstateSettings.regionFlags); + IEstateModule estateModule = m_scene.RequestModuleInterface(); + uint regionFlags = 67108864; + if(estateModule != null) + regionFlags = estateModule.GetRegionFlags(); + remote_client.SendLandProperties(remote_client, sequence_id, + snap_selection, request_result, landData, + (float)m_scene.RegionInfo.RegionSettings.ObjectBonus, + getParcelMaxPrimCount(this), + getSimulatorMaxPrimCount(this), regionFlags); } public void updateLandProperties(LandUpdateArgs args, IClientAPI remote_client) @@ -855,4 +863,4 @@ namespace OpenSim.Region.Environment.Modules.World.Land #endregion } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs index f47e6c0..9892794 100644 --- a/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Terrain/TerrainModule.cs @@ -541,8 +541,8 @@ namespace OpenSim.Region.Environment.Modules.World.Terrain private bool LimitChannelChanges(int xStart, int yStart) { bool changesLimited = false; - double minDelta = m_scene.RegionInfo.EstateSettings.terrainLowerLimit; - double maxDelta = m_scene.RegionInfo.EstateSettings.terrainRaiseLimit; + double minDelta = m_scene.RegionInfo.RegionSettings.TerrainLowerLimit; + double maxDelta = m_scene.RegionInfo.RegionSettings.TerrainRaiseLimit; // loop through the height map for this patch and compare it against // the revert map diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index a78ad98..36a0ffc 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -297,24 +297,11 @@ namespace OpenSim.Region.Environment.Scenes m_httpListener = httpServer; m_dumpAssetsToFile = dumpAssetsToFile; - if ((RegionInfo.EstateSettings.regionFlags & Simulator.RegionFlags.SkipScripts) == Simulator.RegionFlags.SkipScripts) - { - m_scripts_enabled = false; - } - else - { - m_scripts_enabled = true; - } - if ((RegionInfo.EstateSettings.regionFlags & Simulator.RegionFlags.SkipPhysics) == Simulator.RegionFlags.SkipPhysics) - { - m_physics_enabled = false; - } - else - { - m_physics_enabled = true; - } + m_scripts_enabled = !RegionInfo.RegionSettings.DisableScripts; + + m_physics_enabled = !RegionInfo.RegionSettings.DisablePhysics; - m_statsReporter = new SimStatsReporter(regInfo); + m_statsReporter = new SimStatsReporter(this); m_statsReporter.OnSendStatsResult += SendSimStatsPackets; m_statsReporter.SetObjectCapacity(objectCapacity); @@ -1076,7 +1063,7 @@ namespace OpenSim.Region.Environment.Scenes //float tmpval = (float)hm[x, y]; float heightvalue = (float)hm[x, y]; - if ((float)heightvalue > m_regInfo.EstateSettings.waterHeight) + if (heightvalue > (float)m_regInfo.RegionSettings.WaterHeight) { // scale height value heightvalue = low + mid * (heightvalue - low) / mid; @@ -1110,7 +1097,7 @@ namespace OpenSim.Region.Environment.Scenes else { // Y flip the cordinates - heightvalue = m_regInfo.EstateSettings.waterHeight - heightvalue; + heightvalue = (float)m_regInfo.RegionSettings.WaterHeight - heightvalue; if (heightvalue > 19) heightvalue = 19; if (heightvalue < 0) diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs index 8feb852..0696432 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs @@ -58,7 +58,7 @@ namespace OpenSim.Region.Environment.Scenes public void CreateScriptInstances(int startParam, bool postOnRez) { // Don't start scripts if they're turned off in the region! - if (!((m_scene.RegionInfo.EstateSettings.regionFlags & Simulator.RegionFlags.SkipScripts) == Simulator.RegionFlags.SkipScripts)) + if (!m_scene.RegionInfo.RegionSettings.DisableScripts) { foreach (SceneObjectPart part in m_parts.Values) { diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index d407392..841b7b6 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs @@ -173,7 +173,7 @@ namespace OpenSim.Region.Environment.Scenes AddFlag(LLObject.ObjectFlags.Scripted); - if (!((m_parentGroup.Scene.RegionInfo.EstateSettings.regionFlags & Simulator.RegionFlags.SkipScripts) == Simulator.RegionFlags.SkipScripts)) + if (!m_parentGroup.Scene.RegionInfo.RegionSettings.DisableScripts) { AssetCache cache = m_parentGroup.Scene.AssetCache; diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs index 90a971f..609b4ed 100644 --- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs @@ -29,6 +29,7 @@ using System; using System.Timers; using libsecondlife.Packets; using OpenSim.Framework; +using OpenSim.Region.Environment.Interfaces; namespace OpenSim.Region.Environment.Scenes { @@ -104,16 +105,19 @@ namespace OpenSim.Region.Environment.Scenes SimStatsPacket statpack = (SimStatsPacket)PacketPool.Instance.GetPacket(PacketType.SimStats); + private Scene m_scene; + private RegionInfo ReportingRegion; private Timer m_report = new Timer(); - public SimStatsReporter(RegionInfo regionData) + public SimStatsReporter(Scene scene) { statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000); - ReportingRegion = regionData; + m_scene = scene; + ReportingRegion = scene.RegionInfo; for (int i = 0; i<21;i++) { sb[i] = new SimStatsPacket.StatBlock(); @@ -145,7 +149,8 @@ namespace OpenSim.Region.Environment.Scenes statpack.Region.RegionY = ReportingRegion.RegionLocY; try { - statpack.Region.RegionFlags = (uint) ReportingRegion.EstateSettings.regionFlags; + IEstateModule estateModule = m_scene.RequestModuleInterface(); + statpack.Region.RegionFlags = estateModule.GetRegionFlags(); } catch (Exception) { diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index 4fc4608..0d3049d 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -2822,7 +2822,7 @@ namespace OpenSim.Region.ScriptEngine.Common public double llWater(LSL_Types.Vector3 offset) { m_host.AddScriptLPS(1); - return World.RegionInfo.EstateSettings.waterHeight; + return World.RegionInfo.RegionSettings.WaterHeight; } public void llPassTouches(int pass) @@ -6456,10 +6456,10 @@ namespace OpenSim.Region.ScriptEngine.Common case 7: // DATA_SIM_RATING if (info == null) return LLUUID.Zero.ToString(); - int access = (int)info.EstateSettings.simAccess; - if (access == 21) - reply = "MATURE"; - else if (access == 13) + int access = info.RegionSettings.Maturity; + if (access == 0) + reply = "PG"; + else if (access == 1) reply = "MATURE"; else reply = "UNKNOWN"; @@ -6829,7 +6829,10 @@ namespace OpenSim.Region.ScriptEngine.Common public LSL_Types.LSLInteger llGetRegionFlags() { m_host.AddScriptLPS(1); - return (int)World.RegionInfo.EstateSettings.regionFlags; + IEstateModule estate = World.RequestModuleInterface(); + if(estate == null) + return 67108864; + return estate.GetRegionFlags(); } public string llXorBase64StringsCorrect(string str1, string str2) @@ -7006,7 +7009,7 @@ namespace OpenSim.Region.ScriptEngine.Common // Which probably will be irrelevent in OpenSim.... LandData land = World.GetLandData((float)pos.x, (float)pos.y); - float bonusfactor = World.RegionInfo.EstateSettings.objectBonusFactor; + float bonusfactor = (float)World.RegionInfo.RegionSettings.ObjectBonus; if (land == null) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8edd169..30a64c7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2686,7 +2686,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public double llWater(LSL_Types.Vector3 offset) { m_host.AddScriptLPS(1); - return World.RegionInfo.EstateSettings.waterHeight; + return World.RegionInfo.RegionSettings.WaterHeight; } public void llPassTouches(int pass) @@ -6235,10 +6235,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case 7: // DATA_SIM_RATING if (info == null) return LLUUID.Zero.ToString(); - int access = (int)info.EstateSettings.simAccess; - if (access == 21) - reply = "MATURE"; - else if (access == 13) + int access = info.RegionSettings.Maturity; + if (access == 0) + reply = "PG"; + else if (access == 1) reply = "MATURE"; else reply = "UNKNOWN"; @@ -6609,7 +6609,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Types.LSLInteger llGetRegionFlags() { m_host.AddScriptLPS(1); - return (int)World.RegionInfo.EstateSettings.regionFlags; + IEstateModule estate = World.RequestModuleInterface(); + if(estate == null) + return 67108864; + return (int)estate.GetRegionFlags(); } public string llXorBase64StringsCorrect(string str1, string str2) @@ -6786,7 +6789,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Which probably will be irrelevent in OpenSim.... LandData land = World.GetLandData((float)pos.x, (float)pos.y); - float bonusfactor = World.RegionInfo.EstateSettings.objectBonusFactor; + float bonusfactor = (float)World.RegionInfo.RegionSettings.ObjectBonus; if (land == null) { -- cgit v1.1