diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs index 2c5397089f..5dbd0bd9ac 100644 --- a/OpenSim/Framework/Constants.cs +++ b/OpenSim/Framework/Constants.cs @@ -34,6 +34,9 @@ namespace OpenSim.Framework public const int MaxAgentAttachments = 38; public const int MaxAgentGroups = 60; + public const int MaxEstateAccessIds = 500; + public const int MaxEstateManagers = 20; + // 'RegionSize' is the legacy region size. // DO NOT USE THIS FOR ANY NEW CODE. Use Scene.RegionInfo.RegionSize[XYZ] as a region might not // be the legacy region size. @@ -56,6 +59,8 @@ namespace OpenSim.Framework public const float MinWaterHeight = 0; public const float MaxWaterHeight = 8000f; + public const int MaxTextureResolution = 1024; + public static readonly string DefaultTexture = "89556747-24cb-43ed-920b-47caed15465f"; //plywood public static readonly UUID DefaultTextureID = new UUID(DefaultTexture); @@ -88,10 +93,10 @@ namespace OpenSim.Framework public enum EstateAccessLimits : int { - AllowedAccess = 500, + AllowedAccess = MaxEstateAccessIds, AllowedGroups = 63, EstateBans = 500, - EstateManagers = 15 + EstateManagers = MaxEstateManagers } [Flags]public enum TeleportFlags : uint diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 2e16b0a615..4699764aa0 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -286,6 +286,9 @@ namespace OpenSim.Region.ClientStack.Linden m_HostCapsObj.RegisterSimpleHandler("AttachmentResources", new SimpleStreamHandler(GetNewCapPath(), AttachmentResources)); } + + m_HostCapsObj.RegisterSimpleHandler("DispatchRegionInfo", + new SimpleOSDMapHandler("POST", GetNewCapPath(), DispatchRegionInfo), true); } catch (Exception e) { diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/DispatchRegionInfo.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/DispatchRegionInfo.cs new file mode 100644 index 0000000000..acfe79567f --- /dev/null +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/DispatchRegionInfo.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections; + +using System.IO; +using System.Net; +using System.Text; +using System.Threading; + +using OpenMetaverse; +using OpenMetaverse.StructuredData; + +using OpenSim.Framework; +using OpenSim.Framework.Capabilities; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Interfaces; +using OpenSim.Framework.Servers.HttpServer; +using OSDMap = OpenMetaverse.StructuredData.OSDMap; + +namespace OpenSim.Region.ClientStack.Linden +{ + + public partial class BunchOfCaps +{ + public void DispatchRegionInfo(IOSHttpRequest request, IOSHttpResponse response, OSDMap map) + { + m_log.Debug("[CAPS]: DispatchRegionInfo Request in region: " + m_regionName + "\n"); + + if (request.HttpMethod != "POST") + { + response.StatusCode = (int)HttpStatusCode.NotFound; + return; + } + + if(map == map.Count < 3) + { + response.StatusCode = (int)HttpStatusCode.BadRequest; + return; + } + + if (!m_Scene.TryGetScenePresence(m_AgentID, out ScenePresence _) || !m_Scene.Permissions.CanIssueEstateCommand(m_AgentID, false)) + { + response.StatusCode = (int)HttpStatusCode.Unauthorized; + return; + } + + IEstateModule estateModule = m_Scene.RequestModuleInterface(); + if (estateModule == null) + { + response.StatusCode = (int)HttpStatusCode.NotImplemented; + return; + } + + response.StatusCode = estateModule.SetRegionInfobyCap(map) ? (int)HttpStatusCode.OK : (int)HttpStatusCode.NotImplemented; + } + } +} \ No newline at end of file diff --git a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs index 833e547d6c..65c2479863 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/SimulatorFeaturesModule.cs @@ -73,7 +73,7 @@ namespace OpenSim.Region.ClientStack.Linden private bool m_ExportSupported = false; - private bool m_doScriptSyntax; + private bool m_doScriptSyntax = true; static private readonly object m_scriptSyntaxLock = new(); static private UUID m_scriptSyntaxID = UUID.Zero; @@ -84,7 +84,6 @@ namespace OpenSim.Region.ClientStack.Linden public void Initialise(IConfigSource source) { IConfig config = source.Configs["SimulatorFeatures"]; - m_doScriptSyntax = true; if (config != null) { m_ExportSupported = config.GetBoolean("ExportSupported", m_ExportSupported); @@ -134,39 +133,48 @@ namespace OpenSim.Region.ClientStack.Linden { lock (m_features) { - m_features["MeshRezEnabled"] = true; - m_features["MeshUploadEnabled"] = true; - m_features["MeshXferEnabled"] = true; + m_features["AnimatedObjects"] = new OSDMap() + { + ["AnimatedObjectMaxTris"] = OSD.FromInteger(150000), + ["MaxAgentAnimatedObjectAttachments"] = OSD.FromInteger(2) + }; m_features["BakesOnMeshEnabled"] = true; - m_features["PhysicsMaterialsEnabled"] = true; - OSDMap typesMap = new(); - typesMap["convex"] = true; - typesMap["none"] = true; - typesMap["prim"] = true; - m_features["PhysicsShapeTypes"] = typesMap; - if(m_doScriptSyntax && !m_scriptSyntaxID.IsZero()) m_features["LSLSyntaxId"] = OSD.FromUUID(m_scriptSyntaxID); - OSDMap meshAnim = new(); - meshAnim["AnimatedObjectMaxTris"] = OSD.FromInteger(150000); - meshAnim["MaxAgentAnimatedObjectAttachments"] = OSD.FromInteger(2); - m_features["AnimatedObjects"] = meshAnim; - m_features["MaxAgentAttachments"] = OSD.FromInteger(Constants.MaxAgentAttachments); + m_features["MaxAgentGroups"] = OSD.FromInteger(Constants.MaxAgentGroups); m_features["MaxAgentGroupsBasic"] = OSD.FromInteger(Constants.MaxAgentGroups); m_features["MaxAgentGroupsPremium"] = OSD.FromInteger(Constants.MaxAgentGroups); - // Extra information for viewers that want to use it - OSDMap extrasMap; - if(m_features.TryGetValue("OpenSimExtras", out OSD oe)) + m_features["MaxEstateAccessIds"] = OSD.FromInteger(Constants.MaxEstateAccessIds); + m_features["MaxEstateManagers"] = OSD.FromInteger(Constants.MaxEstateManagers); + + m_features["MaxTextureResolution"] = OSD.FromInteger(Constants.MaxTextureResolution); + + m_features["MeshRezEnabled"] = true; + m_features["MeshUploadEnabled"] = true; + m_features["MeshXferEnabled"] = true; + + /* + m_features["MirrorsEnabled"] = false; + m_features["PBRMaterialSwatchEnabled"] = false; + m_features["PBRTerrainEnabled"] = false; + */ + + m_features["PhysicsMaterialsEnabled"] = true; + + m_features["PhysicsShapeTypes"] = new OSDMap() { - extrasMap = oe as OSDMap; - } - else - extrasMap = new OSDMap(); + ["convex"] = true, + ["none"] = true, + ["prim"] = true + }; + + // Extra information for viewers that want to use it + OSDMap extrasMap = m_features.TryGetValue("OpenSimExtras", out OSD oe) ? oe as OSDMap : new OSDMap(); extrasMap["AvatarSkeleton"] = true; extrasMap["AnimationSet"] = true; diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index f4b33af5f6..7b7287992c 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -33,11 +33,11 @@ using System.Linq; using System.Reflection; using System.Security; using System.Timers; -using System.Threading; using log4net; using Mono.Addins; using Nini.Config; using OpenMetaverse; +using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Framework.Monitoring; using OpenSim.Region.Framework.Interfaces; @@ -46,7 +46,6 @@ using OpenSim.Services.Interfaces; using RegionFlags = OpenMetaverse.RegionFlags; using Timer = System.Timers.Timer; - namespace OpenSim.Region.CoreModules.World.Estate { [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "EstateManagementModule")] @@ -446,28 +445,16 @@ namespace OpenSim.Region.CoreModules.World.Estate private void EstateSetRegionInfoHandler(bool blockTerraform, bool noFly, bool allowDamage, bool blockLandResell, int maxAgents, float objectBonusFactor, int matureLevel, bool restrictPushObject, bool allowParcelChanges) { - if (blockTerraform) - Scene.RegionInfo.RegionSettings.BlockTerraform = true; - else - Scene.RegionInfo.RegionSettings.BlockTerraform = false; + Scene.RegionInfo.RegionSettings.BlockTerraform = blockTerraform; + Scene.RegionInfo.RegionSettings.BlockFly = noFly; + Scene.RegionInfo.RegionSettings.AllowDamage = allowDamage; + Scene.RegionInfo.RegionSettings.AllowLandResell = !blockLandResell; - if (noFly) - Scene.RegionInfo.RegionSettings.BlockFly = true; - else - Scene.RegionInfo.RegionSettings.BlockFly = false; + Scene.RegionInfo.RegionSettings.RestrictPushing = restrictPushObject; + Scene.RegionInfo.RegionSettings.AllowLandJoinDivide = allowParcelChanges; - if (allowDamage) - Scene.RegionInfo.RegionSettings.AllowDamage = true; - else - Scene.RegionInfo.RegionSettings.AllowDamage = false; - - if (blockLandResell) - Scene.RegionInfo.RegionSettings.AllowLandResell = false; - else - Scene.RegionInfo.RegionSettings.AllowLandResell = true; - - if((byte)maxAgents <= Scene.RegionInfo.AgentCapacity) - Scene.RegionInfo.RegionSettings.AgentLimit = (byte) maxAgents; + if (maxAgents > 1 && maxAgents <= Scene.RegionInfo.AgentCapacity) + Scene.RegionInfo.RegionSettings.AgentLimit = maxAgents; else Scene.RegionInfo.RegionSettings.AgentLimit = Scene.RegionInfo.AgentCapacity; @@ -480,20 +467,74 @@ namespace OpenSim.Region.CoreModules.World.Estate else Scene.RegionInfo.RegionSettings.Maturity = 2; - if (restrictPushObject) - Scene.RegionInfo.RegionSettings.RestrictPushing = true; - else - Scene.RegionInfo.RegionSettings.RestrictPushing = false; + Scene.RegionInfo.RegionSettings.Save(); + TriggerRegionInfoChange(); - if (allowParcelChanges) - Scene.RegionInfo.RegionSettings.AllowLandJoinDivide = true; - else - Scene.RegionInfo.RegionSettings.AllowLandJoinDivide = false; + SendRegionInfoPacketToAll(); + } + + public bool SetRegionInfobyCap(OSDMap map) + { + if(Scene.RegionInfo == null || Scene.RegionInfo.RegionSettings == null) + return false; + + RegionSettings es = Scene.RegionInfo.RegionSettings; + OSD tmp; + //if (map.TryGetValue("", out tmp) && tmp) + + if (map.TryGetValue("block_terraform", out tmp) && tmp is not null ) + es.BlockTerraform = tmp.AsBoolean(); + + if (map.TryGetValue("block_fly", out tmp) && tmp is not null) + es.BlockFly = tmp.AsBoolean(); + + //if (map.TryGetValue("block_fly_over", out tmp) && tmp) + // es.??? = tmp.AsBoolean()); + + if (map.TryGetValue("allow_damage", out tmp) && tmp is not null) + es.AllowDamage = tmp.AsBoolean(); + + if (map.TryGetValue("allow_land_resell", out tmp) && tmp is not null) + es.AllowLandResell = tmp.AsBoolean(); + + if (map.TryGetValue("agent_limit", out tmp) && tmp is not null) + { + int maxagents = tmp.AsInteger(); + if (maxagents > 1 && maxagents <= Scene.RegionInfo.AgentCapacity) + Scene.RegionInfo.RegionSettings.AgentLimit = maxagents; + else + Scene.RegionInfo.RegionSettings.AgentLimit = Scene.RegionInfo.AgentCapacity; + } + + if (map.TryGetValue("prim_bonus", out tmp) && tmp is not null) + es.ObjectBonus = tmp.AsInteger(); + + if (map.TryGetValue("sim_access", out tmp) && tmp is not null) + { + int matureLevel = tmp.AsInteger(); + if (matureLevel <= 13) + es.Maturity = 0; + else if (matureLevel <= 21) + es.Maturity = 1; + else + es.Maturity = 2; + } + + if (map.TryGetValue("restrict_pushobject", out tmp) && tmp is not null) + es.RestrictPushing = tmp.AsBoolean(); + + if (map.TryGetValue("allow_parcel_changes", out tmp) && tmp is not null) + es.AllowLandJoinDivide = tmp.AsBoolean(); + + + if (map.TryGetValue("block_parcel_search", out tmp) && tmp is not null) + es.BlockShowInSearch = tmp.AsBoolean(); Scene.RegionInfo.RegionSettings.Save(); TriggerRegionInfoChange(); SendRegionInfoPacketToAll(); + return true; } public void SetEstateTerrainBaseTexture(IClientAPI remoteClient, int level, UUID texture) @@ -1781,7 +1822,6 @@ namespace OpenSim.Region.CoreModules.World.Estate { client.OnDetailedEstateDataRequest += ClientSendDetailedEstateData; client.OnSetEstateFlagsRequest += EstateSetRegionInfoHandler; -// client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture; client.OnSetEstateTerrainDetailTexture += SetEstateTerrainBaseTexture; client.OnSetEstateTerrainTextureHeights += SetEstateTerrainTextureHeights; client.OnCommitEstateTerrainTextureRequest += HandleCommitEstateTerrainTextureRequest; diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index e36c97ed33..f4a314bd6f 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs @@ -26,6 +26,7 @@ */ using OpenMetaverse; +using OpenMetaverse.StructuredData; using OpenSim.Framework; using OpenSim.Services.Interfaces; @@ -72,5 +73,6 @@ namespace OpenSim.Region.Framework.Interfaces bool externallyVisible, bool allowDirectTeleport, bool denyAnonymous, bool denyAgeUnverified, bool alloVoiceChat, bool overridePublicAccess, bool allowEnvironmentOverride); void HandleRegionInfoRequest(IClientAPI remote_client); + bool SetRegionInfobyCap(OSDMap map); } } diff --git a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs index ad74f53276..603f18af2f 100644 --- a/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs +++ b/OpenSim/Region/OptionalModules/Materials/MaterialsModule.cs @@ -128,8 +128,8 @@ namespace OpenSim.Region.OptionalModules.Materials ISimulatorFeaturesModule featuresModule = scene.RequestModuleInterface(); if (featuresModule is not null) { - featuresModule.AddOpenSimExtraFeature("MaxMaterialsPerTransaction", m_maxMaterialsPerTransaction); - featuresModule.AddOpenSimExtraFeature("RenderMaterialsCapability", 3.0f); + featuresModule.AddFeature("MaxMaterialsPerTransaction", m_maxMaterialsPerTransaction); + featuresModule.AddFeature("RenderMaterialsCapability", 4); } } diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/DynamicFloaterModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/DynamicFloaterModule.cs index ed44a5aff2..d3adfde11c 100644 --- a/OpenSim/Region/OptionalModules/ViewerSupport/DynamicFloaterModule.cs +++ b/OpenSim/Region/OptionalModules/ViewerSupport/DynamicFloaterModule.cs @@ -55,6 +55,8 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport private Scene m_scene; + private bool m_Enabled = false; + private Dictionary> m_floaters = new Dictionary>(); public string Name @@ -69,6 +71,11 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport public void Initialise(IConfigSource config) { + IConfig moduleConfig = config.Configs["DynamicFloaterModule"]; + if (moduleConfig != null) + { + m_Enabled = moduleConfig.GetBoolean("enabled", false); + } } public void Close() @@ -77,10 +84,13 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport public void AddRegion(Scene scene) { - m_scene = scene; - scene.EventManager.OnNewClient += OnNewClient; - scene.EventManager.OnClientClosed += OnClientClosed; - m_scene.RegisterModuleInterface(this); + if(m_Enabled) + { + m_scene = scene; + scene.EventManager.OnNewClient += OnNewClient; + scene.EventManager.OnClientClosed += OnClientClosed; + m_scene.RegisterModuleInterface(this); + } } public void RegionLoaded(Scene scene) diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs index 80feee36e0..95004bb650 100644 --- a/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs +++ b/OpenSim/Region/OptionalModules/ViewerSupport/DynamicMenuModule.cs @@ -49,6 +49,7 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private bool m_Enabled = false; private class MenuItemData { public string Title; @@ -75,6 +76,11 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport public void Initialise(IConfigSource config) { + IConfig moduleConfig = config.Configs["DynamicMenuModule"]; + if (moduleConfig != null) + { + m_Enabled = moduleConfig.GetBoolean("enabled", false); + } } public void Close() @@ -83,17 +89,22 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport public void AddRegion(Scene scene) { - m_scene = scene; - scene.EventManager.OnRegisterCaps += OnRegisterCaps; - m_scene.RegisterModuleInterface(this); + if (m_Enabled) + { + m_scene = scene; + scene.EventManager.OnRegisterCaps += OnRegisterCaps; + m_scene.RegisterModuleInterface(this); + } } public void RegionLoaded(Scene scene) { - ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface(); - - if (featuresModule != null) - featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest; + if (m_Enabled) + { + ISimulatorFeaturesModule featuresModule = m_scene.RequestModuleInterface(); + if (featuresModule != null) + featuresModule.OnSimulatorFeaturesRequest += OnSimulatorFeaturesRequest; + } } public void RemoveRegion(Scene scene) diff --git a/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs b/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs index 0bafb34bd7..a29a7deb38 100644 --- a/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs +++ b/OpenSim/Region/OptionalModules/ViewerSupport/SpecialUIModule.cs @@ -54,11 +54,12 @@ namespace OpenSim.Region.OptionalModules.ViewerSupport public class SpecialUIModule : INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private const string VIEWER_SUPPORT_DIR = "ViewerSupport"; private Scene m_scene; private SimulatorFeaturesHelper m_Helper; - private bool m_Enabled; + private bool m_Enabled = false; private int m_UserLevel; public string Name