From a87a247f0548d39a8c39b1d28123d7da8db44598 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 29 Jan 2010 07:20:13 +0000 Subject: Revert "Updates all IRegionModules to the new style region modules." This reverts commit ec3c31e61e5e540f822891110df9bc978655bbaf. --- .../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, 197 insertions(+), 370 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 c738b65..fc8d4e1 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs @@ -81,7 +81,6 @@ 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 a2cfce6..5fa3dc2 100644 --- a/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs +++ b/OpenSim/Region/CoreModules/World/Cloud/CloudModule.cs @@ -27,7 +27,6 @@ using System; using System.Collections.Generic; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -36,7 +35,6 @@ 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 @@ -50,7 +48,7 @@ namespace OpenSim.Region.CoreModules private float m_cloudDensity = 1.0F; private float[] cloudCover = new float[16 * 16]; - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { IConfig cloudConfig = config.Configs["Cloud"]; @@ -60,17 +58,10 @@ 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; @@ -80,18 +71,9 @@ 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() @@ -114,6 +96,12 @@ 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 39836ae..695cced 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -30,7 +30,6 @@ using System.IO; using System.Reflection; using System.Security; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -39,7 +38,6 @@ 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); @@ -900,16 +898,7 @@ namespace OpenSim.Region.CoreModules.World.Estate #region IRegionModule Members - public void Initialise(IConfigSource source) - { - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource source) { m_scene = scene; m_scene.RegisterModuleInterface(this); @@ -931,29 +920,6 @@ 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) @@ -1040,6 +1006,28 @@ 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 5b15065..1533462 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -29,7 +29,6 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -90,8 +89,7 @@ enum GroupPowers : long namespace OpenSim.Region.CoreModules.World.Permissions { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class PermissionsModule : INonSharedRegionModule + public class PermissionsModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -151,10 +149,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions #endregion - #region INonSharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { + m_scene = scene; + IConfig myConfig = config.Configs["Startup"]; string permissionModules = myConfig.GetString("permissionmodules", "DefaultPermissionsModule"); @@ -179,57 +179,7 @@ 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"); - - 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; + m_log.Debug("[PERMISSIONS]: Enabling all region service permission checks"); //Register functions with Scene External Checks! m_scene.Permissions.OnBypassPermissions += BypassPermissions; @@ -262,23 +212,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 @@ -296,87 +246,52 @@ namespace OpenSim.Region.CoreModules.World.Permissions "debug permissions ", "Enable permissions debugging", HandleDebugPermissions); - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void RegionLoaded(Scene scene) - { - m_friendsModule = m_scene.RequestModuleInterface(); + + + 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); + } + } - 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("GrantCS",""); + if (grant.Length > 0) { + foreach (string uuidl in grant.Split(',')) { + string uuid = uuidl.Trim(" \t".ToCharArray()); + GrantCS.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 - } + 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 PostInitialise() - { - } + grant = myConfig.GetString("GrantJS", ""); + if (grant.Length > 0) + { + foreach (string uuidl in grant.Split(',')) + { + string uuid = uuidl.Trim(" \t".ToCharArray()); + GrantJS.Add(uuid, true); + } + } - public void Close() - { - } + 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 string Name - { - get { return "PermissionsModule"; } } public void HandleBypassPermissions(string module, string[] args) @@ -449,6 +364,31 @@ 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 ed7bfe1..37f1f2e 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs @@ -26,7 +26,6 @@ */ using System; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -35,44 +34,26 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.World.Sound { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class SoundModule : INonSharedRegionModule, ISoundModule + public class SoundModule : IRegionModule, ISoundModule { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected Scene m_scene; - public void Initialise(IConfigSource source) - { - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource source) { 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 948c47c..0712a7f 100644 --- a/OpenSim/Region/CoreModules/World/Sun/SunModule.cs +++ b/OpenSim/Region/CoreModules/World/Sun/SunModule.cs @@ -29,7 +29,6 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -38,7 +37,6 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class SunModule : ISunModule { /// @@ -280,12 +278,27 @@ namespace OpenSim.Region.CoreModules return GetCurrentSunHour() + 6.0f; } - #region INonSharedRegionModule Methods + #region IRegion Methods // Called immediately after the module is loaded for a given region // i.e. Immediately after instance creation. - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, 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); @@ -333,43 +346,7 @@ 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": @@ -377,8 +354,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 @@ -387,17 +364,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; @@ -414,21 +391,34 @@ namespace OpenSim.Region.CoreModules } scene.RegisterModuleInterface(this); + } - public void RegionLoaded(Scene scene) + + public void PostInitialise() { } - public void RemoveRegion(Scene scene) + public void Close() { - scene.RegisterModuleInterface(this); - scene.EventManager.OnFrame -= SunUpdate; - scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; - scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate; - scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; + 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 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 0b487ed..c2ad7b8 100644 --- a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs +++ b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs @@ -28,7 +28,6 @@ using System; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -37,8 +36,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.Vegetation { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class VegetationModule : INonSharedRegionModule, IVegetationModule + public class VegetationModule : IRegionModule, IVegetationModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -47,34 +45,17 @@ 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(IConfigSource source) - { - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource source) { 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 cd3706d..3283c1f 100644 --- a/OpenSim/Region/CoreModules/World/Wind/WindModule.cs +++ b/OpenSim/Region/CoreModules/World/Wind/WindModule.cs @@ -55,19 +55,17 @@ 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(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { - windConfig = config.Configs["Wind"]; - m_desiredWindPlugin = m_dWindPluginName; + IConfig windConfig = config.Configs["Wind"]; + string desiredWindPlugin = m_dWindPluginName; if (windConfig != null) { @@ -78,18 +76,10 @@ namespace OpenSim.Region.CoreModules // Determine which wind model plugin is desired if (windConfig.Contains("wind_plugin")) { - m_desiredWindPlugin = windConfig.GetString("wind_plugin"); + 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); @@ -105,30 +95,30 @@ namespace OpenSim.Region.CoreModules } // Check for desired plugin - if (m_availableWindPlugins.ContainsKey(m_desiredWindPlugin)) + if (m_availableWindPlugins.ContainsKey(desiredWindPlugin)) { - m_activeWindPlugin = m_availableWindPlugins[m_desiredWindPlugin]; + m_activeWindPlugin = m_availableWindPlugins[desiredWindPlugin]; - m_log.InfoFormat("[WIND] {0} plugin found, initializing.", m_desiredWindPlugin); + m_log.InfoFormat("[WIND] {0} plugin found, initializing.", 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}", m_desiredWindPlugin); + m_log.ErrorFormat("[WIND] Could not find specified wind plug-in: {0}", 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); @@ -137,7 +127,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); @@ -159,17 +149,11 @@ namespace OpenSim.Region.CoreModules m_ready = true; } - } - public void RegionLoaded(Scene scene) - { } - public void RemoveRegion(Scene scene) + public void PostInitialise() { - scene.EventManager.OnFrame -= WindUpdate; - scene.EventManager.OnMakeRootAgent -= OnAgentEnteredRegion; - scene.UnregisterModuleInterface(this); } public void Close() @@ -198,6 +182,11 @@ 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 6bda1e9..285d36a 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs @@ -30,7 +30,6 @@ using System.Collections.Generic; using System.Drawing; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.Imaging; @@ -60,8 +59,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap public face[] trns; } - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class MapImageModule : IMapImageGenerator, INonSharedRegionModule + public class MapImageModule : IMapImageGenerator, IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -130,38 +128,25 @@ namespace OpenSim.Region.CoreModules.World.WorldMap #endregion - #region INonSharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource source) + public void Initialise(Scene scene, 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 Type ReplaceableInterface - { - get { return null; } - } - - public void RegionLoaded(Scene scene) + public void PostInitialise() { } - public void RemoveRegion(Scene scene) - { - scene.UnregisterModuleInterface(this); - } - public void Close() { } @@ -171,6 +156,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap get { return "MapImageModule"; } } + public bool IsSharedModule + { + get { return false; } + } + #endregion // TODO: unused: diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs index dd33673..be46fa5 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapSearchModule.cs @@ -24,12 +24,9 @@ * (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; @@ -41,8 +38,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.World.WorldMap { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class MapSearchModule : ISharedRegionModule + public class MapSearchModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -50,12 +46,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap Scene m_scene = null; // only need one for communication with GridService List m_scenes = new List(); - #region ISharedRegionModule Members - public void Initialise(IConfigSource source) - { - } - - public void AddRegion(Scene scene) + #region IRegionModule Members + public void Initialise(Scene scene, IConfigSource source) { if (m_scene == null) { @@ -66,22 +58,6 @@ 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() { } @@ -97,6 +73,11 @@ namespace OpenSim.Region.CoreModules.World.WorldMap get { return "MapSearchModule"; } } + public bool IsSharedModule + { + get { return true; } + } + #endregion private void OnNewClient(IClientAPI client) -- cgit v1.1