From ec3c31e61e5e540f822891110df9bc978655bbaf Mon Sep 17 00:00:00 2001 From: Revolution Date: Fri, 22 Jan 2010 18:09:33 -0600 Subject: Updates all IRegionModules to the new style region modules. Signed-off-by: Melanie --- .../CoreModules/World/Archiver/ArchiverModule.cs | 1 + .../Region/CoreModules/World/Cloud/CloudModule.cs | 30 ++- .../World/Estate/EstateManagementModule.cs | 58 +++--- .../World/Permissions/PermissionsModule.cs | 212 +++++++++++++-------- .../Region/CoreModules/World/Sound/SoundModule.cs | 33 +++- OpenSim/Region/CoreModules/World/Sun/SunModule.cs | 96 +++++----- .../World/Vegetation/VegetationModule.cs | 27 ++- .../Region/CoreModules/World/Wind/WindModule.cs | 45 +++-- .../CoreModules/World/WorldMap/MapImageModule.cs | 30 ++- .../CoreModules/World/WorldMap/MapSearchModule.cs | 35 +++- 10 files changed, 370 insertions(+), 197 deletions(-) (limited to 'OpenSim/Region/CoreModules/World') diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index fc8d4e1..c738b65 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs @@ -81,6 +81,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver public void RemoveRegion(Scene scene) { + scene.UnregisterModuleInterface(this); } public void Close() diff --git a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs index 5fa3dc2..a2cfce6 100644 --- a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs +++ b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs @@ -27,6 +27,7 @@ using System; using System.Collections.Generic; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -35,6 +36,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class CloudModule : ICloudModule { // private static readonly log4net.ILog m_log @@ -48,7 +50,7 @@ namespace OpenSim.Region.CoreModules private float m_cloudDensity = 1.0F; private float[] cloudCover = new float[16 * 16]; - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { IConfig cloudConfig = config.Configs["Cloud"]; @@ -58,10 +60,17 @@ namespace OpenSim.Region.CoreModules m_cloudDensity = cloudConfig.GetFloat("density", 0.5F); m_frameUpdateRate = cloudConfig.GetInt("cloud_update_rate", 1000); } + } + + public Type ReplaceableInterface + { + get { return null; } + } + public void AddRegion(Scene scene) + { if (m_enabled) { - m_scene = scene; scene.EventManager.OnNewClient += CloudsToClient; @@ -71,9 +80,18 @@ namespace OpenSim.Region.CoreModules GenerateCloudCover(); m_ready = true; - } + } + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + scene.EventManager.OnNewClient -= CloudsToClient; + scene.UnregisterModuleInterface(this); + scene.EventManager.OnFrame -= CloudUpdate; } public void PostInitialise() @@ -96,12 +114,6 @@ namespace OpenSim.Region.CoreModules get { return "CloudModule"; } } - public bool IsSharedModule - { - get { return false; } - } - - public float CloudCover(int x, int y, int z) { float cover = 0f; diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 695cced..39836ae 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -30,6 +30,7 @@ using System.IO; using System.Reflection; using System.Security; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -38,6 +39,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.World.Estate { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class EstateManagementModule : IEstateModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -898,7 +900,16 @@ namespace OpenSim.Region.CoreModules.World.Estate #region IRegionModule Members - public void Initialise(Scene scene, IConfigSource source) + public void Initialise(IConfigSource source) + { + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void AddRegion(Scene scene) { m_scene = scene; m_scene.RegisterModuleInterface(this); @@ -920,6 +931,29 @@ namespace OpenSim.Region.CoreModules.World.Estate consoleSetTerrainHeights); } + public void RegionLoaded(Scene scene) + { + // Sets up the sun module based on the saved Estate and Region Settings + // DO NOT REMOVE or the sun will stop working + TriggerEstateToolsSunUpdate(); + } + + public void RemoveRegion(Scene scene) + { + scene.UnregisterModuleInterface(this); + scene.EventManager.OnNewClient -= EventManager_OnNewClient; + scene.EventManager.OnRequestChangeWaterHeight -= changeWaterHeight; + } + + public void Close() + { + } + + public string Name + { + get { return "EstateManagementModule"; } + } + #region Console Commands public void consoleSetTerrainTexture(string module, string[] args) @@ -1006,28 +1040,6 @@ namespace OpenSim.Region.CoreModules.World.Estate } #endregion - - public void PostInitialise() - { - // Sets up the sun module based no the saved Estate and Region Settings - // DO NOT REMOVE or the sun will stop working - TriggerEstateToolsSunUpdate(); - } - - public void Close() - { - } - - public string Name - { - get { return "EstateManagementModule"; } - } - - public bool IsSharedModule - { - get { return false; } - } - #endregion #region Other Functions diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index f66f01f..68e8485 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -89,7 +90,8 @@ enum GroupPowers : long namespace OpenSim.Region.CoreModules.World.Permissions { - public class PermissionsModule : IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class PermissionsModule : INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -148,12 +150,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions #endregion - #region IRegionModule Members + #region INonSharedRegionModule Members - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { - m_scene = scene; - IConfig myConfig = config.Configs["Startup"]; string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule"); @@ -177,7 +177,57 @@ namespace OpenSim.Region.CoreModules.World.Permissions if (m_bypassPermissions) m_log.Info("[PERMISSIONS]: serviceside_object_permissions = false in ini file so disabling all region service permission checks"); else - m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks"); + m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks"); + + string grant = myConfig.GetString("GrantLSL",""); + if (grant.Length > 0) { + foreach (string uuidl in grant.Split(',')) { + string uuid = uuidl.Trim(" \t".ToCharArray()); + GrantLSL.Add(uuid, true); + } + } + + grant = myConfig.GetString("GrantCS",""); + if (grant.Length > 0) { + foreach (string uuidl in grant.Split(',')) { + string uuid = uuidl.Trim(" \t".ToCharArray()); + GrantCS.Add(uuid, true); + } + } + + grant = myConfig.GetString("GrantVB",""); + if (grant.Length > 0) { + foreach (string uuidl in grant.Split(',')) { + string uuid = uuidl.Trim(" \t".ToCharArray()); + GrantVB.Add(uuid, true); + } + } + + grant = myConfig.GetString("GrantJS", ""); + if (grant.Length > 0) + { + foreach (string uuidl in grant.Split(',')) + { + string uuid = uuidl.Trim(" \t".ToCharArray()); + GrantJS.Add(uuid, true); + } + } + + grant = myConfig.GetString("GrantYP", ""); + if (grant.Length > 0) + { + foreach (string uuidl in grant.Split(',')) + { + string uuid = uuidl.Trim(" \t".ToCharArray()); + GrantYP.Add(uuid, true); + } + } + + } + + public void AddRegion(Scene scene) + { + m_scene = scene; //Register functions with Scene External Checks! m_scene.Permissions.OnBypassPermissions += BypassPermissions; @@ -210,23 +260,23 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_scene.Permissions.OnLinkObject += CanLinkObject; //NOT YET IMPLEMENTED m_scene.Permissions.OnDelinkObject += CanDelinkObject; //NOT YET IMPLEMENTED m_scene.Permissions.OnBuyLand += CanBuyLand; //NOT YET IMPLEMENTED - + m_scene.Permissions.OnViewNotecard += CanViewNotecard; //NOT YET IMPLEMENTED m_scene.Permissions.OnViewScript += CanViewScript; //NOT YET IMPLEMENTED m_scene.Permissions.OnEditNotecard += CanEditNotecard; //NOT YET IMPLEMENTED m_scene.Permissions.OnEditScript += CanEditScript; //NOT YET IMPLEMENTED - + m_scene.Permissions.OnCreateObjectInventory += CanCreateObjectInventory; //NOT IMPLEMENTED HERE m_scene.Permissions.OnEditObjectInventory += CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED m_scene.Permissions.OnCopyObjectInventory += CanCopyObjectInventory; //NOT YET IMPLEMENTED m_scene.Permissions.OnDeleteObjectInventory += CanDeleteObjectInventory; //NOT YET IMPLEMENTED m_scene.Permissions.OnResetScript += CanResetScript; - + m_scene.Permissions.OnCreateUserInventory += CanCreateUserInventory; //NOT YET IMPLEMENTED m_scene.Permissions.OnCopyUserInventory += CanCopyUserInventory; //NOT YET IMPLEMENTED m_scene.Permissions.OnEditUserInventory += CanEditUserInventory; //NOT YET IMPLEMENTED m_scene.Permissions.OnDeleteUserInventory += CanDeleteUserInventory; //NOT YET IMPLEMENTED - + m_scene.Permissions.OnTeleport += CanTeleport; //NOT YET IMPLEMENTED m_scene.Permissions.OnUseObjectReturn += CanUseObjectReturn; //NOT YET IMPLEMENTED @@ -244,52 +294,87 @@ namespace OpenSim.Region.CoreModules.World.Permissions "debug permissions ", "Enable permissions debugging", HandleDebugPermissions); - - - string grant = myConfig.GetString("GrantLSL",""); - if (grant.Length > 0) { - foreach (string uuidl in grant.Split(',')) { - string uuid = uuidl.Trim(" \t".ToCharArray()); - GrantLSL.Add(uuid, true); - } - } + } - grant = myConfig.GetString("GrantCS",""); - if (grant.Length > 0) { - foreach (string uuidl in grant.Split(',')) { - string uuid = uuidl.Trim(" \t".ToCharArray()); - GrantCS.Add(uuid, true); - } - } + public Type ReplaceableInterface + { + get { return null; } + } - grant = myConfig.GetString("GrantVB",""); - if (grant.Length > 0) { - foreach (string uuidl in grant.Split(',')) { - string uuid = uuidl.Trim(" \t".ToCharArray()); - GrantVB.Add(uuid, true); - } - } + public void RegionLoaded(Scene scene) + { + m_friendsModule = m_scene.RequestModuleInterface(); - grant = myConfig.GetString("GrantJS", ""); - if (grant.Length > 0) - { - foreach (string uuidl in grant.Split(',')) - { - string uuid = uuidl.Trim(" \t".ToCharArray()); - GrantJS.Add(uuid, true); - } - } + if (m_friendsModule == null) + m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work"); + else + m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled"); + } - grant = myConfig.GetString("GrantYP", ""); - if (grant.Length > 0) - { - foreach (string uuidl in grant.Split(',')) - { - string uuid = uuidl.Trim(" \t".ToCharArray()); - GrantYP.Add(uuid, true); - } - } + public void RemoveRegion(Scene scene) + { + scene.Permissions.OnBypassPermissions -= BypassPermissions; + scene.Permissions.OnSetBypassPermissions -= SetBypassPermissions; + scene.Permissions.OnPropagatePermissions -= PropagatePermissions; + scene.Permissions.OnGenerateClientFlags -= GenerateClientFlags; + scene.Permissions.OnAbandonParcel -= CanAbandonParcel; + scene.Permissions.OnReclaimParcel -= CanReclaimParcel; + scene.Permissions.OnDeedParcel -= CanDeedParcel; + scene.Permissions.OnDeedObject -= CanDeedObject; + scene.Permissions.OnIsGod -= IsGod; + scene.Permissions.OnDuplicateObject -= CanDuplicateObject; + scene.Permissions.OnDeleteObject -= CanDeleteObject; //MAYBE FULLY IMPLEMENTED + scene.Permissions.OnEditObject -= CanEditObject; //MAYBE FULLY IMPLEMENTED + scene.Permissions.OnEditParcel -= CanEditParcel; //MAYBE FULLY IMPLEMENTED + scene.Permissions.OnInstantMessage -= CanInstantMessage; + scene.Permissions.OnInventoryTransfer -= CanInventoryTransfer; //NOT YET IMPLEMENTED + scene.Permissions.OnIssueEstateCommand -= CanIssueEstateCommand; //FULLY IMPLEMENTED + scene.Permissions.OnMoveObject -= CanMoveObject; //MAYBE FULLY IMPLEMENTED + scene.Permissions.OnObjectEntry -= CanObjectEntry; + scene.Permissions.OnReturnObject -= CanReturnObject; //NOT YET IMPLEMENTED + scene.Permissions.OnRezObject -= CanRezObject; //MAYBE FULLY IMPLEMENTED + scene.Permissions.OnRunConsoleCommand -= CanRunConsoleCommand; + scene.Permissions.OnRunScript -= CanRunScript; //NOT YET IMPLEMENTED + scene.Permissions.OnCompileScript -= CanCompileScript; + scene.Permissions.OnSellParcel -= CanSellParcel; + scene.Permissions.OnTakeObject -= CanTakeObject; + scene.Permissions.OnTakeCopyObject -= CanTakeCopyObject; + scene.Permissions.OnTerraformLand -= CanTerraformLand; + scene.Permissions.OnLinkObject -= CanLinkObject; //NOT YET IMPLEMENTED + scene.Permissions.OnDelinkObject -= CanDelinkObject; //NOT YET IMPLEMENTED + scene.Permissions.OnBuyLand -= CanBuyLand; //NOT YET IMPLEMENTED + + scene.Permissions.OnViewNotecard -= CanViewNotecard; //NOT YET IMPLEMENTED + scene.Permissions.OnViewScript -= CanViewScript; //NOT YET IMPLEMENTED + scene.Permissions.OnEditNotecard -= CanEditNotecard; //NOT YET IMPLEMENTED + scene.Permissions.OnEditScript -= CanEditScript; //NOT YET IMPLEMENTED + + scene.Permissions.OnCreateObjectInventory -= CanCreateObjectInventory; //NOT IMPLEMENTED HERE + scene.Permissions.OnEditObjectInventory -= CanEditObjectInventory;//MAYBE FULLY IMPLEMENTED + scene.Permissions.OnCopyObjectInventory -= CanCopyObjectInventory; //NOT YET IMPLEMENTED + scene.Permissions.OnDeleteObjectInventory -= CanDeleteObjectInventory; //NOT YET IMPLEMENTED + scene.Permissions.OnResetScript -= CanResetScript; + + scene.Permissions.OnCreateUserInventory -= CanCreateUserInventory; //NOT YET IMPLEMENTED + scene.Permissions.OnCopyUserInventory -= CanCopyUserInventory; //NOT YET IMPLEMENTED + scene.Permissions.OnEditUserInventory -= CanEditUserInventory; //NOT YET IMPLEMENTED + scene.Permissions.OnDeleteUserInventory -= CanDeleteUserInventory; //NOT YET IMPLEMENTED + + scene.Permissions.OnTeleport -= CanTeleport; //NOT YET IMPLEMENTED + scene.Permissions.OnUseObjectReturn -= CanUseObjectReturn; //NOT YET IMPLEMENTED + } + + public void PostInitialise() + { + } + + public void Close() + { + } + public string Name + { + get { return "PermissionsModule"; } } public void HandleBypassPermissions(string module, string[] args) @@ -362,31 +447,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions m_log.InfoFormat("[PERMISSIONS] Set permissions debugging to {0} in {1}", m_debugPermissions, m_scene.RegionInfo.RegionName); } } - - public void PostInitialise() - { - m_friendsModule = m_scene.RequestModuleInterface(); - - if (m_friendsModule == null) - m_log.Error("[PERMISSIONS]: Friends module not found, friend permissions will not work"); - else - m_log.Info("[PERMISSIONS]: Friends module found, friend permissions enabled"); - } - - public void Close() - { - } - - public string Name - { - get { return "PermissionsModule"; } - } - - public bool IsSharedModule - { - get { return false; } - } - #endregion #region Helper Functions diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index 37f1f2e..ed7bfe1 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs @@ -26,6 +26,7 @@ */ using System; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -34,26 +35,44 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.World.Sound { - public class SoundModule : IRegionModule, ISoundModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class SoundModule : INonSharedRegionModule, ISoundModule { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected Scene m_scene; - public void Initialise(Scene scene, IConfigSource source) + public void Initialise(IConfigSource source) + { + } + + public void AddRegion(Scene scene) { m_scene = scene; - + m_scene.EventManager.OnNewClient += OnNewClient; - + m_scene.RegisterModuleInterface(this); } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + scene.EventManager.OnNewClient -= OnNewClient; + scene.UnregisterModuleInterface(this); + } - public void PostInitialise() {} public void Close() {} public string Name { get { return "Sound Module"; } } - public bool IsSharedModule { get { return false; } } - + private void OnNewClient(IClientAPI client) { client.OnSoundTrigger += TriggerSound; diff --git a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs index 0712a7f..948c47c 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -37,6 +38,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class SunModule : ISunModule { /// @@ -278,27 +280,12 @@ namespace OpenSim.Region.CoreModules return GetCurrentSunHour() + 6.0f; } - #region IRegion Methods + #region INonSharedRegionModule Methods // Called immediately after the module is loaded for a given region // i.e. Immediately after instance creation. - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { - m_scene = scene; - m_frame = 0; - - // This one puts an entry in the main help screen - m_scene.AddCommand(this, String.Empty, "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null); - - // This one enables the ability to type just "sun" without any parameters - m_scene.AddCommand(this, "sun", "", "", HandleSunConsoleCommand); - foreach (KeyValuePair kvp in GetParamList()) - { - m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand); - } - - - TimeZone local = TimeZone.CurrentTimeZone; TicksUTCOffset = local.GetUtcOffset(local.ToLocalTime(DateTime.Now)).Ticks; m_log.Debug("[SUN]: localtime offset is " + TicksUTCOffset); @@ -346,7 +333,43 @@ namespace OpenSim.Region.CoreModules // m_latitude = d_latitude; // m_longitude = d_longitude; } + } + + public void Close() + { + ready = false; + + // Remove our hooks + m_scene.EventManager.OnFrame -= SunUpdate; + m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; + m_scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate; + m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; + } + + public string Name + { + get { return "SunModule"; } + } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void AddRegion(Scene scene) + { + m_scene = scene; + m_frame = 0; + + // This one puts an entry in the main help screen + m_scene.AddCommand(this, String.Empty, "sun", "Usage: sun [param] [value] - Get or Update Sun module paramater", null); + // This one enables the ability to type just "sun" without any parameters + m_scene.AddCommand(this, "sun", "", "", HandleSunConsoleCommand); + foreach (KeyValuePair kvp in GetParamList()) + { + m_scene.AddCommand(this, String.Format("sun {0}", kvp.Key), String.Format("{0} - {1}", kvp.Key, kvp.Value), "", HandleSunConsoleCommand); + } switch (m_RegionMode) { case "T1": @@ -354,8 +377,8 @@ namespace OpenSim.Region.CoreModules case "SL": // Time taken to complete a cycle (day and season) - SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60); - SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays); + SecondsPerSunCycle = (uint)(m_DayLengthHours * 60 * 60); + SecondsPerYear = (uint)(SecondsPerSunCycle * m_YearLengthDays); // Ration of real-to-virtual time @@ -364,17 +387,17 @@ namespace OpenSim.Region.CoreModules // Speed of rotation needed to complete a cycle in the // designated period (day and season) - SunSpeed = m_SunCycle/SecondsPerSunCycle; - SeasonSpeed = m_SeasonalCycle/SecondsPerYear; + SunSpeed = m_SunCycle / SecondsPerSunCycle; + SeasonSpeed = m_SeasonalCycle / SecondsPerYear; // Horizon translation - HorizonShift = m_HorizonShift; // Z axis translation + HorizonShift = m_HorizonShift; // Z axis translation // HoursToRadians = (SunCycle/24)*VWTimeRatio; // Insert our event handling hooks - scene.EventManager.OnFrame += SunUpdate; + scene.EventManager.OnFrame += SunUpdate; scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate; scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour; @@ -391,34 +414,21 @@ namespace OpenSim.Region.CoreModules } scene.RegisterModuleInterface(this); - } - - public void PostInitialise() + public void RegionLoaded(Scene scene) { } - public void Close() - { - ready = false; - - // Remove our hooks - m_scene.EventManager.OnFrame -= SunUpdate; - m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; - m_scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate; - m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; - } - - public string Name + public void RemoveRegion(Scene scene) { - get { return "SunModule"; } + scene.RegisterModuleInterface(this); + scene.EventManager.OnFrame -= SunUpdate; + scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; + scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate; + scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; } - public bool IsSharedModule - { - get { return false; } - } #endregion #region EventManager Events diff --git a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs index c2ad7b8..0b487ed 100644 --- a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs +++ b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs @@ -28,6 +28,7 @@ using System; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -36,7 +37,8 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.Vegetation { - public class VegetationModule : IRegionModule, IVegetationModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class VegetationModule : INonSharedRegionModule, IVegetationModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -45,17 +47,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Vegetation protected static readonly PCode[] creationCapabilities = new PCode[] { PCode.Grass, PCode.NewTree, PCode.Tree }; public PCode[] CreationCapabilities { get { return creationCapabilities; } } - public void Initialise(Scene scene, IConfigSource source) + public void Initialise(IConfigSource source) + { + } + + public void AddRegion(Scene scene) { m_scene = scene; m_scene.RegisterModuleInterface(this); } + + public Type ReplaceableInterface + { + get { return null; } + } + + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + scene.UnregisterModuleInterface(this); + } public void PostInitialise() {} public void Close() {} public string Name { get { return "Vegetation Module"; } } - public bool IsSharedModule { get { return false; } } - + public SceneObjectGroup AddTree( UUID uuid, UUID groupID, Vector3 scale, Quaternion rotation, Vector3 position, Tree treeType, bool newTree) { diff --git a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs index 3283c1f..cd3706d 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs @@ -55,17 +55,19 @@ namespace OpenSim.Region.CoreModules private IWindModelPlugin m_activeWindPlugin = null; private const string m_dWindPluginName = "SimpleRandomWind"; + private string m_desiredWindPlugin = "SimpleRandomWind"; private Dictionary m_availableWindPlugins = new Dictionary(); // Simplified windSpeeds based on the fact that the client protocal tracks at a resolution of 16m private Vector2[] windSpeeds = new Vector2[16 * 16]; + private IConfig windConfig; #region IRegion Methods - public void Initialise(Scene scene, IConfigSource config) + public void Initialise(IConfigSource config) { - IConfig windConfig = config.Configs["Wind"]; - string desiredWindPlugin = m_dWindPluginName; + windConfig = config.Configs["Wind"]; + m_desiredWindPlugin = m_dWindPluginName; if (windConfig != null) { @@ -76,10 +78,18 @@ namespace OpenSim.Region.CoreModules // Determine which wind model plugin is desired if (windConfig.Contains("wind_plugin")) { - desiredWindPlugin = windConfig.GetString("wind_plugin"); + m_desiredWindPlugin = windConfig.GetString("wind_plugin"); } } + } + + public Type ReplaceableInterface + { + get { return null; } + } + public void AddRegion(Scene scene) + { if (m_enabled) { m_log.InfoFormat("[WIND] Enabled with an update rate of {0} frames.", m_frameUpdateRate); @@ -95,30 +105,30 @@ namespace OpenSim.Region.CoreModules } // Check for desired plugin - if (m_availableWindPlugins.ContainsKey(desiredWindPlugin)) + if (m_availableWindPlugins.ContainsKey(m_desiredWindPlugin)) { - m_activeWindPlugin = m_availableWindPlugins[desiredWindPlugin]; + m_activeWindPlugin = m_availableWindPlugins[m_desiredWindPlugin]; - m_log.InfoFormat("[WIND] {0} plugin found, initializing.", desiredWindPlugin); + m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_desiredWindPlugin); if (windConfig != null) { m_activeWindPlugin.Initialise(); m_activeWindPlugin.WindConfig(m_scene, windConfig); } - } + } // if the plug-in wasn't found, default to no wind. if (m_activeWindPlugin == null) { - m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", desiredWindPlugin); + m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", m_desiredWindPlugin); m_log.ErrorFormat("[WIND] Defaulting to no wind."); } // This one puts an entry in the main help screen m_scene.AddCommand(this, String.Empty, "wind", "Usage: wind [value] - Get or Update Wind paramaters", null); - + // This one enables the ability to type just the base command without any parameters m_scene.AddCommand(this, "wind", "", "", HandleConsoleCommand); @@ -127,7 +137,7 @@ namespace OpenSim.Region.CoreModules { m_scene.AddCommand(this, String.Format("wind base wind_plugin {0}", windPlugin.Name), String.Format("{0} - {1}", windPlugin.Name, windPlugin.Description), "", HandleConsoleBaseCommand); m_scene.AddCommand(this, String.Format("wind base wind_update_rate"), "Change the wind update rate.", "", HandleConsoleBaseCommand); - + foreach (KeyValuePair kvp in windPlugin.WindParams()) { m_scene.AddCommand(this, String.Format("wind {0} {1}", windPlugin.Name, kvp.Key), String.Format("{0} : {1} - {2}", windPlugin.Name, kvp.Key, kvp.Value), "", HandleConsoleParamCommand); @@ -149,11 +159,17 @@ namespace OpenSim.Region.CoreModules m_ready = true; } + } + public void RegionLoaded(Scene scene) + { } - public void PostInitialise() + public void RemoveRegion(Scene scene) { + scene.EventManager.OnFrame -= WindUpdate; + scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion; + scene.UnregisterModuleInterface(this); } public void Close() @@ -182,11 +198,6 @@ namespace OpenSim.Region.CoreModules get { return "WindModule"; } } - public bool IsSharedModule - { - get { return false; } - } - #endregion diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs index 285d36a..6bda1e9 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs @@ -30,6 +30,7 @@ using System.Collections.Generic; using System.Drawing; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.Imaging; @@ -59,7 +60,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap public face[] trns; } - public class MapImageModule : IMapImageGenerator, IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class MapImageModule : IMapImageGenerator, INonSharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -128,37 +130,45 @@ namespace OpenSim.Region.CoreModules.World.WorldMap #endregion - #region IRegionModule Members + #region INonSharedRegionModule Members - public void Initialise(Scene scene, IConfigSource source) + public void Initialise(IConfigSource source) { - m_scene = scene; m_config = source; IConfig startupConfig = m_config.Configs["Startup"]; if (startupConfig.GetString("MapImageModule", "MapImageModule") != "MapImageModule") return; + } + public void AddRegion(Scene scene) + { + m_scene = scene; m_scene.RegisterModuleInterface(this); } - public void PostInitialise() + public Type ReplaceableInterface { + get { return null; } } - public void Close() + public void RegionLoaded(Scene scene) { } - public string Name + public void RemoveRegion(Scene scene) { - get { return "MapImageModule"; } + scene.UnregisterModuleInterface(this); } - public bool IsSharedModule + public void Close() + { + } + + public string Name { - get { return false; } + get { return "MapImageModule"; } } #endregion diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index be46fa5..dd33673 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs @@ -24,9 +24,12 @@ * (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 System.Collections.Generic; using System.Reflection; using log4net; +using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -38,7 +41,8 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.World.WorldMap { - public class MapSearchModule : IRegionModule + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] + public class MapSearchModule : ISharedRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -46,8 +50,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap Scene m_scene = null; // only need one for communication with GridService List m_scenes = new List(); - #region IRegionModule Members - public void Initialise(Scene scene, IConfigSource source) + #region ISharedRegionModule Members + public void Initialise(IConfigSource source) + { + } + + public void AddRegion(Scene scene) { if (m_scene == null) { @@ -58,6 +66,22 @@ namespace OpenSim.Region.CoreModules.World.WorldMap scene.EventManager.OnNewClient += OnNewClient; } + public Type ReplaceableInterface + { + get { return null; } + } + + public void RegionLoaded(Scene scene) + { + } + + public void RemoveRegion(Scene scene) + { + if(m_scenes.Contains(scene)) + m_scenes.Remove(scene); + scene.EventManager.OnNewClient -= OnNewClient; + } + public void PostInitialise() { } @@ -73,11 +97,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap get { return "MapSearchModule"; } } - public bool IsSharedModule - { - get { return true; } - } - #endregion private void OnNewClient(IClientAPI client) -- cgit v1.1