diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 81310894dd..ded2df2132 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -126,6 +126,7 @@ namespace OpenSim.Framework private int m_physPrimMax = 0; private bool m_clampPrimSize = false; private int m_objectCapacity = 0; + private int m_linksetCapacity = 0; private int m_agentCapacity = 0; private string m_regionType = String.Empty; private RegionLightShareData m_windlight = new RegionLightShareData(); @@ -317,6 +318,11 @@ namespace OpenSim.Framework get { return m_objectCapacity; } } + public int LinksetCapacity + { + get { return m_linksetCapacity; } + } + public int AgentCapacity { get { return m_agentCapacity; } @@ -654,6 +660,9 @@ namespace OpenSim.Framework m_objectCapacity = config.GetInt("MaxPrims", 15000); allKeys.Remove("MaxPrims"); + + m_linksetCapacity = config.GetInt("LinksetPrims", 0); + allKeys.Remove("LinksetPrims"); #endregion @@ -709,6 +718,9 @@ namespace OpenSim.Framework if (m_objectCapacity != 0) config.Set("MaxPrims", m_objectCapacity); + if (m_linksetCapacity != 0) + config.Set("LinksetPrims", m_linksetCapacity); + if (m_agentCapacity != 0) config.Set("MaxAgents", m_agentCapacity); @@ -804,6 +816,9 @@ namespace OpenSim.Framework configMember.addConfigurationOption("object_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Max objects this sim will hold", m_objectCapacity.ToString(), true); + configMember.addConfigurationOption("linkset_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, + "Max prims an object will hold", m_linksetCapacity.ToString(), true); + configMember.addConfigurationOption("agent_capacity", ConfigurationOption.ConfigurationTypes.TYPE_INT32, "Max avatars this sim will hold", m_agentCapacity.ToString(), true); @@ -922,6 +937,9 @@ namespace OpenSim.Framework case "object_capacity": m_objectCapacity = (int)configuration_result; break; + case "linkset_capacity": + m_linksetCapacity = (int)configuration_result; + break; case "agent_capacity": m_agentCapacity = (int)configuration_result; break; @@ -1052,4 +1070,4 @@ namespace OpenSim.Framework return kvp; } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index 4bce4169b0..5d8a278f23 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -49,8 +49,12 @@ using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; +[assembly: Addin("FlotsamAssetCache", "1.1")] +[assembly: AddinDependency("OpenSim", "0.5")] + namespace OpenSim.Region.CoreModules.Asset { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class FlotsamAssetCache : ISharedRegionModule, IImprovedAssetCache, IAssetService { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs index 9276d1a526..1c2bfd0dff 100644 --- a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs +++ b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs @@ -35,7 +35,6 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenMetaverse.Assets; -using OpenSim.Region.CoreModules.Asset; using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Serialization; diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index a09945e2a7..424e0ab384 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml @@ -34,7 +34,6 @@ - diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 4d65be9056..9bdaecfded 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -47,26 +47,71 @@ namespace OpenSim.Region.Framework.Scenes public delegate void OnFrameDelegate(); + /// + /// Triggered on each sim frame. + /// + /// + /// This gets triggered in + /// Core uses it for things like Sun, Wind & Clouds + /// The MRM module also uses it. + /// public event OnFrameDelegate OnFrame; public delegate void ClientMovement(ScenePresence client); + /// + /// Trigerred when an agent moves. + /// + /// + /// This gets triggered in + /// prior to + /// public event ClientMovement OnClientMovement; public delegate void OnTerrainTaintedDelegate(); + /// + /// Triggered if the terrain has been edited + /// + /// + /// This gets triggered in + /// after it determines that an update has been made. + /// public event OnTerrainTaintedDelegate OnTerrainTainted; public delegate void OnTerrainTickDelegate(); + /// + /// Triggered if the terrain has been edited + /// + /// + /// This gets triggered in + /// but is used by core solely to update the physics engine. + /// public event OnTerrainTickDelegate OnTerrainTick; public delegate void OnBackupDelegate(ISimulationDataService datastore, bool forceBackup); + /// + /// Triggered when a region is backed up/persisted to storage + /// + /// + /// This gets triggered in + /// and is fired before the persistence occurs. + /// public event OnBackupDelegate OnBackup; public delegate void OnClientConnectCoreDelegate(IClientCore client); + /// + /// Triggered when a new client connects to the scene. + /// + /// + /// This gets triggered in , + /// which checks if an instance of + /// also implements and as such, + /// is not triggered by NPCs. + /// public event OnClientConnectCoreDelegate OnClientConnect; public delegate void OnNewClientDelegate(IClientAPI client); @@ -87,10 +132,24 @@ namespace OpenSim.Region.Framework.Scenes public delegate void OnNewPresenceDelegate(ScenePresence presence); + /// + /// Triggered when a new presence is added to the scene + /// + /// + /// Triggered in which is used by both + /// users and NPCs + /// public event OnNewPresenceDelegate OnNewPresence; public delegate void OnRemovePresenceDelegate(UUID agentId); + /// + /// Triggered when a presence is removed from the scene + /// + /// + /// Triggered in which is used by both + /// users and NPCs + /// public event OnRemovePresenceDelegate OnRemovePresence; public delegate void OnParcelPrimCountUpdateDelegate(); @@ -481,6 +540,9 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// True if the duplicate will immediately be in the scene, false otherwise + /// + /// Triggered in + /// public event SceneObjectPartCopyDelegate OnSceneObjectPartCopy; public delegate void SceneObjectPartCopyDelegate(SceneObjectPart copy, SceneObjectPart original, bool userExposed); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ff3d3af863..c2c0b96013 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -123,6 +123,11 @@ namespace OpenSim.Region.Framework.Scenes /// public float m_maxPhys = 10; + /// + /// Max prims an object will hold + /// + public int m_linksetCapacity = 0; + public bool m_clampPrimSize; public bool m_trustBinaries; public bool m_allowScriptCrossings; @@ -772,6 +777,12 @@ namespace OpenSim.Region.Framework.Scenes m_clampPrimSize = true; } + m_linksetCapacity = startupConfig.GetInt("LinksetPrims", m_linksetCapacity); + if (RegionInfo.LinksetCapacity > 0) + { + m_linksetCapacity = RegionInfo.LinksetCapacity; + } + m_useTrashOnDelete = startupConfig.GetBoolean("UseTrashOnDelete", m_useTrashOnDelete); m_trustBinaries = startupConfig.GetBoolean("TrustBinaries", m_trustBinaries); m_allowScriptCrossings = startupConfig.GetBoolean("AllowScriptCrossing", m_allowScriptCrossings); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index b4a155e940..e528288699 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -2014,6 +2014,24 @@ namespace OpenSim.Region.Framework.Scenes if (objectGroup == this) return; + // If the configured linkset capacity is greater than zero, + // and the new linkset would have a prim count higher than this + // value, do not link it. + if (m_scene.m_linksetCapacity > 0 && + (PrimCount + objectGroup.PrimCount) > + m_scene.m_linksetCapacity) + { + m_log.DebugFormat( + "[SCENE OBJECT GROUP]: Cannot link group with root" + + " part {0}, {1} ({2} prims) to group with root part" + + " {3}, {4} ({5} prims) because the new linkset" + + " would exceed the configured maximum of {6}", + objectGroup.RootPart.Name, objectGroup.RootPart.UUID, + objectGroup.PrimCount, RootPart.Name, RootPart.UUID, + PrimCount, m_scene.m_linksetCapacity); + return; + } + // 'linkPart' == the root of the group being linked into this group SceneObjectPart linkPart = objectGroup.m_rootPart; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index cde2d9f068..6809c09d05 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs @@ -254,7 +254,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api object[] convertedParms = new object[parms.Length]; for (int i = 0; i < parms.Length; i++) - convertedParms[i] = ConvertFromLSL(parms[i],signature[i]); + convertedParms[i] = ConvertFromLSL(parms[i],signature[i], fname); // now call the function, the contract with the function is that it will always return // non-null but don't trust it completely @@ -294,7 +294,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api /// /// - protected object ConvertFromLSL(object lslparm, Type type) + protected object ConvertFromLSL(object lslparm, Type type, string fname) { // ---------- String ---------- if (lslparm is LSL_String) @@ -374,14 +374,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api (LSL_Vector)plist[i]); } else - MODError("unknown LSL list element type"); + MODError(String.Format("{0}: unknown LSL list element type", fname)); } return result; } } - MODError(String.Format("parameter type mismatch; expecting {0}",type.Name)); + MODError(String.Format("{1}: parameter type mismatch; expecting {0}",type.Name, fname)); return null; } diff --git a/bin/OpenSim.ini.example b/bin/OpenSim.ini.example index eac30b85a8..f0ebcce0b2 100644 --- a/bin/OpenSim.ini.example +++ b/bin/OpenSim.ini.example @@ -107,6 +107,11 @@ ;; If a viewer attempts to rez a prim larger than the non-physical or physical prim max, clamp the dimensions to the appropriate maximum ;; This can be overriden in the region config file. ; ClampPrimSize = false + + ;# {LinksetPrims} {} {Max prims an object will hold?} {} 0 + ;; Maximum number of prims allowable in a linkset. Affects creating new linksets. Ignored if less than or equal to zero. + ;; This can be overriden in the region config file. + ; LinksetPrims = 0 ;# {AllowScriptCrossing} {} {Allow scripts to cross into this region} {true false} true ;; Allow scripts to keep running when they cross region boundaries, rather than being restarted. State is reloaded on the destination region. diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index dbd3e3a039..c080fbf1b3 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -94,6 +94,10 @@ ; If a viewer attempts to rez a prim larger than the non-physical or physical prim max, clamp the dimensions to the appropriate maximum ; This can be overriden in the region config file. ClampPrimSize = false + + ; Maximum number of prims allowable in a linkset. Affects creating new linksets. Ignored if less than or equal to zero. + ; This can be overriden in the region config file. + LinksetPrims = 0 ; Allow scripts to keep running when they cross region boundaries, rather than being restarted. State is reloaded on the destination region. ; This only applies when crossing to a region running in a different simulator.