From a87a247f0548d39a8c39b1d28123d7da8db44598 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 29 Jan 2010 07:20:13 +0000 Subject: [PATCH 01/27] Revert "Updates all IRegionModules to the new style region modules." This reverts commit ec3c31e61e5e540f822891110df9bc978655bbaf. --- .../LoadRegions/LoadRegionsPlugin.cs | 4 +- OpenSim/Client/MXP/MXPModule.cs | 36 +-- .../AssetTransactionModule.cs | 35 +-- .../Agent/Capabilities/CapabilitiesModule.cs | 2 +- .../CoreModules/Agent/IPBan/IPBanModule.cs | 40 +-- .../TextureDownload/TextureDownloadModule.cs | 33 +-- .../Agent/TextureSender/J2KDecoderModule.cs | 33 +-- .../CoreModules/Agent/Xfer/XferModule.cs | 30 +- .../AvatarFactory/AvatarFactoryModule.cs | 31 +-- .../CoreModules/Avatar/Combat/CombatModule.cs | 32 +-- .../CoreModules/Avatar/Dialog/DialogModule.cs | 32 +-- .../Avatar/Friends/FriendsModule.cs | 54 +--- .../Avatar/Gestures/GesturesModule.cs | 30 +- .../CoreModules/Avatar/Gods/GodsModule.cs | 28 +- .../CoreModules/Avatar/Groups/GroupsModule.cs | 35 +-- .../InstantMessage/InstantMessageModule.cs | 53 ++-- .../InstantMessage/MessageTransferModule.cs | 54 ++-- .../Avatar/InstantMessage/MuteListModule.cs | 48 ++-- .../InstantMessage/OfflineMessageModule.cs | 41 +-- .../Avatar/InstantMessage/PresenceModule.cs | 65 ++--- .../Archiver/InventoryArchiverModule.cs | 35 +-- .../Transfer/InventoryTransferModule.cs | 65 ++--- .../CoreModules/Avatar/Lure/LureModule.cs | 61 +---- .../Avatar/ObjectCaps/ObjectAdd.cs | 55 ++-- .../Avatar/Profiles/AvatarProfilesModule.cs | 32 +-- .../EventQueue/EventQueueGetModule.cs | 42 ++- .../Framework/Monitoring/MonitorModule.cs | 103 +++---- .../Hypergrid/HGStandaloneLoginModule.cs | 83 +++--- .../Region/CoreModules/InterGrid/OGSRadmin.cs | 31 ++- .../InterGrid/OpenGridProtocolModule.cs | 108 +++----- .../DynamicTexture/DynamicTextureModule.cs | 60 ++-- .../Scripting/EMailModules/EmailModule.cs | 32 +-- .../HttpRequest/ScriptsHttpRequests.cs | 36 +-- .../Scripting/LSLHttp/UrlModule.cs | 2 - .../LoadImageURL/LoadImageURLModule.cs | 37 +-- .../VectorRender/VectorRenderModule.cs | 41 +-- .../Scripting/WorldComm/WorldCommModule.cs | 33 +-- .../Scripting/XMLRPC/XMLRPCModule.cs | 51 +--- .../Asset/AssetServiceInConnectorModule.cs | 2 +- .../Grid/HypergridServiceInConnectorModule.cs | 2 +- .../InventoryServiceInConnectorModule.cs | 2 +- .../Land/LandServiceInConnectorModule.cs | 2 +- .../NeighbourServiceInConnectorModule.cs | 2 +- .../SimulationServiceInConnectorModule.cs | 2 +- .../Interregion/LocalInterregionComms.cs | 4 +- .../Interregion/RESTInterregionComms.cs | 16 +- .../World/Archiver/ArchiverModule.cs | 1 - .../CoreModules/World/Cloud/CloudModule.cs | 30 +- .../World/Estate/EstateManagementModule.cs | 58 ++-- .../World/Permissions/PermissionsModule.cs | 256 +++++++----------- .../CoreModules/World/Sound/SoundModule.cs | 33 +-- .../Region/CoreModules/World/Sun/SunModule.cs | 150 +++++----- .../World/Vegetation/VegetationModule.cs | 27 +- .../CoreModules/World/Wind/WindModule.cs | 47 ++-- .../World/WorldMap/MapImageModule.cs | 30 +- .../World/WorldMap/MapSearchModule.cs | 35 +-- .../DataSnapshot/DataSnapshotManager.cs | 59 ++-- .../Framework/Interfaces/ICloudModule.cs | 2 +- .../Framework/Interfaces/IEmailModule.cs | 2 +- .../Framework/Interfaces/IEstateModule.cs | 2 +- .../Region/Framework/Interfaces/ISunModule.cs | 2 +- .../Framework/Interfaces/IWindModule.cs | 2 +- .../InternetRelayClientView/IRCStackModule.cs | 32 +-- .../FreeSwitchVoice/FreeSwitchVoiceModule.cs | 72 ++--- .../ContentManagementModule.cs | 47 ++-- .../Scripting/Minimodule/MRMModule.cs | 64 ++--- .../RegionReadyModule/RegionReadyModule.cs | 6 +- .../ScriptModuleCommsModule.cs | 1 - .../XmlRpcGridRouterModule.cs | 28 +- .../XmlRpcRouterModule/XmlRpcRouterModule.cs | 30 +- .../FreeswitchServiceInConnectorModule.cs | 2 +- .../SvnSerialiser/SvnBackupModule.cs | 28 +- .../OptionalModules/World/NPC/NPCModule.cs | 28 +- .../TreePopulator/TreePopulatorModule.cs | 41 ++- .../Region/UserStatistics/WebStatsModule.cs | 33 +-- .../Tests/Common/Setup/SceneSetupHelpers.cs | 9 +- 76 files changed, 940 insertions(+), 1872 deletions(-) diff --git a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs index 64863c5176..6fd3d301a5 100644 --- a/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs +++ b/OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs @@ -99,7 +99,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions regionLoader.SetIniConfigSource(m_openSim.ConfigSource.Source); RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); - /*m_log.Info("[LOADREGIONSPLUGIN]: Loading specific shared modules..."); + m_log.Info("[LOADREGIONSPLUGIN]: Loading specific shared modules..."); m_log.Info("[LOADREGIONSPLUGIN]: DynamicTextureModule..."); m_openSim.ModuleLoader.LoadDefaultSharedModule(new DynamicTextureModule()); m_log.Info("[LOADREGIONSPLUGIN]: InstantMessageModule..."); @@ -111,7 +111,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions m_log.Info("[LOADREGIONSPLUGIN]: AssetTransactionModule..."); m_openSim.ModuleLoader.LoadDefaultSharedModule(new AssetTransactionModule()); m_log.Info("[LOADREGIONSPLUGIN]: Done."); - */ + if (!CheckRegionsForSanity(regionsToLoad)) { m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations"); diff --git a/OpenSim/Client/MXP/MXPModule.cs b/OpenSim/Client/MXP/MXPModule.cs index 47417ab477..0b442cca15 100644 --- a/OpenSim/Client/MXP/MXPModule.cs +++ b/OpenSim/Client/MXP/MXPModule.cs @@ -31,7 +31,6 @@ using System.Reflection; using System.Text; using System.Timers; using log4net; -using Mono.Addins; using MXP; using Nini.Config; using OpenMetaverse; @@ -45,8 +44,7 @@ namespace OpenSim.Client.MXP /** * MXP Client Module which adds MXP support to client / region communication. */ - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class MXPModule : ISharedRegionModule + public class MXPModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -59,23 +57,15 @@ namespace OpenSim.Client.MXP private readonly Dictionary m_scenes = new Dictionary(); private bool m_shutdown; - public void Initialise(IConfigSource source) - { - m_config = source; - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource source) { if (!m_scenes.ContainsKey(scene.RegionInfo.RegionID)) m_scenes.Add(scene.RegionInfo.RegionID, scene); + + m_config = source; } - public void RegionLoaded(Scene scene) + public void PostInitialise() { if (m_config.Configs["MXP"] != null) { @@ -86,7 +76,7 @@ namespace OpenSim.Client.MXP m_port = con.GetInt("Port", m_port); - m_server = new MXPPacketServer(m_port, m_scenes, m_config.Configs["StandAlone"].GetBoolean("accounts_authenticate", true)); + m_server = new MXPPacketServer(m_port, m_scenes,m_config.Configs["StandAlone"].GetBoolean("accounts_authenticate",true)); m_ticker = new Timer(100); m_ticker.AutoReset = false; @@ -99,14 +89,6 @@ namespace OpenSim.Client.MXP } } - public void RemoveRegion(Scene scene) - { - } - - public void PostInitialise() - { - } - void ticker_Elapsed(object sender, ElapsedEventArgs e) { try @@ -139,5 +121,11 @@ namespace OpenSim.Client.MXP { get { return "MXP ClientStack Module"; } } + + public bool IsSharedModule + { + get { return true; } + } + } } diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs index 7012037834..1077f4a22f 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs @@ -27,7 +27,6 @@ using System; using System.Collections.Generic; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -36,8 +35,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Agent.AssetTransaction { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class AssetTransactionModule : ISharedRegionModule, IAgentAssetTransactions + public class AssetTransactionModule : IRegionModule, IAgentAssetTransactions { private readonly Dictionary RegisteredScenes = new Dictionary(); private bool m_dumpAssetsToFile = false; @@ -61,14 +59,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction //m_log.Debug("creating AgentAssetTransactionModule"); } - #region ISharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource config) - { - - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource config) { if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) { @@ -86,23 +79,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction m_scene = scene; } - public Type ReplaceableInterface - { - get { return null; } - } - - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - if (RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) - RegisteredScenes.Remove(scene.RegionInfo.RegionID); - scene.UnregisterModuleInterface(this); - scene.EventManager.OnNewClient -= NewClient; - } - public void PostInitialise() { } @@ -116,6 +92,11 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction get { return "AgentTransactionModule"; } } + public bool IsSharedModule + { + get { return true; } + } + #endregion public void NewClient(IClientAPI client) diff --git a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs index 886173fb45..2a1355b9ef 100644 --- a/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Capabilities/CapabilitiesModule.cs @@ -69,7 +69,7 @@ namespace OpenSim.Region.CoreModules.Agent.Capabilities public void RemoveRegion(Scene scene) { - scene.UnregisterModuleInterface(this); + m_scene.UnregisterModuleInterface(this); } public void PostInitialise() {} diff --git a/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs b/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs index f7f2eff487..bfe2a716af 100644 --- a/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs +++ b/OpenSim/Region/CoreModules/Agent/IPBan/IPBanModule.cs @@ -29,7 +29,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Text; -using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; @@ -37,27 +36,21 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Agent.IPBan { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class IPBanModule : ISharedRegionModule + public class IPBanModule : IRegionModule { - #region Implementation of ISharedRegionModule + #region Implementation of IRegionModule private List m_bans = new List(); - private Dictionary SceneBanners = new Dictionary(); - public void Initialise(IConfigSource source) + public void Initialise(Scene scene, IConfigSource source) { - } - - public void AddRegion(Scene scene) - { - SceneBanners.Add(scene, new SceneBanner(scene, m_bans)); + new SceneBanner(scene, m_bans); lock (m_bans) { foreach (EstateBan ban in scene.RegionInfo.EstateSettings.EstateBans) { - if (!String.IsNullOrEmpty(ban.BannedHostIPMask)) + if (!String.IsNullOrEmpty(ban.BannedHostIPMask)) m_bans.Add(ban.BannedHostIPMask); if (!String.IsNullOrEmpty(ban.BannedHostNameMask)) m_bans.Add(ban.BannedHostNameMask); @@ -65,12 +58,7 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan } } - public Type ReplaceableInterface - { - get { return null; } - } - - public void RegionLoaded(Scene scene) + public void PostInitialise() { if (File.Exists("bans.txt")) { @@ -82,18 +70,9 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan } } - public void RemoveRegion(Scene scene) - { - if(SceneBanners.ContainsKey(scene)) - SceneBanners.Remove(scene); - } - - public void PostInitialise() - { - } - public void Close() { + } public string Name @@ -101,6 +80,11 @@ namespace OpenSim.Region.CoreModules.Agent.IPBan get { return "IPBanModule"; } } + public bool IsSharedModule + { + get { return true; } + } + #endregion /// diff --git a/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs b/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs index c4d84cb51a..71ff28c8b5 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs @@ -30,7 +30,6 @@ using System.Collections.Generic; using System.Reflection; using System.Threading; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -42,8 +41,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Agent.TextureDownload { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class TextureDownloadModule : INonSharedRegionModule + public class TextureDownloadModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -67,14 +65,11 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload { } - #region INonSharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource config) - { - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource config) { + if (m_scene == null) { //m_log.Debug("Creating Texture download module"); @@ -95,21 +90,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload } } - public Type ReplaceableInterface + public void PostInitialise() { - 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 -= NewClient; - scene.EventManager.OnRemovePresence -= EventManager_OnRemovePresence; } public void Close() @@ -121,6 +103,11 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload get { return "TextureDownloadModule"; } } + public bool IsSharedModule + { + get { return false; } + } + #endregion /// diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs index ff87493831..7ac8bed012 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs @@ -32,7 +32,6 @@ using System.Reflection; using System.Text; using System.Threading; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.Imaging; @@ -46,8 +45,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender { public delegate void J2KDecodeDelegate(UUID assetID); - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class J2KDecoderModule : ISharedRegionModule, IJ2KDecoder + public class J2KDecoderModule : IRegionModule, IJ2KDecoder { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -60,19 +58,16 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender /// Reference to a scene (doesn't matter which one as long as it can load the cache module) private Scene m_scene; - #region ISharedRegionModule + #region IRegionModule public string Name { get { return "J2KDecoderModule"; } } - + public bool IsSharedModule { get { return true; } } + public J2KDecoderModule() { } - public void Initialise(IConfigSource source) - { - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource source) { if (m_scene == null) m_scene = scene; @@ -80,30 +75,16 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender scene.RegisterModuleInterface(this); } - public Type ReplaceableInterface - { - get { return null; } - } - - public void RegionLoaded(Scene scene) - { - m_cache = m_scene.RequestModuleInterface(); - } - - public void RemoveRegion(Scene scene) - { - scene.UnregisterModuleInterface(this); - } - public void PostInitialise() { + m_cache = m_scene.RequestModuleInterface(); } public void Close() { } - #endregion + #endregion IRegionModule #region IJ2KDecoder diff --git a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs index d062361b99..ef7dce812e 100644 --- a/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs +++ b/OpenSim/Region/CoreModules/Agent/Xfer/XferModule.cs @@ -27,7 +27,6 @@ using System; using System.Collections.Generic; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -36,8 +35,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Agent.Xfer { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class XferModule : INonSharedRegionModule, IXfer + public class XferModule : IRegionModule, IXfer { private Scene m_scene; private Dictionary Requests = new Dictionary(); @@ -54,13 +52,9 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer public DateTime timeStamp; } - #region INonSharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource config) - { - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource config) { m_scene = scene; m_scene.EventManager.OnNewClient += NewClient; @@ -68,19 +62,8 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer m_scene.RegisterModuleInterface(this); } - public Type ReplaceableInterface + public void PostInitialise() { - get { return null; } - } - - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - scene.EventManager.OnNewClient -= NewClient; - scene.UnregisterModuleInterface(this); } public void Close() @@ -92,6 +75,11 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer get { return "XferModule"; } } + public bool IsSharedModule + { + get { return false; } + } + #endregion #region IXfer Members diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 6bbbd56569..35c59aa6d7 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -28,7 +28,6 @@ using System; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -39,8 +38,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class AvatarFactoryModule : IAvatarFactory, ISharedRegionModule + public class AvatarFactoryModule : IAvatarFactory, IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene = null; @@ -77,16 +75,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory return appearance; } - public void Initialise(IConfigSource source) - { - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource source) { scene.RegisterModuleInterface(this); scene.EventManager.OnNewClient += NewClient; @@ -95,18 +84,9 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory { m_scene = scene; } + } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - scene.UnregisterModuleInterface(this); - scene.EventManager.OnNewClient -= NewClient; - } - public void PostInitialise() { } @@ -120,6 +100,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory get { return "Default Avatar Factory"; } } + public bool IsSharedModule + { + get { return false; } + } + public void NewClient(IClientAPI client) { client.OnAvatarNowWearing += AvatarIsWearing; diff --git a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs index b7d12aa7e7..61b6d65cc7 100644 --- a/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Combat/CombatModule.cs @@ -27,7 +27,6 @@ using System; using System.Collections.Generic; -using Mono.Addins; using Nini.Config; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -35,8 +34,7 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class CombatModule : ISharedRegionModule + public class CombatModule : IRegionModule { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -55,17 +53,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule /// /// /// - public void Initialise(IConfigSource config) - { - - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource config) { lock (m_scenel) { @@ -83,17 +71,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - scene.EventManager.OnAvatarKilled -= KillAvatar; - scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; - m_scenel.Remove(scene.RegionInfo.RegionHandle); - } - public void PostInitialise() { } @@ -107,6 +84,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule get { return "CombatModule"; } } + public bool IsSharedModule + { + get { return true; } + } + private void KillAvatar(uint killerObjectLocalID, ScenePresence DeadAvatar) { if (killerObjectLocalID == 0) diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index ecffc7ab66..72ec869c48 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs @@ -25,11 +25,9 @@ * 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; @@ -39,46 +37,28 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.Dialog { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class DialogModule : ISharedRegionModule, IDialogModule + public class DialogModule : IRegionModule, IDialogModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected Scene m_scene; - 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); - + m_scene.AddCommand( this, "alert", "alert ", "Send an alert to a user", HandleAlertConsoleCommand); m_scene.AddCommand( this, "alert general", "alert general ", "Send an alert to everyone", HandleAlertConsoleCommand); } - - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - scene.UnregisterModuleInterface(this); - } - - public void PostInitialise() { } + + public void PostInitialise() {} public void Close() {} public string Name { get { return "Dialog Module"; } } + public bool IsSharedModule { get { return false; } } public void SendAlertToUser(IClientAPI client, string message) { diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 7254180ab9..086d4fe69a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -31,7 +31,6 @@ using System.Collections.Generic; using System.Net; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; @@ -82,8 +81,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends - Terminate Friendship messages (single) */ - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class FriendsModule : ISharedRegionModule, IFriendsModule + public class FriendsModule : IRegionModule, IFriendsModule { private class Transaction { @@ -113,23 +111,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends private IGridService m_gridServices = null; - #region ISharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource config) - { - - } - - public void PostInitialise() - { - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource config) { lock (m_scenes) { @@ -144,9 +128,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends if (!m_scenes.ContainsKey(scene.RegionInfo.RegionHandle)) m_scenes[scene.RegionInfo.RegionHandle] = scene; } - + scene.RegisterModuleInterface(this); - + scene.EventManager.OnNewClient += OnNewClient; scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; @@ -154,34 +138,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends scene.EventManager.OnClientClosed += ClientClosed; } - public void RegionLoaded(Scene scene) + public void PostInitialise() { if (m_scenes.Count > 0) { - m_TransferModule = scene.RequestModuleInterface(); - m_gridServices = scene.GridService; + m_TransferModule = m_initialScene.RequestModuleInterface(); + m_gridServices = m_initialScene.GridService; } if (m_TransferModule == null) m_log.Error("[FRIENDS]: Unable to find a message transfer module, friendship offers will not work"); } - public void RemoveRegion(Scene scene) - { - MainServer.Instance.RemoveXmlRPCHandler("presence_update_bulk"); - MainServer.Instance.RemoveXmlRPCHandler("terminate_friend"); - - if (m_scenes.ContainsKey(scene.RegionInfo.RegionHandle)) - m_scenes.Remove(scene.RegionInfo.RegionHandle); - - scene.UnregisterModuleInterface(this); - - scene.EventManager.OnNewClient -= OnNewClient; - scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; - scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; - scene.EventManager.OnMakeChildAgent -= MakeChildAgent; - scene.EventManager.OnClientClosed -= ClientClosed; - } - public void Close() { } @@ -191,6 +158,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends get { return "FriendsModule"; } } + public bool IsSharedModule + { + get { return true; } + } + #endregion #region IInterregionFriendsComms diff --git a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs index c306f94e06..8ce509239d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs @@ -25,10 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -39,41 +37,23 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Avatar.Gestures { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class GesturesModule : INonSharedRegionModule + public class GesturesModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected Scene m_scene; - 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.EventManager.OnNewClient += OnNewClient; } - - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - if(m_scene == scene) - m_scene = null; - scene.EventManager.OnNewClient -= OnNewClient; - } + public void PostInitialise() {} public void Close() {} public string Name { get { return "Gestures Module"; } } + public bool IsSharedModule { get { return false; } } private void OnNewClient(IClientAPI client) { diff --git a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs index 3914f2efd1..50171a391e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gods/GodsModule.cs @@ -25,9 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Collections.Generic; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -36,8 +34,7 @@ using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.CoreModules.Avatar.Gods { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class GodsModule : INonSharedRegionModule, IGodsModule + public class GodsModule : IRegionModule, IGodsModule { /// Special UUID for actions that apply to all agents private static readonly UUID ALL_AGENTS = new UUID("44e87126-e794-4ded-05b3-7c42da3d5cdb"); @@ -45,34 +42,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Gods protected Scene m_scene; protected IDialogModule m_dialogModule; - 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_dialogModule = m_scene.RequestModuleInterface(); m_scene.RegisterModuleInterface(this); } - - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - scene.UnregisterModuleInterface(this); - } + public void PostInitialise() {} public void Close() {} public string Name { get { return "Gods Module"; } } + public bool IsSharedModule { get { return false; } } public void RequestGodlikePowers( UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient) diff --git a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs index 7ff8d3000d..31363e5705 100644 --- a/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Groups/GroupsModule.cs @@ -25,11 +25,9 @@ * 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,8 +36,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.Groups { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class GroupsModule : ISharedRegionModule + public class GroupsModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -58,9 +55,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups private static GroupMembershipData osGroup = new GroupMembershipData(); - #region ISharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { IConfig groupsConfig = config.Configs["Groups"]; @@ -79,15 +76,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups if (groupsConfig.GetString("Module", "Default") != "Default") return; } - } - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { lock (m_SceneList) { if (!m_SceneList.Contains(scene)) @@ -110,19 +99,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - if (m_SceneList.Contains(scene)) - m_SceneList.Remove(scene); - scene.EventManager.OnNewClient -= OnNewClient; - scene.EventManager.OnClientClosed -= OnClientClosed; - scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; - } - public void PostInitialise() { } @@ -147,6 +123,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Groups get { return "GroupsModule"; } } + public bool IsSharedModule + { + get { return true; } + } + #endregion private void OnNewClient(IClientAPI client) diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs index e1bde4b3b6..9a6874909b 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/InstantMessageModule.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; @@ -39,8 +36,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class InstantMessageModule : ISharedRegionModule + public class InstantMessageModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -51,11 +47,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private readonly List m_scenes = new List(); - #region ISharedRegionModule Members + #region IRegionModule Members private IMessageTransferModule m_TransferModule = null; - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { if (config.Configs["Messaging"] != null) { @@ -66,15 +62,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } m_enabled = true; - } - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { lock (m_scenes) { if (!m_scenes.Contains(scene)) @@ -86,27 +74,6 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } } - public void RegionLoaded(Scene scene) - { - if (!m_enabled) - return; - - m_TransferModule = - m_scenes[0].RequestModuleInterface(); - - if (m_TransferModule == null) - m_log.Error("[INSTANT MESSAGE]: No message transfer module, " + - "IM will not work!"); - } - - public void RemoveRegion(Scene scene) - { - if (m_scenes.Contains(scene)) - m_scenes.Remove(scene); - scene.EventManager.OnClientConnect -= OnClientConnect; - scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; - } - void OnClientConnect(IClientCore client) { IClientIM clientIM; @@ -118,6 +85,15 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage public void PostInitialise() { + if (!m_enabled) + return; + + m_TransferModule = + m_scenes[0].RequestModuleInterface(); + + if (m_TransferModule == null) + m_log.Error("[INSTANT MESSAGE]: No message transfer module, "+ + "IM will not work!"); } public void Close() @@ -129,6 +105,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage get { return "InstantMessageModule"; } } + public bool IsSharedModule + { + get { return true; } + } + #endregion public void OnInstantMessage(IClientAPI client, GridInstantMessage im) diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs index 16bdfddea7..e5159b3817 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs @@ -30,7 +30,6 @@ using System.Collections.Generic; using System.Net; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; @@ -41,8 +40,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class MessageTransferModule : ISharedRegionModule, IMessageTransferModule + public class MessageTransferModule : IRegionModule, IMessageTransferModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -52,9 +50,8 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage protected Dictionary m_UserRegionMap = new Dictionary(); public event UndeliveredMessage OnUndeliveredMessage; - private bool m_enabled = true; - public virtual void Initialise(IConfigSource config) + public virtual void Initialise(Scene scene, IConfigSource config) { IConfig cnf = config.Configs["Messaging"]; if (cnf != null && cnf.GetString( @@ -62,51 +59,29 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage "MessageTransferModule") { m_log.Debug("[MESSAGE TRANSFER]: Disabled by configuration"); - m_enabled = false; + return; } cnf = config.Configs["Startup"]; if (cnf != null) m_Gridmode = cnf.GetBoolean("gridmode", false); - } - public Type ReplaceableInterface - { - get { return null; } - } + // m_Enabled = true; - public void AddRegion(Scene scene) - { - if (m_enabled) + lock (m_Scenes) { - lock (m_Scenes) + if (m_Scenes.Count == 0) { - if (m_Scenes.Count == 0) - { - MainServer.Instance.AddXmlRPCHandler( - "grid_instant_message", processXMLRPCGridInstantMessage); - } - - m_log.Debug("[MESSAGE TRANSFER]: Message transfer module active"); - scene.RegisterModuleInterface(this); - m_Scenes.Add(scene); + MainServer.Instance.AddXmlRPCHandler( + "grid_instant_message", processXMLRPCGridInstantMessage); } + + m_log.Debug("[MESSAGE TRANSFER]: Message transfer module active"); + scene.RegisterModuleInterface(this); + m_Scenes.Add(scene); } } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - if (m_Scenes.Contains(scene)) - m_Scenes.Remove(scene); - MainServer.Instance.RemoveXmlRPCHandler( - "grid_instant_message"); - scene.UnregisterModuleInterface(this); - } - public virtual void PostInitialise() { } @@ -120,6 +95,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage get { return "MessageTransferModule"; } } + public virtual bool IsSharedModule + { + get { return true; } + } + public virtual void SendInstantMessage(GridInstantMessage im, MessageResultNotification result) { UUID toAgentID = new UUID(im.toAgentID); diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs index 3570495796..2d4a635056 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/MuteListModule.cs @@ -28,7 +28,6 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -40,8 +39,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.MuteList { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class MuteListModule : ISharedRegionModule + public class MuteListModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -49,7 +47,7 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList private List m_SceneList = new List(); private string m_RestURL = String.Empty; - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { if (!enabled) return; @@ -68,24 +66,19 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList enabled = false; return; } - m_RestURL = cnf.GetString("MuteListURL", ""); - if (m_RestURL == "") - { - m_log.Error("[MUTE LIST] Module was enabled, but no URL is given, disabling"); - enabled = false; - return; - } - } - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { lock (m_SceneList) { + if (m_SceneList.Count == 0) + { + m_RestURL = cnf.GetString("MuteListURL", ""); + if (m_RestURL == "") + { + m_log.Error("[MUTE LIST] Module was enabled, but no URL is given, disabling"); + enabled = false; + return; + } + } if (!m_SceneList.Contains(scene)) m_SceneList.Add(scene); @@ -93,18 +86,6 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList } } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - if (m_SceneList.Contains(scene)) - m_SceneList.Remove(scene); - - scene.EventManager.OnNewClient -= OnNewClient; - } - public void PostInitialise() { if (!enabled) @@ -121,6 +102,11 @@ namespace OpenSim.Region.CoreModules.Avatar.MuteList get { return "MuteListModule"; } } + public bool IsSharedModule + { + get { return true; } + } + public void Close() { } diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs index 6c4d0bfcf4..ff38b6f29c 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs @@ -28,7 +28,6 @@ using System; using System.Collections.Generic; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -41,8 +40,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class OfflineMessageModule : ISharedRegionModule + public class OfflineMessageModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -51,7 +49,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage private string m_RestURL = String.Empty; private bool m_ForwardOfflineGroupMessages = true; - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { if (!enabled) return; @@ -85,23 +83,14 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage return; } } + if (!m_SceneList.Contains(scene)) + m_SceneList.Add(scene); + + scene.EventManager.OnNewClient += OnNewClient; } } - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { - if (!m_SceneList.Contains(scene)) - m_SceneList.Add(scene); - - scene.EventManager.OnNewClient += OnNewClient; - } - - public void RegionLoaded(Scene scene) + public void PostInitialise() { if (!enabled) return; @@ -131,22 +120,16 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage m_log.Debug("[OFFLINE MESSAGING] Offline messages enabled"); } - public void RemoveRegion(Scene scene) - { - if (m_SceneList.Contains(scene)) - m_SceneList.Remove(scene); - scene.EventManager.OnNewClient -= OnNewClient; - } - - public void PostInitialise() - { - } - public string Name { get { return "OfflineMessageModule"; } } + public bool IsSharedModule + { + get { return true; } + } + public void Close() { } diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs index f5498f42e1..f5ab45466c 100644 --- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/PresenceModule.cs @@ -24,14 +24,11 @@ * (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; using System.Collections.Generic; using System.Net; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; @@ -42,8 +39,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.CoreModules.Avatar.InstantMessage { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class PresenceModule : ISharedRegionModule, IPresenceModule + public class PresenceModule : IRegionModule, IPresenceModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -63,7 +59,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage public event PresenceChange OnPresenceChange; public event BulkPresenceData OnBulkPresenceData; - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { lock (m_Scenes) { @@ -82,38 +78,28 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage m_Gridmode = cnf.GetBoolean("gridmode", false); m_Enabled = true; + + m_initialScene = scene; } - } - } - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { - if (m_Enabled) - { - m_initialScene = scene; if (m_Gridmode) NotifyMessageServerOfStartup(scene); m_Scenes.Add(scene); - - scene.RegisterModuleInterface(this); - - scene.EventManager.OnNewClient += OnNewClient; - scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; - scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; } + + scene.RegisterModuleInterface(this); + + scene.EventManager.OnNewClient += OnNewClient; + scene.EventManager.OnSetRootAgentScene += OnSetRootAgentScene; + scene.EventManager.OnMakeChildAgent += OnMakeChildAgent; } - public void RegionLoaded(Scene scene) + public void PostInitialise() { } - public void RemoveRegion(Scene scene) + public void Close() { if (!m_Gridmode || !m_Enabled) return; @@ -130,23 +116,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage } } - NotifyMessageServerOfShutdown(scene); - if(m_Scenes.Contains(scene)) - m_Scenes.Remove(scene); - - scene.UnregisterModuleInterface(this); - - scene.EventManager.OnNewClient -= OnNewClient; - scene.EventManager.OnSetRootAgentScene -= OnSetRootAgentScene; - scene.EventManager.OnMakeChildAgent -= OnMakeChildAgent; - } - - public void PostInitialise() - { - } - - public void Close() - { + lock (m_Scenes) + { + foreach (Scene scene in m_Scenes) + NotifyMessageServerOfShutdown(scene); + } } public string Name @@ -154,6 +128,11 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage get { return "PresenceModule"; } } + public bool IsSharedModule + { + get { return true; } + } + public void RequestBulkPresenceData(UUID[] users) { if (OnBulkPresenceData != null) diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index a04ab22588..ecd60bdaad 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs @@ -30,7 +30,6 @@ using System.Collections.Generic; using System.IO; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -42,11 +41,10 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] /// /// This module loads and saves OpenSimulator inventory archives /// - public class InventoryArchiverModule : ISharedRegionModule, IInventoryArchiverModule + public class InventoryArchiverModule : IRegionModule, IInventoryArchiverModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -84,28 +82,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver DisablePresenceChecks = disablePresenceChecks; } - public void Initialise(IConfigSource source) - { - - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource source) { if (m_scenes.Count == 0) { scene.RegisterModuleInterface(this); OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; - + scene.AddCommand( this, "load iar", "load iar []", - "Load user inventory archive.", HandleLoadInvConsoleCommand); - + "Load user inventory archive.", HandleLoadInvConsoleCommand); + scene.AddCommand( this, "save iar", "save iar []", @@ -113,21 +101,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver m_aScene = scene; } - + m_scenes[scene.RegionInfo.RegionID] = scene; } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - scene.UnregisterModuleInterface(this); - if(m_scenes.ContainsKey(scene.RegionInfo.RegionID)) - m_scenes.Remove(scene.RegionInfo.RegionID); - } - public void PostInitialise() {} public void Close() {} diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 44906b4afa..d9a021fc02 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.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; @@ -40,8 +39,7 @@ using OpenSim.Services.Interfaces; namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class InventoryTransferModule : IInventoryTransferModule, ISharedRegionModule + public class InventoryTransferModule : IInventoryTransferModule, IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -52,11 +50,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer new Dictionary(); private IMessageTransferModule m_TransferModule = null; - private bool m_enabled = true; - #region ISharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { if (config.Configs["Messaging"] != null) { @@ -65,59 +62,29 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer if (config.Configs["Messaging"].GetString( "InventoryTransferModule", "InventoryTransferModule") != "InventoryTransferModule") - m_enabled = false; + return; } - } - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { - if (m_enabled) + if (!m_Scenelist.Contains(scene)) { - if (!m_Scenelist.Contains(scene)) - { - m_Scenelist.Add(scene); + m_Scenelist.Add(scene); - scene.RegisterModuleInterface(this); + scene.RegisterModuleInterface(this); - scene.EventManager.OnNewClient += OnNewClient; - scene.EventManager.OnClientClosed += ClientLoggedOut; - scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; - } + scene.EventManager.OnNewClient += OnNewClient; + scene.EventManager.OnClientClosed += ClientLoggedOut; + scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; } } - public void RegionLoaded(Scene scene) - { - if (m_enabled) - { - if (m_Scenelist.Count > 0) - { - m_TransferModule = m_Scenelist[0].RequestModuleInterface(); - if (m_TransferModule == null) - m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only"); - } - } - } - - public void RemoveRegion(Scene scene) - { - if (m_Scenelist.Contains(scene)) - m_Scenelist.Remove(scene); - - scene.UnregisterModuleInterface(this); - - scene.EventManager.OnNewClient -= OnNewClient; - scene.EventManager.OnClientClosed -= ClientLoggedOut; - scene.EventManager.OnIncomingInstantMessage -= OnGridInstantMessage; - } - public void PostInitialise() { + if (m_Scenelist.Count > 0) + { + m_TransferModule = m_Scenelist[0].RequestModuleInterface(); + if (m_TransferModule == null) + m_log.Error("[INVENTORY TRANSFER] No Message transfer module found, transfers will be local only"); + } } public void Close() diff --git a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs index 973d27fd24..261bd6c609 100644 --- a/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Lure/LureModule.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,72 +37,36 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.Lure { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class LureModule : ISharedRegionModule + public class LureModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private readonly List m_scenes = new List(); - private bool m_enabled = true; - private IMessageTransferModule m_TransferModule = null; - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { if (config.Configs["Messaging"] != null) { if (config.Configs["Messaging"].GetString( "LureModule", "LureModule") != "LureModule") - m_enabled = false; + return; } - } - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { - if (m_enabled) + lock (m_scenes) { - lock (m_scenes) + if (!m_scenes.Contains(scene)) { - if (!m_scenes.Contains(scene)) - { - m_scenes.Add(scene); - scene.EventManager.OnNewClient += OnNewClient; - scene.EventManager.OnIncomingInstantMessage += - OnGridInstantMessage; - } + m_scenes.Add(scene); + scene.EventManager.OnNewClient += OnNewClient; + scene.EventManager.OnIncomingInstantMessage += + OnGridInstantMessage; } } } - public void RegionLoaded(Scene scene) - { - if (m_enabled) - { - m_TransferModule = - m_scenes[0].RequestModuleInterface(); - - if (m_TransferModule == null) - m_log.Error("[INSTANT MESSAGE]: No message transfer module, " + - "lures will not work!"); - } - } - - public void RemoveRegion(Scene scene) - { - if (m_scenes.Contains(scene)) - m_scenes.Remove(scene); - scene.EventManager.OnNewClient -= OnNewClient; - scene.EventManager.OnIncomingInstantMessage -= - OnGridInstantMessage; - } - void OnNewClient(IClientAPI client) { client.OnInstantMessage += OnInstantMessage; @@ -113,6 +76,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure public void PostInitialise() { + m_TransferModule = + m_scenes[0].RequestModuleInterface(); + + if (m_TransferModule == null) + m_log.Error("[INSTANT MESSAGE]: No message transfer module, "+ + "lures will not work!"); } public void Close() diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs index 748b42c5f3..63a93aa026 100644 --- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs +++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/ObjectAdd.cs @@ -29,7 +29,6 @@ using System; using System.Collections; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -42,54 +41,24 @@ using Caps=OpenSim.Framework.Capabilities.Caps; namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class ObjectAdd : ISharedRegionModule + public class ObjectAdd : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; - #region ISharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource pSource) + public void Initialise(Scene pScene, IConfigSource pSource) { - - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { - m_scene = scene; + m_scene = pScene; m_scene.EventManager.OnRegisterCaps += RegisterCaps; } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - scene.EventManager.OnRegisterCaps -= RegisterCaps; - } - public void PostInitialise() { } - public void Close() - { - - } - - public string Name - { - get { return "ObjectAddModule"; } - } - public void RegisterCaps(UUID agentID, Caps caps) { UUID capuuid = UUID.Random(); @@ -379,6 +348,22 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps Array.Reverse(resultbytes); return String.Format("{0}",Convert.ToBase64String(resultbytes)); } + + public void Close() + { + + } + + public string Name + { + get { return "ObjectAddModule"; } + } + + public bool IsSharedModule + { + get { return false; } + } + #endregion } } diff --git a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs index 7fcb0e13cf..8cf58c6df0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Profiles/AvatarProfilesModule.cs @@ -30,7 +30,6 @@ using System.Collections; using System.Globalization; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -39,17 +38,20 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Avatar.Profiles { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class AvatarProfilesModule : INonSharedRegionModule + public class AvatarProfilesModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; private IProfileModule m_profileModule = null; private bool m_enabled = true; - #region INonSharedRegionModule Members + public AvatarProfilesModule() + { + } - public void Initialise(IConfigSource config) + #region IRegionModule Members + + public void Initialise(Scene scene, IConfigSource config) { IConfig profileConfig = config.Configs["Profile"]; if (profileConfig != null) @@ -60,31 +62,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles return; } } - } - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { m_scene = scene; m_scene.EventManager.OnNewClient += NewClient; } - public void RegionLoaded(Scene scene) + public void PostInitialise() { if (!m_enabled) return; m_profileModule = m_scene.RequestModuleInterface(); } - public void RemoveRegion(Scene scene) - { - scene.EventManager.OnNewClient -= NewClient; - } - public void Close() { } @@ -94,6 +83,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Profiles get { return "AvatarProfilesModule"; } } + public bool IsSharedModule + { + get { return false; } + } + #endregion public void NewClient(IClientAPI client) diff --git a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs index 1ee6f0d322..0c6cb1bdfa 100644 --- a/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EventQueue/EventQueueGetModule.cs @@ -32,7 +32,6 @@ using System.Net; using System.Reflection; using System.Threading; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.Packets; @@ -53,13 +52,11 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue public OSDMap body; } - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class EventQueueGetModule : IEventQueue, INonSharedRegionModule + public class EventQueueGetModule : IEventQueue, IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); protected Scene m_scene = null; private IConfigSource m_gConfig; - private IConfig m_startupConfig; bool enabledYN = false; private Dictionary m_ids = new Dictionary(); @@ -68,31 +65,23 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue private Dictionary m_QueueUUIDAvatarMapping = new Dictionary(); private Dictionary m_AvatarQueueUUIDMapping = new Dictionary(); - #region INonSharedRegionModule methods - public virtual void Initialise(IConfigSource config) + #region IRegionModule methods + public virtual void Initialise(Scene scene, IConfigSource config) { m_gConfig = config; - m_startupConfig = m_gConfig.Configs["Startup"]; - } + IConfig startupConfig = m_gConfig.Configs["Startup"]; - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { - ReadConfigAndPopulate(scene, m_startupConfig, "Startup"); + ReadConfigAndPopulate(scene, startupConfig, "Startup"); if (enabledYN) { m_scene = scene; scene.RegisterModuleInterface(this); - + // Register fallback handler // Why does EQG Fail on region crossings! - + //scene.CommsManager.HttpServer.AddLLSDHandler("/CAPS/EQG/", EventQueueFallBack); scene.EventManager.OnNewClient += OnNewClient; @@ -110,14 +99,7 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue { m_gConfig = null; } - } - - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { + } private void ReadConfigAndPopulate(Scene scene, IConfig startupConfig, string p) @@ -125,6 +107,10 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue enabledYN = startupConfig.GetBoolean("EventQueue", true); } + public void PostInitialise() + { + } + public virtual void Close() { } @@ -134,6 +120,10 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue get { return "EventQueueGetModule"; } } + public bool IsSharedModule + { + get { return false; } + } #endregion /// diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs index 0135d3359b..f15f8f6de1 100644 --- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs @@ -25,12 +25,10 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Collections; using System.Collections.Generic; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -41,8 +39,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Framework.Monitoring { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class MonitorModule : INonSharedRegionModule + public class MonitorModule : IRegionModule { private Scene m_scene; private readonly List m_monitors = new List(); @@ -65,19 +62,9 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring } } - #region Implementation of INonSharedRegionModule + #region Implementation of IRegionModule - 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; @@ -90,51 +77,6 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring MainServer.Instance.AddHTTPHandler("/monitorstats/" + m_scene.RegionInfo.RegionID + "/", StatsPage); } - public void RegionLoaded(Scene scene) - { - m_monitors.Add(new AgentCountMonitor(m_scene)); - m_monitors.Add(new ChildAgentCountMonitor(m_scene)); - m_monitors.Add(new GCMemoryMonitor()); - m_monitors.Add(new ObjectCountMonitor(m_scene)); - m_monitors.Add(new PhysicsFrameMonitor(m_scene)); - m_monitors.Add(new PhysicsUpdateFrameMonitor(m_scene)); - m_monitors.Add(new PWSMemoryMonitor()); - m_monitors.Add(new ThreadCountMonitor()); - m_monitors.Add(new TotalFrameMonitor(m_scene)); - m_monitors.Add(new EventFrameMonitor(m_scene)); - m_monitors.Add(new LandFrameMonitor(m_scene)); - m_monitors.Add(new LastFrameTimeMonitor(m_scene)); - - m_alerts.Add(new DeadlockAlert(m_monitors.Find(x => x is LastFrameTimeMonitor) as LastFrameTimeMonitor)); - - foreach (IAlert alert in m_alerts) - { - alert.OnTriggerAlert += OnTriggerAlert; - } - } - - public void RemoveRegion(Scene scene) - { - MainServer.Instance.RemoveHTTPHandler("", "/monitorstats/" + m_scene.RegionInfo.RegionID + "/"); - m_monitors.Clear(); - - foreach (IAlert alert in m_alerts) - { - alert.OnTriggerAlert -= OnTriggerAlert; - } - m_alerts.Clear(); - } - - public void Close() - { - - } - - public string Name - { - get { return "Region Health Monitoring Module"; } - } - public Hashtable StatsPage(Hashtable request) { // If request was for a specific monitor @@ -190,10 +132,49 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring return ereply; } + public void PostInitialise() + { + m_monitors.Add(new AgentCountMonitor(m_scene)); + m_monitors.Add(new ChildAgentCountMonitor(m_scene)); + m_monitors.Add(new GCMemoryMonitor()); + m_monitors.Add(new ObjectCountMonitor(m_scene)); + m_monitors.Add(new PhysicsFrameMonitor(m_scene)); + m_monitors.Add(new PhysicsUpdateFrameMonitor(m_scene)); + m_monitors.Add(new PWSMemoryMonitor()); + m_monitors.Add(new ThreadCountMonitor()); + m_monitors.Add(new TotalFrameMonitor(m_scene)); + m_monitors.Add(new EventFrameMonitor(m_scene)); + m_monitors.Add(new LandFrameMonitor(m_scene)); + m_monitors.Add(new LastFrameTimeMonitor(m_scene)); + + m_alerts.Add(new DeadlockAlert(m_monitors.Find(x => x is LastFrameTimeMonitor) as LastFrameTimeMonitor)); + + foreach (IAlert alert in m_alerts) + { + alert.OnTriggerAlert += OnTriggerAlert; + } + } + void OnTriggerAlert(System.Type reporter, string reason, bool fatal) { m_log.Error("[Monitor] " + reporter.Name + " for " + m_scene.RegionInfo.RegionName + " reports " + reason + " (Fatal: " + fatal + ")"); } + + public void Close() + { + + } + + public string Name + { + get { return "Region Health Monitoring Module"; } + } + + public bool IsSharedModule + { + get { return false; } + } + #endregion } } diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs index f9c594b800..0b54746f19 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -32,7 +32,6 @@ using System.Net; using System.Reflection; using System.Text.RegularExpressions; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using Nwc.XmlRpc; @@ -47,8 +46,7 @@ using OpenSim.Region.Framework.Interfaces; namespace OpenSim.Region.CoreModules.Hypergrid { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class HGStandaloneLoginModule : ISharedRegionModule, ILoginServiceToRegionsConnector + public class HGStandaloneLoginModule : IRegionModule, ILoginServiceToRegionsConnector { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -58,58 +56,47 @@ namespace OpenSim.Region.CoreModules.Hypergrid protected bool m_enabled = false; // Module is only enabled if running in standalone mode protected HGLoginAuthService m_loginService; - private bool authenticate = true; - private string welcomeMessage = "Welcome to OpenSim"; - private IConfig startupConfig; - private IConfig standaloneConfig; - - #region ISharedRegionModule Members - public void Initialise(IConfigSource source) - { - startupConfig = source.Configs["Startup"]; - standaloneConfig = source.Configs["StandAlone"]; - if (standaloneConfig != null) - { - authenticate = standaloneConfig.GetBoolean("accounts_authenticate", true); - welcomeMessage = standaloneConfig.GetString("welcome_message"); - } - m_enabled = !startupConfig.GetBoolean("gridmode", false); - } + #region IRegionModule Members - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { - } - - public void RegionLoaded(Scene scene) + public void Initialise(Scene scene, IConfigSource source) { if (m_firstScene == null) { m_firstScene = scene; + IConfig startupConfig = source.Configs["Startup"]; + if (startupConfig != null) + { + m_enabled = !startupConfig.GetBoolean("gridmode", false); + } + if (m_enabled) { m_log.Debug("[HGLogin]: HGlogin module enabled"); + bool authenticate = true; + string welcomeMessage = "Welcome to OpenSim"; + IConfig standaloneConfig = source.Configs["StandAlone"]; + if (standaloneConfig != null) + { + authenticate = standaloneConfig.GetBoolean("accounts_authenticate", true); + welcomeMessage = standaloneConfig.GetString("welcome_message"); + } //TODO: fix casting. LibraryRootFolder rootFolder = m_firstScene.CommsManager.UserProfileCacheService.LibraryRoot as LibraryRootFolder; - + IHttpServer httpServer = MainServer.Instance; //TODO: fix the casting of the user service, maybe by registering the userManagerBase with scenes, or refactoring so we just need a IUserService reference - m_loginService + m_loginService = new HGLoginAuthService( - (UserManagerBase)m_firstScene.CommsManager.UserAdminService, - welcomeMessage, - m_firstScene.CommsManager.InterServiceInventoryService, - m_firstScene.CommsManager.NetworkServersInfo, - authenticate, - rootFolder, + (UserManagerBase)m_firstScene.CommsManager.UserAdminService, + welcomeMessage, + m_firstScene.CommsManager.InterServiceInventoryService, + m_firstScene.CommsManager.NetworkServersInfo, + authenticate, + rootFolder, this); httpServer.AddXmlRPCHandler("hg_login", m_loginService.XmlRpcLoginMethod); @@ -126,19 +113,6 @@ namespace OpenSim.Region.CoreModules.Hypergrid } } - public void RemoveRegion(Scene scene) - { - if (scene == m_firstScene) - { - IHttpServer httpServer = MainServer.Instance; - httpServer.RemoveXmlRPCHandler("hg_login"); - httpServer.RemoveXmlRPCHandler("check_auth_session"); - httpServer.RemoveXmlRPCHandler("get_avatar_appearance"); - httpServer.RemoveXmlRPCHandler("update_avatar_appearance"); - } - m_scenes.Remove(scene); - } - public void PostInitialise() { @@ -154,6 +128,11 @@ namespace OpenSim.Region.CoreModules.Hypergrid get { return "HGStandaloneLoginModule"; } } + public bool IsSharedModule + { + get { return true; } + } + #endregion protected void AddScene(Scene scene) diff --git a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs b/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs index 45340241cb..0f2ba324e0 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OGSRadmin.cs @@ -32,7 +32,6 @@ using System.Net; using System.Reflection; using System.Text; using log4net; -using Mono.Addins; using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; @@ -43,8 +42,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.InterGrid { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class OGSRadmin : ISharedRegionModule + public class OGSRadmin : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private readonly List m_scenes = new List(); @@ -58,6 +56,7 @@ namespace OpenSim.Region.CoreModules.InterGrid get { return "OGS Supporting RAdmin"; } } + public void Initialise(IConfigSource source) { m_settings = source; @@ -68,11 +67,6 @@ namespace OpenSim.Region.CoreModules.InterGrid } - public Type ReplaceableInterface - { - get { return null; } - } - public void AddRegion(Scene scene) { lock (m_scenes) @@ -83,10 +77,14 @@ namespace OpenSim.Region.CoreModules.InterGrid { lock (m_scenes) m_scenes.Remove(scene); - MainServer.Instance.RemoveXmlRPCHandler("grid_message"); } public void RegionLoaded(Scene scene) + { + + } + + public void PostInitialise() { if (m_settings.Configs["Startup"].GetBoolean("gridmode", false)) { @@ -95,8 +93,21 @@ namespace OpenSim.Region.CoreModules.InterGrid } } - public void PostInitialise() + #endregion + + #region IRegionModule + + public void Initialise(Scene scene, IConfigSource source) { + m_settings = source; + + lock (m_scenes) + m_scenes.Add(scene); + } + + public bool IsSharedModule + { + get { return true; } } #endregion diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index 8bb0fa9bd2..10a3232019 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -35,7 +35,6 @@ using System.Security.Cryptography.X509Certificates; using System.Threading; using System.Web; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -76,9 +75,8 @@ namespace OpenSim.Region.CoreModules.InterGrid public bool visible_to_parent; public string teleported_into_region; } - - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class OpenGridProtocolModule : ISharedRegionModule + + public class OpenGridProtocolModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private List m_scene = new List(); @@ -94,22 +92,21 @@ namespace OpenSim.Region.CoreModules.InterGrid private bool httpSSL = false; private uint httpsslport = 0; private bool GridMode = false; - private bool m_enabled = false; - private IConfig cfg = null; - private IConfig httpcfg = null; - private IConfig startupcfg = null; - - #region ISharedRegionModule Members - public void Initialise(IConfigSource config) + #region IRegionModule Members + + public void Initialise(Scene scene, IConfigSource config) { + bool enabled = false; + IConfig cfg = null; + IConfig httpcfg = null; + IConfig startupcfg = null; try { cfg = config.Configs["OpenGridProtocol"]; - } - catch (NullReferenceException) + } catch (NullReferenceException) { - m_enabled = false; + enabled = false; } try @@ -131,15 +128,15 @@ namespace OpenSim.Region.CoreModules.InterGrid if (startupcfg != null) { - GridMode = m_enabled = startupcfg.GetBoolean("gridmode", false); + GridMode = enabled = startupcfg.GetBoolean("gridmode", false); } if (cfg != null) { - m_enabled = cfg.GetBoolean("ogp_enabled", false); + enabled = cfg.GetBoolean("ogp_enabled", false); LastNameSuffix = cfg.GetString("ogp_lastname_suffix", "_EXTERNAL"); FirstNamePrefix = cfg.GetString("ogp_firstname_prefix", ""); - if (m_enabled) + if (enabled) { m_log.Warn("[OGP]: Open Grid Protocol is on, Listening for Clients on /agent/"); lock (m_scene) @@ -168,60 +165,34 @@ namespace OpenSim.Region.CoreModules.InterGrid } } - } - } - } - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { - if (m_enabled) - { - lock (m_scene) - { - if (m_scene.Count == 1) - { - if (httpcfg != null) + // can't pick the region 'agent' because it would conflict with our agent domain handler + // a zero length region name would conflict with are base region seed cap + if (!SceneListDuplicateCheck(scene.RegionInfo.RegionName) && scene.RegionInfo.RegionName.ToLower() != "agent" && scene.RegionInfo.RegionName.Length > 0) { - httpSSL = httpcfg.GetBoolean("http_listener_ssl", false); - httpsCN = httpcfg.GetString("http_listener_cn", scene.RegionInfo.ExternalHostName); - if (httpsCN.Length == 0) - httpsCN = scene.RegionInfo.ExternalHostName; - httpsslport = (uint)httpcfg.GetInt("http_listener_sslport", ((int)scene.RegionInfo.HttpPort + 1)); + MainServer.Instance.AddLLSDHandler( + "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()), + ProcessRegionDomainSeed); } + + if (!m_scene.Contains(scene)) + m_scene.Add(scene); + } + } + } + lock (m_scene) + { + if (m_scene.Count == 1) + { + if (httpcfg != null) + { + httpSSL = httpcfg.GetBoolean("http_listener_ssl", false); + httpsCN = httpcfg.GetString("http_listener_cn", scene.RegionInfo.ExternalHostName); + if (httpsCN.Length == 0) + httpsCN = scene.RegionInfo.ExternalHostName; + httpsslport = (uint)httpcfg.GetInt("http_listener_sslport",((int)scene.RegionInfo.HttpPort + 1)); } } - // can't pick the region 'agent' because it would conflict with our agent domain handler - // a zero length region name would conflict with are base region seed cap - if (!SceneListDuplicateCheck(scene.RegionInfo.RegionName) && scene.RegionInfo.RegionName.ToLower() != "agent" && scene.RegionInfo.RegionName.Length > 0) - { - MainServer.Instance.AddLLSDHandler( - "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()), - ProcessRegionDomainSeed); - } - - if (!m_scene.Contains(scene)) - m_scene.Add(scene); } - } - - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - MainServer.Instance.RemoveLLSDHandler( - "/" + HttpUtility.UrlPathEncode(scene.RegionInfo.RegionName.ToLower()), - ProcessRegionDomainSeed); - - if (m_scene.Contains(scene)) - m_scene.Remove(scene); } public void PostInitialise() @@ -238,6 +209,11 @@ namespace OpenSim.Region.CoreModules.InterGrid get { return "OpenGridProtocolModule"; } } + public bool IsSharedModule + { + get { return true; } + } + #endregion public OSD ProcessRegionDomainSeed(string path, OSD request, string endpoint) diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index 40b715955a..679c871441 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs @@ -29,7 +29,6 @@ using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.Imaging; @@ -41,8 +40,7 @@ using System.Reflection; namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class DynamicTextureModule : ISharedRegionModule, IDynamicTextureManager + public class DynamicTextureModule : IRegionModule, IDynamicTextureManager { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -212,14 +210,9 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture #endregion - #region ISharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource config) - { - - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource config) { if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) { @@ -228,24 +221,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture } } - public Type ReplaceableInterface - { - get { return null; } - } - - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) - { - RegisteredScenes.Remove(scene.RegionInfo.RegionID); - scene.UnregisterModuleInterface(this); - } - } - public void PostInitialise() { } @@ -259,6 +234,11 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture get { return "DynamicTextureModule"; } } + public bool IsSharedModule + { + get { return true; } + } + #endregion #region Nested type: DynamicTextureUpdater @@ -378,18 +358,18 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture // tmptex.DefaultTexture.Fullbright = true; part.UpdateTexture(tmptex); - } - - if (oldID != UUID.Zero && ((Disp & DISP_EXPIRE) != 0)) - { - if (oldAsset == null) oldAsset = scene.AssetService.Get(oldID.ToString()); - if (oldAsset != null) - { - if (oldAsset.Temporary == true) - { - scene.AssetService.Delete(oldID.ToString()); - } - } + } + + if (oldID != UUID.Zero && ((Disp & DISP_EXPIRE) != 0)) + { + if (oldAsset == null) oldAsset = scene.AssetService.Get(oldID.ToString()); + if (oldAsset != null) + { + if (oldAsset.Temporary == true) + { + scene.AssetService.Delete(oldID.ToString()); + } + } } } diff --git a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs index d6ed468814..83f004dc60 100644 --- a/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/EMailModules/EmailModule.cs @@ -32,7 +32,6 @@ using System.Text.RegularExpressions; using DotNetOpenMail; using DotNetOpenMail.SmtpAuth; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -41,7 +40,6 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Scripting.EmailModules { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class EmailModule : IEmailModule { // @@ -96,7 +94,7 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules } } - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { m_Config = config; IConfig SMTPConfig; @@ -138,16 +136,7 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules m_Enabled = false; return; } - m_log.Info("[EMAIL] Activated DefaultEmailModule"); - } - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { // It's a go! if (m_Enabled) { @@ -166,20 +155,8 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules m_Scenes.Add(scene.RegionInfo.RegionHandle, scene); } } - } - } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - scene.UnregisterModuleInterface(this); - - if (m_Scenes.ContainsKey(scene.RegionInfo.RegionHandle)) - { - m_Scenes.Remove(scene.RegionInfo.RegionHandle); + m_log.Info("[EMAIL] Activated DefaultEmailModule"); } } @@ -196,6 +173,11 @@ namespace OpenSim.Region.CoreModules.Scripting.EmailModules get { return "DefaultEmailModule"; } } + public bool IsSharedModule + { + get { return true; } + } + /// /// Delay function using thread in seconds /// diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index e331b8d3e8..d78931a524 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -31,7 +31,6 @@ using System.IO; using System.Net; using System.Text; using System.Threading; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -85,8 +84,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Scripting.HttpRequest { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class HttpRequestModule : ISharedRegionModule, IHttpRequestModule + public class HttpRequestModule : IRegionModule, IHttpRequestModule { private object HttpListLock = new object(); private int httpTimeout = 30000; @@ -231,35 +229,18 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest #endregion - #region ISharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource config) - { - m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); - m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); - - m_pendingRequests = new Dictionary(); - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource config) { m_scene = scene; m_scene.RegisterModuleInterface(this); - } - public Type ReplaceableInterface - { - get { return null; } - } + m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); + m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - scene.UnregisterModuleInterface(this); + m_pendingRequests = new Dictionary(); } public void PostInitialise() @@ -275,6 +256,11 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest get { return m_name; } } + public bool IsSharedModule + { + get { return true; } + } + #endregion } diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index 6ce55a90c6..9b565ed85b 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs @@ -126,8 +126,6 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp public void RemoveRegion(Scene scene) { - scene.UnregisterModuleInterface(this); - scene.EventManager.OnScriptReset -= OnScriptReset; } public void Close() diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs index 35ce2cbf2c..c23cea539a 100644 --- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs @@ -29,7 +29,6 @@ using System; using System.Drawing; using System.IO; using System.Net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.Imaging; @@ -40,8 +39,7 @@ using System.Reflection; namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class LoadImageURLModule : ISharedRegionModule, IDynamicTextureRender + public class LoadImageURLModule : IRegionModule, IDynamicTextureRender { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -99,28 +97,20 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL #endregion - #region ISharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource config) - { - m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); - m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); - } - - public void AddRegion(Scene scene) + public void Initialise(Scene scene, IConfigSource config) { if (m_scene == null) { m_scene = scene; } + + m_proxyurl = config.Configs["Startup"].GetString("HttpProxy"); + m_proxyexcepts = config.Configs["Startup"].GetString("HttpProxyExceptions"); } - public Type ReplaceableInterface - { - get { return null; } - } - - public void RegionLoaded(Scene scene) + public void PostInitialise() { m_textureManager = m_scene.RequestModuleInterface(); if (m_textureManager != null) @@ -129,14 +119,6 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL } } - public void RemoveRegion(Scene scene) - { - } - - public void PostInitialise() - { - } - public void Close() { } @@ -146,6 +128,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL get { return m_name; } } + public bool IsSharedModule + { + get { return true; } + } + #endregion private void MakeHttpRequest(string url, UUID requestID) diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index 71b01a16bc..d57a8e5979 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs @@ -31,7 +31,6 @@ using System.Drawing.Imaging; using System.Globalization; using System.IO; using System.Net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.Imaging; @@ -44,8 +43,7 @@ using System.Reflection; namespace OpenSim.Region.CoreModules.Scripting.VectorRender { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class VectorRenderModule : ISharedRegionModule, IDynamicTextureRender + public class VectorRenderModule : IRegionModule, IDynamicTextureRender { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -112,10 +110,15 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender #endregion - #region ISharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { + if (m_scene == null) + { + m_scene = scene; + } + if (m_graph == null) { Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb); @@ -130,20 +133,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender m_log.DebugFormat("[VECTORRENDERMODULE]: using font \"{0}\" for text rendering.", m_fontName); } - public void AddRegion(Scene scene) - { - if (m_scene == null) - { - m_scene = scene; - } - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void RegionLoaded(Scene scene) + public void PostInitialise() { m_textureManager = m_scene.RequestModuleInterface(); if (m_textureManager != null) @@ -152,14 +142,6 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender } } - public void RemoveRegion(Scene scene) - { - } - - public void PostInitialise() - { - } - public void Close() { } @@ -169,6 +151,11 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender get { return m_name; } } + public bool IsSharedModule + { + get { return true; } + } + #endregion private void Draw(string data, UUID id, string extraParams) diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index d935c565db..93aa88c4de 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs @@ -28,7 +28,6 @@ using System; using System.Collections; using System.Collections.Generic; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -86,8 +85,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Scripting.WorldComm { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class WorldCommModule : ISharedRegionModule, IWorldComm + public class WorldCommModule : IRegionModule, IWorldComm { // private static readonly ILog m_log = // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -100,9 +98,9 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm private int m_saydistance = 30; private int m_shoutdistance = 100; - #region ISharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { // wrap this in a try block so that defaults will work if // the config file doesn't specify otherwise. @@ -122,6 +120,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm if (maxlisteners < 1) maxlisteners = int.MaxValue; if (maxhandles < 1) maxhandles = int.MaxValue; +<<<<<<< HEAD:OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs m_listenerManager = new ListenerManager(maxlisteners, maxhandles); m_pendingQ = new Queue(); m_pending = Queue.Synchronized(m_pendingQ); @@ -133,26 +132,19 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm public void AddRegion(Scene scene) { +======= +>>>>>>> ec3c31e... Updates all IRegionModules to the new style region modules.:OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs m_scene = scene; m_scene.RegisterModuleInterface(this); + m_listenerManager = new ListenerManager(maxlisteners, maxhandles); m_scene.EventManager.OnChatFromClient += DeliverClientMessage; m_scene.EventManager.OnChatBroadcast += DeliverClientMessage; + m_pendingQ = new Queue(); + m_pending = Queue.Synchronized(m_pendingQ); } - public Type ReplaceableInterface + public void PostInitialise() { - get { return null; } - } - - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - scene.UnregisterModuleInterface(this); - scene.EventManager.OnChatFromClient -= DeliverClientMessage; - scene.EventManager.OnChatBroadcast -= DeliverClientMessage; } public void Close() @@ -164,6 +156,11 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm get { return "WorldCommModule"; } } + public bool IsSharedModule + { + get { return false; } + } + #endregion #region IWorldComm Members diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs index a9147fb601..27b64bffc0 100644 --- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs @@ -32,7 +32,6 @@ using System.Net; using System.Reflection; using System.Threading; using log4net; -using Mono.Addins; using Nini.Config; using Nwc.XmlRpc; using OpenMetaverse; @@ -77,8 +76,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.CoreModules.Scripting.XMLRPC { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class XMLRPCModule : ISharedRegionModule, IXMLRPC + public class XMLRPCModule : IRegionModule, IXMLRPC { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -96,9 +94,9 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC private int RemoteReplyScriptWait = 300; private object XMLRPCListLock = new object(); - #region ISharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { // We need to create these early because the scripts might be calling // But since this gets called for every region, we need to make sure they @@ -118,14 +116,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC { } } - } - public void PostInitialise() - { - } - - public void AddRegion(Scene scene) - { if (!m_scenes.Contains(scene)) { m_scenes.Add(scene); @@ -134,12 +125,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC } } - public Type ReplaceableInterface - { - get { return null; } - } - private Dictionary m_HttpServers = new Dictionary(); - public void RegionLoaded(Scene scene) + public void PostInitialise() { if (IsEnabled()) { @@ -147,31 +133,9 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC // Attach xmlrpc handlers m_log.Info("[REMOTE_DATA]: " + "Starting XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands."); - BaseHttpServer httpServer = new BaseHttpServer((uint)m_remoteDataPort); + BaseHttpServer httpServer = new BaseHttpServer((uint) m_remoteDataPort); httpServer.AddXmlRPCHandler("llRemoteData", XmlRpcRemoteData); httpServer.Start(); - m_HttpServers.Add(scene, httpServer); - } - } - - public void RemoveRegion(Scene scene) - { - if (m_scenes.Contains(scene)) - m_scenes.Remove(scene); - scene.UnregisterModuleInterface(this); - if (IsEnabled()) - { - // Start http server - // Attach xmlrpc handlers - if (m_HttpServers.ContainsKey(scene)) - { - BaseHttpServer httpServer; - m_HttpServers.TryGetValue(scene, out httpServer); - m_log.Info("[REMOTE_DATA]: " + - "Stopping XMLRPC Server on port " + m_remoteDataPort + " for llRemoteData commands."); - httpServer.RemoveXmlRPCHandler("llRemoteData"); - httpServer.Stop(); - } } } @@ -184,6 +148,11 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC get { return m_name; } } + public bool IsSharedModule + { + get { return true; } + } + public int Port { get { return m_remoteDataPort; } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs index d3e2db7cde..879cc70903 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Asset/AssetServiceInConnectorModule.cs @@ -47,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Asset private IConfigSource m_Config; bool m_Registered = false; - #region ISharedRegionModule interface + #region IRegionModule interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs index a895a3fa0b..b12d778f87 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Grid/HypergridServiceInConnectorModule.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Grid bool m_Registered = false; HypergridServiceInConnector m_HypergridHandler; - #region ISharedRegionModule interface + #region IRegionModule interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs index 4c74725ed9..54c6d89073 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Inventory/InventoryServiceInConnectorModule.cs @@ -47,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Inventory private IConfigSource m_Config; bool m_Registered = false; - #region ISharedRegionModule interface + #region IRegionModule interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs index dcc6decc3c..bce160a92a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land private IConfigSource m_Config; private List m_Scenes = new List(); - #region ISharedRegionModule interface + #region IRegionModule interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs index a5c5ef637f..8a903701fa 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Neighbour/NeighbourServiceInConnectorModule.cs @@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Neighbour private IConfigSource m_Config; private List m_Scenes = new List(); - #region ISharedRegionModule interface + #region IRegionModule interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs index c2cea1640e..f28a31849a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Simulation/SimulationServiceInConnectorModule.cs @@ -49,7 +49,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Simulation private IConfigSource m_Config; bool m_Registered = false; - #region ISharedRegionModule interface + #region IRegionModule interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs index 71d7993ab4..d68c683143 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/LocalInterregionComms.cs @@ -48,7 +48,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion #endregion /* Events */ - #region ISharedRegionModule + #region IRegionModule public void Initialise(IConfigSource config) { @@ -136,7 +136,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion } } - #endregion + #endregion /* IRegionModule */ #region IInterregionComms diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs index 24d35e10cc..44458d175f 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Interregion/RESTInterregionComms.cs @@ -66,7 +66,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion protected bool m_safemode; protected IPAddress m_thisIP; - #region ISharedRegionModule + #region IRegionModule public virtual void Initialise(IConfigSource config) { @@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion MainServer.Instance.AddHTTPHandler("/object/", ObjectHandler); } - #endregion + #endregion /* IRegionModule */ #region IInterregionComms @@ -436,12 +436,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Interregion } OSDMap resp = new OSDMap(2); - string reason = String.Empty; - uint teleportFlags = 0; - if (args.ContainsKey("teleport_flags")) - { - teleportFlags = args["teleport_flags"].AsUInteger(); - } + string reason = String.Empty; + uint teleportFlags = 0; + if (args.ContainsKey("teleport_flags")) + { + teleportFlags = args["teleport_flags"].AsUInteger(); + } // This is the meaning of POST agent m_regionClient.AdjustUserInformation(aCircuit); diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index c738b65773..fc8d4e1d04 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 a2cfce6d38..5fa3dc2191 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 39836aeeee..695cced293 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 5b15065549..1533462b8d 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,7 +179,74 @@ 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"); + + //Register functions with Scene External Checks! + m_scene.Permissions.OnBypassPermissions += BypassPermissions; + m_scene.Permissions.OnSetBypassPermissions += SetBypassPermissions; + m_scene.Permissions.OnPropagatePermissions += PropagatePermissions; + m_scene.Permissions.OnGenerateClientFlags += GenerateClientFlags; + m_scene.Permissions.OnAbandonParcel += CanAbandonParcel; + m_scene.Permissions.OnReclaimParcel += CanReclaimParcel; + m_scene.Permissions.OnDeedParcel += CanDeedParcel; + m_scene.Permissions.OnDeedObject += CanDeedObject; + m_scene.Permissions.OnIsGod += IsGod; + m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; + m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED + m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED + m_scene.Permissions.OnEditParcel += CanEditParcel; //MAYBE FULLY IMPLEMENTED + m_scene.Permissions.OnInstantMessage += CanInstantMessage; + m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED + m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED + m_scene.Permissions.OnMoveObject += CanMoveObject; //MAYBE FULLY IMPLEMENTED + m_scene.Permissions.OnObjectEntry += CanObjectEntry; + m_scene.Permissions.OnReturnObject += CanReturnObject; //NOT YET IMPLEMENTED + m_scene.Permissions.OnRezObject += CanRezObject; //MAYBE FULLY IMPLEMENTED + m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand; + m_scene.Permissions.OnRunScript += CanRunScript; //NOT YET IMPLEMENTED + m_scene.Permissions.OnCompileScript += CanCompileScript; + m_scene.Permissions.OnSellParcel += CanSellParcel; + m_scene.Permissions.OnTakeObject += CanTakeObject; + m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject; + m_scene.Permissions.OnTerraformLand += CanTerraformLand; + 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 + + m_scene.AddCommand(this, "bypass permissions", + "bypass permissions ", + "Bypass permission checks", + HandleBypassPermissions); + + m_scene.AddCommand(this, "force permissions", + "force permissions ", + "Force permissions on or off", + HandleForcePermissions); + + m_scene.AddCommand(this, "debug permissions", + "debug permissions ", + "Enable permissions debugging", + HandleDebugPermissions); + string grant = myConfig.GetString("GrantLSL",""); if (grant.Length > 0) { @@ -227,158 +294,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions } - public void AddRegion(Scene scene) - { - m_scene = scene; - - //Register functions with Scene External Checks! - m_scene.Permissions.OnBypassPermissions += BypassPermissions; - m_scene.Permissions.OnSetBypassPermissions += SetBypassPermissions; - m_scene.Permissions.OnPropagatePermissions += PropagatePermissions; - m_scene.Permissions.OnGenerateClientFlags += GenerateClientFlags; - m_scene.Permissions.OnAbandonParcel += CanAbandonParcel; - m_scene.Permissions.OnReclaimParcel += CanReclaimParcel; - m_scene.Permissions.OnDeedParcel += CanDeedParcel; - m_scene.Permissions.OnDeedObject += CanDeedObject; - m_scene.Permissions.OnIsGod += IsGod; - m_scene.Permissions.OnDuplicateObject += CanDuplicateObject; - m_scene.Permissions.OnDeleteObject += CanDeleteObject; //MAYBE FULLY IMPLEMENTED - m_scene.Permissions.OnEditObject += CanEditObject; //MAYBE FULLY IMPLEMENTED - m_scene.Permissions.OnEditParcel += CanEditParcel; //MAYBE FULLY IMPLEMENTED - m_scene.Permissions.OnInstantMessage += CanInstantMessage; - m_scene.Permissions.OnInventoryTransfer += CanInventoryTransfer; //NOT YET IMPLEMENTED - m_scene.Permissions.OnIssueEstateCommand += CanIssueEstateCommand; //FULLY IMPLEMENTED - m_scene.Permissions.OnMoveObject += CanMoveObject; //MAYBE FULLY IMPLEMENTED - m_scene.Permissions.OnObjectEntry += CanObjectEntry; - m_scene.Permissions.OnReturnObject += CanReturnObject; //NOT YET IMPLEMENTED - m_scene.Permissions.OnRezObject += CanRezObject; //MAYBE FULLY IMPLEMENTED - m_scene.Permissions.OnRunConsoleCommand += CanRunConsoleCommand; - m_scene.Permissions.OnRunScript += CanRunScript; //NOT YET IMPLEMENTED - m_scene.Permissions.OnCompileScript += CanCompileScript; - m_scene.Permissions.OnSellParcel += CanSellParcel; - m_scene.Permissions.OnTakeObject += CanTakeObject; - m_scene.Permissions.OnTakeCopyObject += CanTakeCopyObject; - m_scene.Permissions.OnTerraformLand += CanTerraformLand; - 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 - - m_scene.AddCommand(this, "bypass permissions", - "bypass permissions ", - "Bypass permission checks", - HandleBypassPermissions); - - m_scene.AddCommand(this, "force permissions", - "force permissions ", - "Force permissions on or off", - HandleForcePermissions); - - m_scene.AddCommand(this, "debug permissions", - "debug permissions ", - "Enable permissions debugging", - HandleDebugPermissions); - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void RegionLoaded(Scene scene) - { - 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 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) { if (m_scene.ConsoleScene() != null && @@ -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 ed7bfe1a01..37f1f2eb9f 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 948c47ce10..0712a7fabc 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,6 +346,57 @@ namespace OpenSim.Region.CoreModules // m_latitude = d_latitude; // m_longitude = d_longitude; } + + switch (m_RegionMode) + { + case "T1": + default: + case "SL": + // Time taken to complete a cycle (day and season) + + SecondsPerSunCycle = (uint) (m_DayLengthHours * 60 * 60); + SecondsPerYear = (uint) (SecondsPerSunCycle*m_YearLengthDays); + + // Ration of real-to-virtual time + + // VWTimeRatio = 24/m_day_length; + + // Speed of rotation needed to complete a cycle in the + // designated period (day and season) + + SunSpeed = m_SunCycle/SecondsPerSunCycle; + SeasonSpeed = m_SeasonalCycle/SecondsPerYear; + + // Horizon translation + + HorizonShift = m_HorizonShift; // Z axis translation + // HoursToRadians = (SunCycle/24)*VWTimeRatio; + + // Insert our event handling hooks + + scene.EventManager.OnFrame += SunUpdate; + scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; + scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate; + scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour; + + ready = true; + + m_log.Debug("[SUN]: Mode is " + m_RegionMode); + m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days"); + m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift); + m_log.Debug("[SUN]: Percentage of time for daylight " + m_DayTimeSunHourScale); + m_log.Debug("[SUN]: Positional data updated every " + m_UpdateInterval + " frames"); + + break; + } + + scene.RegisterModuleInterface(this); + + } + + + public void PostInitialise() + { } public void Close() @@ -351,84 +415,10 @@ namespace OpenSim.Region.CoreModules get { return "SunModule"; } } - public Type ReplaceableInterface + public bool IsSharedModule { - get { return null; } + get { return false; } } - - 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": - default: - case "SL": - // Time taken to complete a cycle (day and season) - - SecondsPerSunCycle = (uint)(m_DayLengthHours * 60 * 60); - SecondsPerYear = (uint)(SecondsPerSunCycle * m_YearLengthDays); - - // Ration of real-to-virtual time - - // VWTimeRatio = 24/m_day_length; - - // Speed of rotation needed to complete a cycle in the - // designated period (day and season) - - SunSpeed = m_SunCycle / SecondsPerSunCycle; - SeasonSpeed = m_SeasonalCycle / SecondsPerYear; - - // Horizon translation - - HorizonShift = m_HorizonShift; // Z axis translation - // HoursToRadians = (SunCycle/24)*VWTimeRatio; - - // Insert our event handling hooks - - scene.EventManager.OnFrame += SunUpdate; - scene.EventManager.OnAvatarEnteringNewParcel += AvatarEnteringParcel; - scene.EventManager.OnEstateToolsSunUpdate += EstateToolsSunUpdate; - scene.EventManager.OnGetCurrentTimeAsLindenSunHour += GetCurrentTimeAsLindenSunHour; - - ready = true; - - m_log.Debug("[SUN]: Mode is " + m_RegionMode); - m_log.Debug("[SUN]: Initialization completed. Day is " + SecondsPerSunCycle + " seconds, and year is " + m_YearLengthDays + " days"); - m_log.Debug("[SUN]: Axis offset is " + m_HorizonShift); - m_log.Debug("[SUN]: Percentage of time for daylight " + m_DayTimeSunHourScale); - m_log.Debug("[SUN]: Positional data updated every " + m_UpdateInterval + " frames"); - - break; - } - - scene.RegisterModuleInterface(this); - } - - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - scene.RegisterModuleInterface(this); - scene.EventManager.OnFrame -= SunUpdate; - scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel; - scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate; - scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour; - } - #endregion #region EventManager Events diff --git a/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs b/OpenSim/Region/CoreModules/World/Vegetation/VegetationModule.cs index 0b487ed442..c2ad7b8c38 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 cd3706d7b3..3283c1ffa7 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,19 +149,13 @@ 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() { if (m_enabled) @@ -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 6bda1e9e6d..285d36a3d6 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,36 +128,23 @@ 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 + public void PostInitialise() { - get { return null; } - } - - public void RegionLoaded(Scene scene) - { - } - - 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 dd336735a3..be46fa55b2 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) diff --git a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs index b0cefc3047..4df9094644 100644 --- a/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs +++ b/OpenSim/Region/DataSnapshot/DataSnapshotManager.cs @@ -33,7 +33,6 @@ using System.Net; using System.Reflection; using System.Xml; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -44,8 +43,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.DataSnapshot { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class DataSnapshotManager : ISharedRegionModule, IDataSnapshot + public class DataSnapshotManager : IRegionModule, IDataSnapshot { #region Class members //Information from config @@ -91,7 +89,7 @@ namespace OpenSim.Region.DataSnapshot #region IRegionModule - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { if (!m_configLoaded) { @@ -142,29 +140,24 @@ namespace OpenSim.Region.DataSnapshot return; } } + + if (m_enabled) + { + //Hand it the first scene, assuming that all scenes have the same BaseHTTPServer + new DataRequestHandler(scene, this); + + m_hostname = scene.RegionInfo.ExternalHostName; + m_snapStore = new SnapshotStore(m_snapsDir, m_gridinfo, m_listener_port, m_hostname); + + MakeEverythingStale(); + + if (m_dataServices != "" && m_dataServices != "noservices") + NotifyDataServices(m_dataServices, "online"); + } } - } - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { if (m_enabled) { - //Hand it the first scene, assuming that all scenes have the same BaseHTTPServer - new DataRequestHandler(scene, this); - - m_hostname = scene.RegionInfo.ExternalHostName; - m_snapStore = new SnapshotStore(m_snapsDir, m_gridinfo, m_listener_port, m_hostname); - - MakeEverythingStale(); - - if (m_dataServices != "" && m_dataServices != "noservices") - NotifyDataServices(m_dataServices, "online"); - m_log.Info("[DATASNAPSHOT]: Scene added to module."); m_snapStore.AddScene(scene); @@ -198,27 +191,22 @@ namespace OpenSim.Region.DataSnapshot } else { - m_log.Info("[DATASNAPSHOT]: Data snapshot disabled, not adding scene to module (or anything else)."); + m_log.Warn("[DATASNAPSHOT]: Data snapshot disabled, not adding scene to module (or anything else)."); } } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - if (m_scenes.Contains(scene)) - m_scenes.Remove(scene); - m_snapStore.RemoveScene(scene); - } - public void Close() { if (m_enabled && m_dataServices != "" && m_dataServices != "noservices") NotifyDataServices(m_dataServices, "offline"); } + + public bool IsSharedModule + { + get { return true; } + } + public string Name { get { return "External Data Generator"; } @@ -226,6 +214,7 @@ namespace OpenSim.Region.DataSnapshot public void PostInitialise() { + } #endregion diff --git a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs index 879114b18c..f8a5bad347 100644 --- a/OpenSim/Region/Framework/Interfaces/ICloudModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ICloudModule.cs @@ -28,7 +28,7 @@ namespace OpenSim.Region.Framework.Interfaces { - public interface ICloudModule : INonSharedRegionModule + public interface ICloudModule : IRegionModule { /// /// Retrieves the cloud density at the given region coordinates diff --git a/OpenSim/Region/Framework/Interfaces/IEmailModule.cs b/OpenSim/Region/Framework/Interfaces/IEmailModule.cs index bdad0b4061..3a2c4231cf 100644 --- a/OpenSim/Region/Framework/Interfaces/IEmailModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEmailModule.cs @@ -38,7 +38,7 @@ namespace OpenSim.Region.Framework.Interfaces public int numLeft; } - public interface IEmailModule : ISharedRegionModule + public interface IEmailModule : IRegionModule { void SendEmail(UUID objectID, string address, string subject, string body); Email GetNextEmail(UUID objectID, string sender, string subject); diff --git a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs index 347818cf42..890fa31df0 100644 --- a/OpenSim/Region/Framework/Interfaces/IEstateModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IEstateModule.cs @@ -29,7 +29,7 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { - public interface IEstateModule : INonSharedRegionModule + public interface IEstateModule : IRegionModule { uint GetRegionFlags(); bool IsManager(UUID avatarID); diff --git a/OpenSim/Region/Framework/Interfaces/ISunModule.cs b/OpenSim/Region/Framework/Interfaces/ISunModule.cs index 8231716f2e..819ae11d3c 100644 --- a/OpenSim/Region/Framework/Interfaces/ISunModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ISunModule.cs @@ -29,7 +29,7 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { - public interface ISunModule : INonSharedRegionModule + public interface ISunModule : IRegionModule { double GetSunParameter(string param); diff --git a/OpenSim/Region/Framework/Interfaces/IWindModule.cs b/OpenSim/Region/Framework/Interfaces/IWindModule.cs index 4a26a717db..10ecc325c8 100644 --- a/OpenSim/Region/Framework/Interfaces/IWindModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IWindModule.cs @@ -29,7 +29,7 @@ using OpenMetaverse; namespace OpenSim.Region.Framework.Interfaces { - public interface IWindModule : INonSharedRegionModule + public interface IWindModule : IRegionModule { /// diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs index ec040dbbf2..cfe1278786 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/IRCStackModule.cs @@ -25,11 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Net; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -37,23 +35,24 @@ using OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server; namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class IRCStackModule : INonSharedRegionModule + public class IRCStackModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private IRCServer m_server; // private Scene m_scene; - private int portNo; - #region Implementation of ISharedRegionModule + #region Implementation of IRegionModule - public void Initialise(IConfigSource source) + public void Initialise(Scene scene, IConfigSource source) { if (null != source.Configs["IRCd"] && source.Configs["IRCd"].GetBoolean("Enabled",false)) { - portNo = source.Configs["IRCd"].GetInt("Port",6666); + int portNo = source.Configs["IRCd"].GetInt("Port",6666); +// m_scene = scene; + m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), portNo, scene); + m_server.OnNewIRCClient += m_server_OnNewIRCClient; } } @@ -69,20 +68,9 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView m_log.Info("[IRCd] Added user to Scene"); } - public void AddRegion(Scene scene) + public void PostInitialise() { - if (portNo != null) - { - m_server = new IRCServer(IPAddress.Parse("0.0.0.0"), portNo, scene); - m_server.OnNewIRCClient += m_server_OnNewIRCClient; - } - } - public void RegionLoaded(Scene scene) - { - } - public void RemoveRegion(Scene scene) - { } public void Close() @@ -95,9 +83,9 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView get { return "IRCClientStackModule"; } } - public Type ReplaceableInterface + public bool IsSharedModule { - get { return null; } + get { return false; } } #endregion diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 23ae307910..b04b076629 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -38,7 +38,6 @@ using System.Collections.Generic; using System.Reflection; using OpenMetaverse; using log4net; -using Mono.Addins; using Nini.Config; using Nwc.XmlRpc; using OpenSim.Framework; @@ -54,8 +53,7 @@ using System.Text.RegularExpressions; namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class FreeSwitchVoiceModule : ISharedRegionModule, IVoiceModule + public class FreeSwitchVoiceModule : IRegionModule, IVoiceModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -110,8 +108,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice private IConfig m_config; - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { + m_scene = scene; m_config = config.Configs["FreeSwitchVoice"]; if (null == m_config) @@ -225,21 +224,17 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice return; } } - } - public void AddRegion(Scene scene) - { - m_scene = scene; - if (m_pluginEnabled) + if (m_pluginEnabled) { // we need to capture scene in an anonymous method // here as we need it later in the callbacks scene.EventManager.OnRegisterCaps += delegate(UUID agentID, Caps caps) - { - OnRegisterCaps(scene, agentID, caps); - }; - - + { + OnRegisterCaps(scene, agentID, caps); + }; + + try { @@ -259,53 +254,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice m_log.Error("[FreeSwitchVoice]: Certificate validation handler change not supported. You may get ssl certificate validation errors teleporting from your region to some SSL regions."); } } - + } + } + + public void PostInitialise() + { if (m_pluginEnabled) { m_log.Info("[FreeSwitchVoice] registering IVoiceModule with the scene"); - + // register the voice interface for this module, so the script engine can call us m_scene.RegisterModuleInterface(this); } } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - if (UseProxy) - { - MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/", m_freeSwitchAPIPrefix)); - } - else - { - MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/viv_get_prelogin.php", m_freeSwitchAPIPrefix)); - - MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/viv_signin.php", m_freeSwitchAPIPrefix)); - - MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/freeswitch-config", m_freeSwitchAPIPrefix)); - - MainServer.Instance.RemoveHTTPHandler("", String.Format("{0}/viv_buddy.php", m_freeSwitchAPIPrefix)); - } - scene.EventManager.OnRegisterCaps -= delegate(UUID agentID, Caps caps) - { - OnRegisterCaps(scene, agentID, caps); - }; - scene.UnregisterModuleInterface(this); - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void PostInitialise() - { - } - public void Close() { } @@ -314,6 +277,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice { get { return "FreeSwitchVoiceModule"; } } + + public bool IsSharedModule + { + get { return true; } + } // // implementation of IVoiceModule, called by osSetParcelSIPAddress script function diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs index 6769d59bc6..3d1c346dc8 100644 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs +++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/ContentManagementModule.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -38,7 +38,6 @@ using System.Threading; using OpenMetaverse; -using Mono.Addins; using Nini.Config; using OpenSim; @@ -51,8 +50,7 @@ using log4net; namespace OpenSim.Region.OptionalModules.ContentManagement { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class ContentManagementModule : ISharedRegionModule + public class ContentManagementModule : IRegionModule { #region Static Fields @@ -62,20 +60,22 @@ namespace OpenSim.Region.OptionalModules.ContentManagement #region Fields - private bool initialised = false; - private CMController m_control = null; - private bool m_enabled = false; - private CMModel m_model = null; - private bool m_posted = false; - private CMView m_view = null; - private string databaseDir = "./"; - private string database = "FileSystemDatabase"; - private int channel = 345; + bool initialised = false; + CMController m_control = null; + bool m_enabled = false; + CMModel m_model = null; + bool m_posted = false; + CMView m_view = null; #endregion Fields #region Public Properties + public bool IsSharedModule + { + get { return true; } + } + public string Name { get { return "ContentManagementModule"; } @@ -89,8 +89,11 @@ namespace OpenSim.Region.OptionalModules.ContentManagement { } - public void Initialise(IConfigSource source) + public void Initialise(Scene scene, IConfigSource source) { + string databaseDir = "./"; + string database = "FileSystemDatabase"; + int channel = 345; try { if (source.Configs["CMS"] == null) @@ -112,15 +115,13 @@ namespace OpenSim.Region.OptionalModules.ContentManagement m_log.ErrorFormat("[Content Management]: Exception thrown while reading parameters from configuration file. Message: " + e); m_enabled = false; } - } - public void AddRegion(Scene scene) - { if (!m_enabled) { m_log.Info("[Content Management]: Content Management System is not Enabled."); return; } + lock (this) { if (!initialised) //only init once @@ -141,18 +142,6 @@ namespace OpenSim.Region.OptionalModules.ContentManagement } } } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - } - - public Type ReplaceableInterface - { - get { return null; } - } public void PostInitialise() { diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs index f24bcdc1e7..4521f8ef6a 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs @@ -38,7 +38,6 @@ using System.Security.Policy; using System.Text; using log4net; using Microsoft.CSharp; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenSim.Framework; @@ -47,8 +46,7 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.OptionalModules.Scripting.Minimodule { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class MRMModule : INonSharedRegionModule, IMRMModule + public class MRMModule : IRegionModule, IMRMModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; @@ -64,14 +62,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule private IConfig m_config; - private bool m_hidden = true; - public void RegisterExtension(T instance) { m_extensions[typeof (T)] = instance; } - public void Initialise(IConfigSource source) + public void Initialise(Scene scene, IConfigSource source) { if (source.Configs["MRM"] != null) { @@ -80,10 +76,19 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule if (source.Configs["MRM"].GetBoolean("Enabled", false)) { m_log.Info("[MRM] Enabling MRM Module"); - + m_scene = scene; + // when hidden, we don't listen for client initiated script events // only making the MRM engine available for region modules - m_hidden = source.Configs["MRM"].GetBoolean("Hidden", false); + if (!source.Configs["MRM"].GetBoolean("Hidden", false)) + { + scene.EventManager.OnRezScript += EventManager_OnRezScript; + scene.EventManager.OnStopScript += EventManager_OnStopScript; + } + + scene.EventManager.OnFrame += EventManager_OnFrame; + + scene.RegisterModuleInterface(this); } else { @@ -96,39 +101,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule } } - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { - m_scene = scene; - if (!m_hidden) - { - scene.EventManager.OnRezScript += EventManager_OnRezScript; - scene.EventManager.OnStopScript += EventManager_OnStopScript; - } - scene.EventManager.OnFrame += EventManager_OnFrame; - - scene.RegisterModuleInterface(this); - } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - if (!m_hidden) - { - scene.EventManager.OnRezScript -= EventManager_OnRezScript; - scene.EventManager.OnStopScript -= EventManager_OnStopScript; - } - scene.EventManager.OnFrame -= EventManager_OnFrame; - - scene.UnregisterModuleInterface(this); - } - void EventManager_OnStopScript(uint localID, UUID itemID) { if (m_scripts.ContainsKey(itemID)) @@ -330,6 +302,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule mmb.InitMiniModule(world, host, itemID); } + public void PostInitialise() + { + + } + public void Close() { foreach (KeyValuePair pair in m_scripts) @@ -343,6 +320,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule get { return "MiniRegionModule"; } } + public bool IsSharedModule + { + get { return false; } + } + /// /// Stolen from ScriptEngine Common /// diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index 999756a93f..c653e98401 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -100,10 +100,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady if (!m_enabled) return; - scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; - scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; + m_scene.EventManager.OnEmptyScriptCompileQueue -= OnEmptyScriptCompileQueue; + m_scene.EventManager.OnOarFileLoaded -= OnOarFileLoaded; - scene = null; + m_scene = null; } public void Close() diff --git a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs index df01938d5f..44c9ada221 100644 --- a/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/ScriptModuleComms/ScriptModuleCommsModule.cs @@ -58,7 +58,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.ScriptModuleComms public void RemoveRegion(Scene scene) { - scene.UnregisterModuleInterface(this); } public void RegionLoaded(Scene scene) diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs index f2a0e53558..d18ac0a90c 100644 --- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcGridRouterModule.cs @@ -30,7 +30,6 @@ using System.Collections.Generic; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; @@ -50,8 +49,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule public string uri; } - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class XmlRpcGridRouter : INonSharedRegionModule, IXmlRpcRouter + public class XmlRpcGridRouter : IRegionModule, IXmlRpcRouter { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -61,7 +59,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule private bool m_Enabled = false; private string m_ServerURI = String.Empty; - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { IConfig startupConfig = config.Configs["Startup"]; if (startupConfig == null) @@ -77,26 +75,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule return; } + scene.RegisterModuleInterface(this); m_Enabled = true; } } - public void AddRegion(Scene scene) + public void PostInitialise() { - scene.RegisterModuleInterface(this); - } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - scene.UnregisterModuleInterface(this); - } - - public Type ReplaceableInterface - { - get { return null; } } public void Close() @@ -108,6 +93,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcGridRouterModule get { return "XmlRpcGridRouterModule"; } } + public bool IsSharedModule + { + get { return false; } + } + public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) { if (!m_Channels.ContainsKey(itemID)) diff --git a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs index 4d39345302..32659c8e5d 100644 --- a/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/XmlRpcRouterModule/XmlRpcRouterModule.cs @@ -29,7 +29,6 @@ using System; using System.Reflection; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; @@ -40,12 +39,11 @@ using OpenSim.Region.Framework.Scenes; namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class XmlRpcRouter : INonSharedRegionModule, IXmlRpcRouter + public class XmlRpcRouter : IRegionModule, IXmlRpcRouter { //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private bool m_enabled = false; - public void Initialise(IConfigSource config) + + public void Initialise(Scene scene, IConfigSource config) { IConfig startupConfig = config.Configs["Startup"]; if (startupConfig == null) @@ -54,25 +52,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule if (startupConfig.GetString("XmlRpcRouterModule", "XmlRpcRouterModule") == "XmlRpcRouterModule") { - m_enabled = true; + scene.RegisterModuleInterface(this); } } - public void AddRegion(Scene scene) - { - scene.RegisterModuleInterface(this); - } - public void RegionLoaded(Scene scene) - { - } - public void RemoveRegion(Scene scene) + public void PostInitialise() { - scene.UnregisterModuleInterface(this); - } - - public Type ReplaceableInterface - { - get { return null; } } public void Close() @@ -84,6 +69,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.XmlRpcRouterModule get { return "XmlRpcRouterModule"; } } + public bool IsSharedModule + { + get { return false; } + } + public void RegisterNewReceiver(IScriptModule scriptEngine, UUID channel, UUID objectID, UUID itemID, string uri) { scriptEngine.PostScriptEvent(itemID, "xmlrpc_uri", new Object[] {uri}); diff --git a/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs b/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs index 801f1f8f50..97fa63cb45 100644 --- a/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/ServiceConnectorsIn/Freeswitch/FreeswitchServiceInConnectorModule.cs @@ -47,7 +47,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Freeswitch private IConfigSource m_Config; bool m_Registered = false; - #region ISharedRegionModule interface + #region IRegionModule interface public void Initialise(IConfigSource config) { diff --git a/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs b/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs index fa5878d5c5..3490a8baef 100644 --- a/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs +++ b/OpenSim/Region/OptionalModules/SvnSerialiser/SvnBackupModule.cs @@ -31,7 +31,6 @@ using System.IO; using System.Reflection; using System.Timers; using log4net; -using Mono.Addins; using Nini.Config; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.CoreModules.World.Serialiser; @@ -43,8 +42,7 @@ using Slash = System.IO.Path; namespace OpenSim.Region.Modules.SvnSerialiser { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class SvnBackupModule : ISharedRegionModule + public class SvnBackupModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -202,9 +200,9 @@ namespace OpenSim.Region.Modules.SvnSerialiser #endregion - #region ISharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource source) + public void Initialise(Scene scene, IConfigSource source) { m_scenes = new List(); m_timer = new Timer(); @@ -227,10 +225,7 @@ namespace OpenSim.Region.Modules.SvnSerialiser catch (Exception) { } - } - public void AddRegion(Scene scene) - { lock (m_scenes) { m_scenes.Add(scene); @@ -241,18 +236,6 @@ namespace OpenSim.Region.Modules.SvnSerialiser scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; } } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - } - - public Type ReplaceableInterface - { - get { return null; } - } public void PostInitialise() { @@ -294,6 +277,11 @@ namespace OpenSim.Region.Modules.SvnSerialiser get { return "SvnBackupModule"; } } + public bool IsSharedModule + { + get { return true; } + } + #endregion private void EventManager_OnPluginConsole(string[] args) diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs index 521d01a7d4..ac39a532ae 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCModule.cs @@ -25,11 +25,9 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -using System; using System.Collections.Generic; using System.Threading; using OpenMetaverse; -using Mono.Addins; using Nini.Config; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; @@ -39,8 +37,7 @@ using Timer=System.Timers.Timer; namespace OpenSim.Region.OptionalModules.World.NPC { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class NPCModule : ISharedRegionModule, INPCModule + public class NPCModule : IRegionModule, INPCModule { // private const bool m_enabled = false; @@ -137,13 +134,15 @@ namespace OpenSim.Region.OptionalModules.World.NPC } - public void Initialise(IConfigSource source) + public void Initialise(Scene scene, IConfigSource source) { m_createMutex = new Mutex(false); m_timer = new Timer(500); m_timer.Elapsed += m_timer_Elapsed; m_timer.Start(); + + scene.RegisterModuleInterface(this); } void m_timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) @@ -174,19 +173,6 @@ namespace OpenSim.Region.OptionalModules.World.NPC } } - public void AddRegion(Scene scene) - { - scene.RegisterModuleInterface(this); - } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - scene.UnregisterModuleInterface(this); - } - public void PostInitialise() { } @@ -200,9 +186,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC get { return "NPCModule"; } } - public Type ReplaceableInterface + public bool IsSharedModule { - get { return null; } - } + get { return true; } + } } } diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs index b59d07adde..e3fbb6ee09 100644 --- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs +++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs @@ -31,7 +31,6 @@ using System.Reflection; using System.Timers; using OpenMetaverse; using log4net; -using Mono.Addins; using Nini.Config; using OpenSim.Framework; using OpenSim.Region.CoreModules.Framework.InterfaceCommander; @@ -47,8 +46,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator /// /// Version 2.02 - Still hacky /// - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class TreePopulatorModule : INonSharedRegionModule, ICommandableModule, IVegetationModule + public class TreePopulatorModule : IRegionModule, ICommandableModule, IVegetationModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private readonly Commander m_commander = new Commander("tree"); @@ -170,10 +168,15 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator #endregion - #region ISharedRegionModule Members + #region IRegionModule Members - public void Initialise(IConfigSource config) + public void Initialise(Scene scene, IConfigSource config) { + + m_scene = scene; + m_scene.RegisterModuleInterface(this); + m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; + // ini file settings try { @@ -193,18 +196,12 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator m_log.Debug("[TREES]: ini failure for update_rate - using default"); } + InstallCommands(); + m_log.Debug("[TREES]: Initialised tree module"); } - public void AddRegion(Scene scene) - { - m_scene = scene; - m_scene.RegisterModuleInterface(this); - m_scene.EventManager.OnPluginConsole += EventManager_OnPluginConsole; - InstallCommands(); - } - - public void RegionLoaded(Scene scene) + public void PostInitialise() { ReloadCopse(); if (m_copse.Count > 0) @@ -214,17 +211,6 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator activeizeTreeze(true); } - public void RemoveRegion(Scene scene) - { - scene.UnregisterModuleInterface(this); - scene.EventManager.OnPluginConsole -= EventManager_OnPluginConsole; - } - - public Type ReplaceableInterface - { - get { return null; } - } - public void Close() { } @@ -234,6 +220,11 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator get { return "TreePopulatorModule"; } } + public bool IsSharedModule + { + get { return false; } + } + #endregion //-------------------------------------------------------------- diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index 9b53d06bb9..a03cc4cf50 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs @@ -34,7 +34,6 @@ using System.Reflection; using System.Text; using System.Threading; using log4net; -using Mono.Addins; using Nini.Config; using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -53,8 +52,7 @@ using OSDMap = OpenMetaverse.StructuredData.OSDMap; namespace OpenSim.Region.UserStatistics { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] - public class WebStatsModule : ISharedRegionModule + public class WebStatsModule : IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -72,7 +70,7 @@ namespace OpenSim.Region.UserStatistics private string m_loglines = String.Empty; private volatile int lastHit = 12000; - public virtual void Initialise(IConfigSource config) + public virtual void Initialise(Scene scene, IConfigSource config) { IConfig cnfg; try @@ -84,17 +82,11 @@ namespace OpenSim.Region.UserStatistics { enabled = false; } - } - - public Type ReplaceableInterface - { - get { return null; } - } - - public void AddRegion(Scene scene) - { + if (!enabled) + { return; + } lock (m_scene) { @@ -138,7 +130,7 @@ namespace OpenSim.Region.UserStatistics MainServer.Instance.AddHTTPHandler("/SStats/", HandleStatsRequest); MainServer.Instance.AddHTTPHandler("/CAPS/VS/", HandleUnknownCAPSRequest); } - + m_scene.Add(scene); if (m_simstatsCounters.ContainsKey(scene.RegionInfo.RegionID)) m_simstatsCounters.Remove(scene.RegionInfo.RegionID); @@ -148,14 +140,6 @@ namespace OpenSim.Region.UserStatistics } } - public void RegionLoaded(Scene scene) - { - } - - public void RemoveRegion(Scene scene) - { - } - public void ReceiveClassicSimStatsPacket(SimStats stats) { if (!enabled) @@ -324,6 +308,11 @@ namespace OpenSim.Region.UserStatistics get { return "ViewerStatsModule"; } } + public bool IsSharedModule + { + get { return true; } + } + public void OnRegisterCaps(UUID agentID, Caps caps) { m_log.DebugFormat("[VC]: OnRegisterCaps: agentID {0} caps {1}", agentID, caps); diff --git a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs index 20f2bca301..b13e8dd208 100644 --- a/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs +++ b/OpenSim/Tests/Common/Setup/SceneSetupHelpers.cs @@ -161,11 +161,10 @@ namespace OpenSim.Tests.Common.Setup capsModule.Initialise(new IniConfigSource()); testScene.AddRegionModule(capsModule.Name, capsModule); capsModule.AddRegion(testScene); - - INonSharedRegionModule godsModule = new GodsModule(); - godsModule.Initialise(new IniConfigSource()); - testScene.AddRegionModule(godsModule.Name, godsModule); - godsModule.AddRegion(testScene); + + IRegionModule godsModule = new GodsModule(); + godsModule.Initialise(testScene, new IniConfigSource()); + testScene.AddModule(godsModule.Name, godsModule); realServices = realServices.ToLower(); // IConfigSource config = new IniConfigSource(); From 536a6bac72b33220dc785e70dd703b02330f3812 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 29 Jan 2010 07:42:45 +0000 Subject: [PATCH 02/27] Resolve one more conflict I overlooked --- .../Scripting/WorldComm/WorldCommModule.cs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 93aa88c4de..60df2e7273 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs @@ -120,20 +120,6 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm if (maxlisteners < 1) maxlisteners = int.MaxValue; if (maxhandles < 1) maxhandles = int.MaxValue; -<<<<<<< HEAD:OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs - m_listenerManager = new ListenerManager(maxlisteners, maxhandles); - m_pendingQ = new Queue(); - m_pending = Queue.Synchronized(m_pendingQ); - } - - public void PostInitialise() - { - } - - public void AddRegion(Scene scene) - { -======= ->>>>>>> ec3c31e... Updates all IRegionModules to the new style region modules.:OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs m_scene = scene; m_scene.RegisterModuleInterface(this); m_listenerManager = new ListenerManager(maxlisteners, maxhandles); From ae2174d8f526b225c3cccf551f1a9f01d6569203 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 29 Jan 2010 18:11:53 +0000 Subject: [PATCH 03/27] Add method to get all items with the same name from a particular prim Extend load oar test to check loading of a sound item --- .../World/Archiver/Tests/ArchiverTests.cs | 9 +++---- .../Framework/Interfaces/IEntityInventory.cs | 13 +++++++++- .../Scenes/SceneObjectPartInventory.cs | 26 ++++++++++++++++++- 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 1200105817..bf80a1cbb9 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -237,6 +237,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests SceneObjectGroup object1 = new SceneObjectGroup(part1); // Let's put some inventory items into our object + string soundItemName = "sound-item1"; UUID soundItemUuid = UUID.Parse("00000000-0000-0000-0000-000000000002"); Type type = GetType(); Assembly assembly = type.Assembly; @@ -269,7 +270,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav"; */ - TaskInventoryItem item1 = new TaskInventoryItem { AssetID = soundUuid, ItemID = soundItemUuid }; + TaskInventoryItem item1 + = new TaskInventoryItem { AssetID = soundUuid, ItemID = soundItemUuid, Name = soundItemName }; part1.Inventory.AddInventoryItem(item1, true); } } @@ -305,14 +307,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests Assert.That( object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal"); - // Need to implement a method to get the task inventory item by name (since the uuid will have changed on load) - /* - TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItem(soundItemUuid); + TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItems(soundItemName)[0]; Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null"); AssetBase loadedSoundAsset = scene.AssetService.Get(loadedSoundItem.AssetID.ToString()); Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null"); Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match"); - */ // Temporary Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index eeb51024e9..fa9bf19dee 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs @@ -71,7 +71,8 @@ namespace OpenSim.Region.Framework.Interfaces /// /// Start all the scripts contained in this entity's inventory /// - void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); + void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); + ArrayList GetScriptErrors(UUID itemID); /// @@ -142,6 +143,16 @@ namespace OpenSim.Region.Framework.Interfaces /// null if the item does not exist TaskInventoryItem GetInventoryItem(UUID itemId); + /// + /// Get inventory items by name. + /// + /// + /// + /// A list of inventory items with that name. + /// If no inventory item has that name then an empty list is returned. + /// + IList GetInventoryItems(string name); + /// /// Update an existing inventory item. /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 5f132788e1..b37e1a29cf 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -554,8 +554,32 @@ namespace OpenSim.Region.Framework.Scenes m_items.TryGetValue(itemId, out item); return item; - } + } + /// + /// Get inventory items by name. + /// + /// + /// + /// A list of inventory items with that name. + /// If no inventory item has that name then an empty list is returned. + /// + public IList GetInventoryItems(string name) + { + IList items = new List(); + + lock (m_items) + { + foreach (TaskInventoryItem item in m_items.Values) + { + if (item.Name == name) + items.Add(item); + } + } + + return items; + } + /// /// Update an existing inventory item. /// From 968b9e160d70568fbdea5b190d1386e9431316e3 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 29 Jan 2010 20:36:13 +0000 Subject: [PATCH 04/27] improve locking of m_items in SceneObjectPartInventory --- .../Scenes/SceneObjectPartInventory.cs | 218 +++++++++++------- 1 file changed, 133 insertions(+), 85 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index b37e1a29cf..87c1a95197 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -44,6 +44,8 @@ namespace OpenSim.Region.Framework.Scenes { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); + private string m_inventoryFileName = String.Empty; private int m_inventoryFileNameSerial = 0; @@ -270,8 +272,12 @@ namespace OpenSim.Region.Framework.Scenes if (stateSource == 1 && // Prim crossing m_part.ParentGroup.Scene.m_trustBinaries) { - m_items[item.ItemID].PermsMask = 0; - m_items[item.ItemID].PermsGranter = UUID.Zero; + lock (m_items) + { + m_items[item.ItemID].PermsMask = 0; + m_items[item.ItemID].PermsGranter = UUID.Zero; + } + m_part.ParentGroup.Scene.EventManager.TriggerRezScript( m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource); m_part.ParentGroup.AddActiveScriptCount(1); @@ -279,33 +285,38 @@ namespace OpenSim.Region.Framework.Scenes return; } - m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset) - { - if (null == asset) - { - m_log.ErrorFormat( - "[PRIM INVENTORY]: " + - "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", - item.Name, item.ItemID, m_part.AbsolutePosition, - m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); - } - else - { - if (m_part.ParentGroup.m_savedScriptState != null) - RestoreSavedScriptState(item.OldItemID, item.ItemID); - m_items[item.ItemID].PermsMask = 0; - m_items[item.ItemID].PermsGranter = UUID.Zero; - string script = Utils.BytesToString(asset.Data); - m_part.ParentGroup.Scene.EventManager.TriggerRezScript( - m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); - m_part.ParentGroup.AddActiveScriptCount(1); - m_part.ScheduleFullUpdate(); - } - }); - } - } + m_part.ParentGroup.Scene.AssetService.Get( + item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset) + { + if (null == asset) + { + m_log.ErrorFormat( + "[PRIM INVENTORY]: " + + "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", + item.Name, item.ItemID, m_part.AbsolutePosition, + m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); + } + else + { + if (m_part.ParentGroup.m_savedScriptState != null) + RestoreSavedScriptState(item.OldItemID, item.ItemID); - static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); + lock (m_items) + { + m_items[item.ItemID].PermsMask = 0; + m_items[item.ItemID].PermsGranter = UUID.Zero; + } + + string script = Utils.BytesToString(asset.Data); + m_part.ParentGroup.Scene.EventManager.TriggerRezScript( + m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); + m_part.ParentGroup.AddActiveScriptCount(1); + m_part.ScheduleFullUpdate(); + } + } + ); + } + } private void RestoreSavedScriptState(UUID oldID, UUID newID) { @@ -397,7 +408,15 @@ namespace OpenSim.Region.Framework.Scenes /// public void RemoveScriptInstance(UUID itemId, bool sceneObjectBeingDeleted) { - if (m_items.ContainsKey(itemId)) + bool scriptPresent = false; + + lock (m_items) + { + if (m_items.ContainsKey(itemId)) + scriptPresent = true; + } + + if (scriptPresent) { if (!sceneObjectBeingDeleted) m_part.RemoveScriptEvents(itemId); @@ -469,7 +488,13 @@ namespace OpenSim.Region.Framework.Scenes /// public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop) { - List il = new List(m_items.Values); + List il; + + lock (m_items) + { + il = new List(m_items.Values); + } + foreach (TaskInventoryItem i in il) { if (i.Name == item.Name) @@ -551,7 +576,9 @@ namespace OpenSim.Region.Framework.Scenes public TaskInventoryItem GetInventoryItem(UUID itemId) { TaskInventoryItem item; - m_items.TryGetValue(itemId, out item); + + lock (m_items) + m_items.TryGetValue(itemId, out item); return item; } @@ -877,54 +904,61 @@ namespace OpenSim.Region.Framework.Scenes { uint mask=0x7fffffff; - foreach (TaskInventoryItem item in m_items.Values) + lock (m_items) { - if (item.InvType != (int)InventoryType.Object) + foreach (TaskInventoryItem item in m_items.Values) { - if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) - mask &= ~((uint)PermissionMask.Copy >> 13); - if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0) - mask &= ~((uint)PermissionMask.Transfer >> 13); - if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) - mask &= ~((uint)PermissionMask.Modify >> 13); + if (item.InvType != (int)InventoryType.Object) + { + if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) + mask &= ~((uint)PermissionMask.Copy >> 13); + if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0) + mask &= ~((uint)PermissionMask.Transfer >> 13); + if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) + mask &= ~((uint)PermissionMask.Modify >> 13); + } + else + { + if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) + mask &= ~((uint)PermissionMask.Copy >> 13); + if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) + mask &= ~((uint)PermissionMask.Transfer >> 13); + if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) + mask &= ~((uint)PermissionMask.Modify >> 13); + } + + if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) + mask &= ~(uint)PermissionMask.Copy; + if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) + mask &= ~(uint)PermissionMask.Transfer; + if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0) + mask &= ~(uint)PermissionMask.Modify; } - else - { - if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) - mask &= ~((uint)PermissionMask.Copy >> 13); - if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) - mask &= ~((uint)PermissionMask.Transfer >> 13); - if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) - mask &= ~((uint)PermissionMask.Modify >> 13); - } - - if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) - mask &= ~(uint)PermissionMask.Copy; - if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) - mask &= ~(uint)PermissionMask.Transfer; - if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0) - mask &= ~(uint)PermissionMask.Modify; } + return mask; } public void ApplyNextOwnerPermissions() { - foreach (TaskInventoryItem item in m_items.Values) + lock (m_items) { - if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) + foreach (TaskInventoryItem item in m_items.Values) { - if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) - item.CurrentPermissions &= ~(uint)PermissionMask.Copy; - if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) - item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; - if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) - item.CurrentPermissions &= ~(uint)PermissionMask.Modify; - item.CurrentPermissions |= 8; + if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) + { + if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) + item.CurrentPermissions &= ~(uint)PermissionMask.Copy; + if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) + item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; + if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) + item.CurrentPermissions &= ~(uint)PermissionMask.Modify; + item.CurrentPermissions |= 8; + } + item.CurrentPermissions &= item.NextPermissions; + item.BasePermissions &= item.NextPermissions; + item.EveryonePermissions &= item.NextPermissions; } - item.CurrentPermissions &= item.NextPermissions; - item.BasePermissions &= item.NextPermissions; - item.EveryonePermissions &= item.NextPermissions; } m_part.TriggerScriptChangedEvent(Changed.OWNER); @@ -932,22 +966,29 @@ namespace OpenSim.Region.Framework.Scenes public void ApplyGodPermissions(uint perms) { - foreach (TaskInventoryItem item in m_items.Values) + lock (m_items) { - item.CurrentPermissions = perms; - item.BasePermissions = perms; + foreach (TaskInventoryItem item in m_items.Values) + { + item.CurrentPermissions = perms; + item.BasePermissions = perms; + } } } public bool ContainsScripts() { - foreach (TaskInventoryItem item in m_items.Values) + lock (m_items) { - if (item.InvType == (int)InventoryType.LSL) + foreach (TaskInventoryItem item in m_items.Values) { - return true; + if (item.InvType == (int)InventoryType.LSL) + { + return true; + } } } + return false; } @@ -955,8 +996,11 @@ namespace OpenSim.Region.Framework.Scenes { List ret = new List(); - foreach (TaskInventoryItem item in m_items.Values) - ret.Add(item.ItemID); + lock (m_items) + { + foreach (TaskInventoryItem item in m_items.Values) + ret.Add(item.ItemID); + } return ret; } @@ -969,26 +1013,30 @@ namespace OpenSim.Region.Framework.Scenes if (engines == null) // No engine at all return ret; - foreach (TaskInventoryItem item in m_items.Values) + lock (m_items) { - if (item.InvType == (int)InventoryType.LSL) + foreach (TaskInventoryItem item in m_items.Values) { - foreach (IScriptModule e in engines) + if (item.InvType == (int)InventoryType.LSL) { - if (e != null) + foreach (IScriptModule e in engines) { - string n = e.GetXMLState(item.ItemID); - if (n != String.Empty) + if (e != null) { - if (!ret.ContainsKey(item.ItemID)) - ret[item.ItemID] = n; - break; + string n = e.GetXMLState(item.ItemID); + if (n != String.Empty) + { + if (!ret.ContainsKey(item.ItemID)) + ret[item.ItemID] = n; + break; + } } } } } } + return ret; } } -} +} \ No newline at end of file From c1da07e4eb3510588e97f4652d72f875be51faa8 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 29 Jan 2010 20:59:56 +0000 Subject: [PATCH 05/27] factor out scene setup in ArchiverTests --- .../World/Archiver/Tests/ArchiverTests.cs | 93 +++++++++++-------- 1 file changed, 53 insertions(+), 40 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index bf80a1cbb9..5a177b2266 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -42,6 +42,7 @@ using OpenSim.Region.CoreModules.World.Terrain; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; using OpenSim.Tests.Common.Setup; namespace OpenSim.Region.CoreModules.World.Archiver.Tests @@ -51,6 +52,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests { private Guid m_lastRequestId; private string m_lastErrorMessage; + + protected TestScene m_scene; + protected ArchiverModule m_archiverModule; + + [SetUp] + public void SetUp() + { + m_archiverModule = new ArchiverModule(); + SerialiserModule serialiserModule = new SerialiserModule(); + TerrainModule terrainModule = new TerrainModule(); + + m_scene = SceneSetupHelpers.SetupScene("scene1"); + SceneSetupHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule); + } private void LoadCompleted(Guid requestId, string errorMessage) { @@ -75,6 +90,23 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests } } +// protected void AddSceneObject1() +// { +// string partName = "My Little Pony"; +// UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000015"); +// PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); +// Vector3 groupPosition = new Vector3(10, 20, 30); +// Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); +// Vector3 offsetPosition = new Vector3(5, 10, 15); +// +// part1 +// = new SceneObjectPart( +// ownerId, shape, groupPosition, rotationOffset, offsetPosition); +// part1.Name = partName; +// +// scene.AddNewSceneObject(new SceneObjectGroup(part1), false); +// } + /// /// Test saving a V0.2 OpenSim Region Archive. /// @@ -84,13 +116,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - ArchiverModule archiverModule = new ArchiverModule(); - SerialiserModule serialiserModule = new SerialiserModule(); - TerrainModule terrainModule = new TerrainModule(); - - Scene scene = SceneSetupHelpers.SetupScene("asset"); - SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); - SceneObjectPart part1; // Create and add prim 1 @@ -107,7 +132,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests ownerId, shape, groupPosition, rotationOffset, offsetPosition); part1.Name = partName; - scene.AddNewSceneObject(new SceneObjectGroup(part1), false); + m_scene.AddNewSceneObject(new SceneObjectGroup(part1), false); } SceneObjectPart part2; @@ -126,17 +151,17 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests ownerId, shape, groupPosition, rotationOffset, offsetPosition); part2.Name = partName; - scene.AddNewSceneObject(new SceneObjectGroup(part2), false); + m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false); } MemoryStream archiveWriteStream = new MemoryStream(); - scene.EventManager.OnOarFileSaved += SaveCompleted; + m_scene.EventManager.OnOarFileSaved += SaveCompleted; Guid requestId = new Guid("00000000-0000-0000-0000-808080808080"); lock (this) { - archiverModule.ArchiveRegion(archiveWriteStream, requestId); + m_archiverModule.ArchiveRegion(archiveWriteStream, requestId); //AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer; //while (assetServer.HasWaitingRequests()) // assetServer.ProcessNextRequest(); @@ -224,11 +249,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests Quaternion rotationOffset = new Quaternion(60, 70, 80, 90); Vector3 offsetPosition = new Vector3(20, 25, 30); - SerialiserModule serialiserModule = new SerialiserModule(); - ArchiverModule archiverModule = new ArchiverModule(); - - Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); +// SerialiserModule serialiserModule = new SerialiserModule(); +// ArchiverModule archiverModule = new ArchiverModule(); +// +// Scene scene = SceneSetupHelpers.SetupScene(); +// SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); SceneObjectPart part1 = new SceneObjectPart( @@ -276,7 +301,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests } } - scene.AddNewSceneObject(object1, false); + m_scene.AddNewSceneObject(object1, false); string object1FileName = string.Format( "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", @@ -291,13 +316,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests lock (this) { - scene.EventManager.OnOarFileLoaded += LoadCompleted; - archiverModule.DearchiveRegion(archiveReadStream); + m_scene.EventManager.OnOarFileLoaded += LoadCompleted; + m_archiverModule.DearchiveRegion(archiveReadStream); } Assert.That(m_lastErrorMessage, Is.Null); - SceneObjectPart object1PartLoaded = scene.GetSceneObjectPart(part1Name); + SceneObjectPart object1PartLoaded = m_scene.GetSceneObjectPart(part1Name); Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded"); Assert.That(object1PartLoaded.Name, Is.EqualTo(part1Name), "object1 names not identical"); @@ -309,7 +334,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItems(soundItemName)[0]; Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null"); - AssetBase loadedSoundAsset = scene.AssetService.Get(loadedSoundItem.AssetID.ToString()); + AssetBase loadedSoundAsset = m_scene.AssetService.Get(loadedSoundItem.AssetID.ToString()); Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null"); Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match"); @@ -324,12 +349,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests public void TestLoadOarV0_2RegionSettings() { TestHelper.InMethod(); - //log4net.Config.XmlConfigurator.Configure(); - - SerialiserModule serialiserModule = new SerialiserModule(); - ArchiverModule archiverModule = new ArchiverModule(); - Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); + //log4net.Config.XmlConfigurator.Configure(); MemoryStream archiveWriteStream = new MemoryStream(); TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream); @@ -376,12 +396,12 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests lock (this) { - scene.EventManager.OnOarFileLoaded += LoadCompleted; - archiverModule.DearchiveRegion(archiveReadStream); + m_scene.EventManager.OnOarFileLoaded += LoadCompleted; + m_archiverModule.DearchiveRegion(archiveReadStream); } Assert.That(m_lastErrorMessage, Is.Null); - RegionSettings loadedRs = scene.RegionInfo.RegionSettings; + RegionSettings loadedRs = m_scene.RegionInfo.RegionSettings; Assert.That(loadedRs.AgentLimit, Is.EqualTo(17)); Assert.That(loadedRs.AllowDamage, Is.True); @@ -433,27 +453,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests // Create an oar file that we can use for the merge { - ArchiverModule archiverModule = new ArchiverModule(); - SerialiserModule serialiserModule = new SerialiserModule(); - TerrainModule terrainModule = new TerrainModule(); - - Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); - SceneObjectPart part2 = new SceneObjectPart( UUID.Zero, part2Shape, part2GroupPosition, part2RotationOffset, part2OffsetPosition); part2.Name = part2Name; SceneObjectGroup object2 = new SceneObjectGroup(part2); - scene.AddNewSceneObject(object2, false); + m_scene.AddNewSceneObject(object2, false); // Write out this scene - scene.EventManager.OnOarFileSaved += SaveCompleted; + m_scene.EventManager.OnOarFileSaved += SaveCompleted; lock (this) { - archiverModule.ArchiveRegion(archiveWriteStream); + m_archiverModule.ArchiveRegion(archiveWriteStream); Monitor.Wait(this, 60000); } } From 115e66218eaa6ca4fed8b754765e4c289c24a207 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 29 Jan 2010 21:10:14 +0000 Subject: [PATCH 06/27] refactor out scene object 1 creation n ArchiverTetss --- .../World/Archiver/Tests/ArchiverTests.cs | 66 +++++++------------ 1 file changed, 22 insertions(+), 44 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 5a177b2266..b4af8a612a 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -55,6 +55,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests protected TestScene m_scene; protected ArchiverModule m_archiverModule; + + protected SceneObjectPart m_part1; [SetUp] public void SetUp() @@ -90,22 +92,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests } } -// protected void AddSceneObject1() -// { -// string partName = "My Little Pony"; -// UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000015"); -// PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); -// Vector3 groupPosition = new Vector3(10, 20, 30); -// Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); -// Vector3 offsetPosition = new Vector3(5, 10, 15); -// -// part1 -// = new SceneObjectPart( -// ownerId, shape, groupPosition, rotationOffset, offsetPosition); -// part1.Name = partName; -// -// scene.AddNewSceneObject(new SceneObjectGroup(part1), false); -// } + protected void AddSceneObject1() + { + string partName = "My Little Pony"; + UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000015"); + PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); + Vector3 groupPosition = new Vector3(10, 20, 30); + Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); + Vector3 offsetPosition = new Vector3(5, 10, 15); + + m_part1 + = new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; + + m_scene.AddNewSceneObject(new SceneObjectGroup(m_part1), false); + } /// /// Test saving a V0.2 OpenSim Region Archive. @@ -116,24 +116,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - SceneObjectPart part1; - - // Create and add prim 1 - { - string partName = "My Little Pony"; - UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000015"); - PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere(); - Vector3 groupPosition = new Vector3(10, 20, 30); - Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); - Vector3 offsetPosition = new Vector3(5, 10, 15); - - part1 - = new SceneObjectPart( - ownerId, shape, groupPosition, rotationOffset, offsetPosition); - part1.Name = partName; - - m_scene.AddNewSceneObject(new SceneObjectGroup(part1), false); - } + AddSceneObject1(); SceneObjectPart part2; @@ -180,9 +163,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests bool gotObject2File = false; string expectedObject1FileName = string.Format( "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", - part1.Name, - Math.Round(part1.GroupPosition.X), Math.Round(part1.GroupPosition.Y), Math.Round(part1.GroupPosition.Z), - part1.UUID); + m_part1.Name, + Math.Round(m_part1.GroupPosition.X), Math.Round(m_part1.GroupPosition.Y), Math.Round(m_part1.GroupPosition.Z), + m_part1.UUID); string expectedObject2FileName = string.Format( "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", part2.Name, @@ -202,7 +185,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests { string fileName = filePath.Remove(0, ArchiveConstants.OBJECTS_PATH.Length); - if (fileName.StartsWith(part1.Name)) + if (fileName.StartsWith(m_part1.Name)) { Assert.That(fileName, Is.EqualTo(expectedObject1FileName)); gotObject1File = true; @@ -243,18 +226,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); + AddSceneObject1(); string part1Name = "object1"; PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder(); Vector3 groupPosition = new Vector3(90, 80, 70); Quaternion rotationOffset = new Quaternion(60, 70, 80, 90); Vector3 offsetPosition = new Vector3(20, 25, 30); -// SerialiserModule serialiserModule = new SerialiserModule(); -// ArchiverModule archiverModule = new ArchiverModule(); -// -// Scene scene = SceneSetupHelpers.SetupScene(); -// SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); - SceneObjectPart part1 = new SceneObjectPart( UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition); From 75dcd721de7aec4e43d091724ac883b1d945aae2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 29 Jan 2010 21:27:14 +0000 Subject: [PATCH 07/27] use common part1 creation in ArchiverTests.TestLoadOarV0_2() --- .../World/Archiver/Tests/ArchiverTests.cs | 58 +++++++++---------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index b4af8a612a..a0958d1e33 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -55,8 +55,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests protected TestScene m_scene; protected ArchiverModule m_archiverModule; - - protected SceneObjectPart m_part1; [SetUp] public void SetUp() @@ -92,7 +90,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests } } - protected void AddSceneObject1() + protected SceneObjectPart CreateSceneObjectPart1() { string partName = "My Little Pony"; UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000015"); @@ -101,10 +99,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests Quaternion rotationOffset = new Quaternion(20, 30, 40, 50); Vector3 offsetPosition = new Vector3(5, 10, 15); - m_part1 - = new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; - - m_scene.AddNewSceneObject(new SceneObjectGroup(m_part1), false); + return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; } /// @@ -116,7 +111,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests TestHelper.InMethod(); //log4net.Config.XmlConfigurator.Configure(); - AddSceneObject1(); + SceneObjectPart part1 = CreateSceneObjectPart1(); + m_scene.AddNewSceneObject(new SceneObjectGroup(part1), false); SceneObjectPart part2; @@ -163,9 +159,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests bool gotObject2File = false; string expectedObject1FileName = string.Format( "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", - m_part1.Name, - Math.Round(m_part1.GroupPosition.X), Math.Round(m_part1.GroupPosition.Y), Math.Round(m_part1.GroupPosition.Z), - m_part1.UUID); + part1.Name, + Math.Round(part1.GroupPosition.X), Math.Round(part1.GroupPosition.Y), Math.Round(part1.GroupPosition.Z), + part1.UUID); string expectedObject2FileName = string.Format( "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", part2.Name, @@ -185,7 +181,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests { string fileName = filePath.Remove(0, ArchiveConstants.OBJECTS_PATH.Length); - if (fileName.StartsWith(m_part1.Name)) + if (fileName.StartsWith(part1.Name)) { Assert.That(fileName, Is.EqualTo(expectedObject1FileName)); gotObject1File = true; @@ -226,19 +222,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); - AddSceneObject1(); - string part1Name = "object1"; - PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder(); - Vector3 groupPosition = new Vector3(90, 80, 70); - Quaternion rotationOffset = new Quaternion(60, 70, 80, 90); - Vector3 offsetPosition = new Vector3(20, 25, 30); - - SceneObjectPart part1 - = new SceneObjectPart( - UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition); - part1.Name = part1Name; + SceneObjectPart part1 = CreateSceneObjectPart1(); SceneObjectGroup object1 = new SceneObjectGroup(part1); +// string part1Name = "object1"; +// PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder(); +// Vector3 groupPosition = new Vector3(90, 80, 70); +// Quaternion rotationOffset = new Quaternion(60, 70, 80, 90); +// Vector3 offsetPosition = new Vector3(20, 25, 30); +// +// SceneObjectPart part1 +// = new SceneObjectPart( +// UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition); +// part1.Name = part1Name; +// SceneObjectGroup object1 = new SceneObjectGroup(part1); + // Let's put some inventory items into our object string soundItemName = "sound-item1"; UUID soundItemUuid = UUID.Parse("00000000-0000-0000-0000-000000000002"); @@ -283,8 +281,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests string object1FileName = string.Format( "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", - part1Name, - Math.Round(groupPosition.X), Math.Round(groupPosition.Y), Math.Round(groupPosition.Z), + part1.Name, + Math.Round(part1.GroupPosition.X), Math.Round(part1.GroupPosition.Y), Math.Round(part1.GroupPosition.Z), part1.UUID); tar.WriteFile(ArchiveConstants.OBJECTS_PATH + object1FileName, SceneObjectSerializer.ToXml2Format(object1)); @@ -300,15 +298,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests Assert.That(m_lastErrorMessage, Is.Null); - SceneObjectPart object1PartLoaded = m_scene.GetSceneObjectPart(part1Name); + SceneObjectPart object1PartLoaded = m_scene.GetSceneObjectPart(part1.Name); Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded"); - Assert.That(object1PartLoaded.Name, Is.EqualTo(part1Name), "object1 names not identical"); - Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(groupPosition), "object1 group position not equal"); + Assert.That(object1PartLoaded.Name, Is.EqualTo(part1.Name), "object1 names not identical"); + Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal"); Assert.That( - object1PartLoaded.RotationOffset, Is.EqualTo(rotationOffset), "object1 rotation offset not equal"); + object1PartLoaded.RotationOffset, Is.EqualTo(part1.RotationOffset), "object1 rotation offset not equal"); Assert.That( - object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal"); + object1PartLoaded.OffsetPosition, Is.EqualTo(part1.OffsetPosition), "object1 offset position not equal"); TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItems(soundItemName)[0]; Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null"); From 055d991cc12f8c3720b41ffc314d95b8dbd7ce1a Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 29 Jan 2010 21:33:11 +0000 Subject: [PATCH 08/27] minor: swap which part uses the automatically set up scene in TestMergeOarV0_2() --- .../World/Archiver/Tests/ArchiverTests.cs | 38 +++++++------------ 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index a0958d1e33..930ea1ca8b 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -225,18 +225,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests SceneObjectPart part1 = CreateSceneObjectPart1(); SceneObjectGroup object1 = new SceneObjectGroup(part1); -// string part1Name = "object1"; -// PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder(); -// Vector3 groupPosition = new Vector3(90, 80, 70); -// Quaternion rotationOffset = new Quaternion(60, 70, 80, 90); -// Vector3 offsetPosition = new Vector3(20, 25, 30); -// -// SceneObjectPart part1 -// = new SceneObjectPart( -// UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition); -// part1.Name = part1Name; -// SceneObjectGroup object1 = new SceneObjectGroup(part1); - // Let's put some inventory items into our object string soundItemName = "sound-item1"; UUID soundItemUuid = UUID.Parse("00000000-0000-0000-0000-000000000002"); @@ -429,16 +417,23 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests // Create an oar file that we can use for the merge { + ArchiverModule archiverModule = new ArchiverModule(); + SerialiserModule serialiserModule = new SerialiserModule(); + TerrainModule terrainModule = new TerrainModule(); + + Scene scene = SceneSetupHelpers.SetupScene(); + SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); + SceneObjectPart part2 = new SceneObjectPart( UUID.Zero, part2Shape, part2GroupPosition, part2RotationOffset, part2OffsetPosition); part2.Name = part2Name; SceneObjectGroup object2 = new SceneObjectGroup(part2); - m_scene.AddNewSceneObject(object2, false); + scene.AddNewSceneObject(object2, false); // Write out this scene - m_scene.EventManager.OnOarFileSaved += SaveCompleted; + scene.EventManager.OnOarFileSaved += SaveCompleted; lock (this) { @@ -448,13 +443,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests } { - ArchiverModule archiverModule = new ArchiverModule(); - SerialiserModule serialiserModule = new SerialiserModule(); - TerrainModule terrainModule = new TerrainModule(); - - Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); - string part1Name = "objectExisting"; PrimitiveBaseShape part1Shape = PrimitiveBaseShape.CreateCylinder(); Vector3 part1GroupPosition = new Vector3(80, 70, 60); @@ -467,20 +455,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests part1.Name = part1Name; SceneObjectGroup object1 = new SceneObjectGroup(part1); - scene.AddNewSceneObject(object1, false); + m_scene.AddNewSceneObject(object1, false); // Merge in the archive we created earlier byte[] archive = archiveWriteStream.ToArray(); MemoryStream archiveReadStream = new MemoryStream(archive); - archiverModule.DearchiveRegion(archiveReadStream, true, Guid.Empty); + m_archiverModule.DearchiveRegion(archiveReadStream, true, Guid.Empty); - SceneObjectPart object1Existing = scene.GetSceneObjectPart(part1Name); + SceneObjectPart object1Existing = m_scene.GetSceneObjectPart(part1Name); Assert.That(object1Existing, Is.Not.Null, "object1 was not present after merge"); Assert.That(object1Existing.Name, Is.EqualTo(part1Name), "object1 names not identical after merge"); Assert.That(object1Existing.GroupPosition, Is.EqualTo(part1GroupPosition), "object1 group position not equal after merge"); - SceneObjectPart object2PartMerged = scene.GetSceneObjectPart(part2Name); + SceneObjectPart object2PartMerged = m_scene.GetSceneObjectPart(part2Name); Assert.That(object2PartMerged, Is.Not.Null, "object2 was not present after merge"); Assert.That(object2PartMerged.Name, Is.EqualTo(part2Name), "object2 names not identical after merge"); Assert.That(object2PartMerged.GroupPosition, Is.EqualTo(part2GroupPosition), "object2 group position not equal after merge"); From 0c3043a298070b95dd782a9193b9c245aa7894ee Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 29 Jan 2010 21:37:25 +0000 Subject: [PATCH 09/27] use common part1 createio nin TestMergeOarV0_2() --- .../World/Archiver/Tests/ArchiverTests.cs | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 930ea1ca8b..dea8a45eb4 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -443,19 +443,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests } { - string part1Name = "objectExisting"; - PrimitiveBaseShape part1Shape = PrimitiveBaseShape.CreateCylinder(); - Vector3 part1GroupPosition = new Vector3(80, 70, 60); - Quaternion part1RotationOffset = new Quaternion(50, 60, 70, 80); - Vector3 part1OffsetPosition = new Vector3(15, 20, 25); - - SceneObjectPart part1 - = new SceneObjectPart( - UUID.Zero, part1Shape, part1GroupPosition, part1RotationOffset, part1OffsetPosition); - part1.Name = part1Name; - SceneObjectGroup object1 = new SceneObjectGroup(part1); - - m_scene.AddNewSceneObject(object1, false); + SceneObjectPart part1 = CreateSceneObjectPart1(); + m_scene.AddNewSceneObject(new SceneObjectGroup(part1), false); // Merge in the archive we created earlier byte[] archive = archiveWriteStream.ToArray(); @@ -463,10 +452,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests m_archiverModule.DearchiveRegion(archiveReadStream, true, Guid.Empty); - SceneObjectPart object1Existing = m_scene.GetSceneObjectPart(part1Name); + SceneObjectPart object1Existing = m_scene.GetSceneObjectPart(part1.Name); Assert.That(object1Existing, Is.Not.Null, "object1 was not present after merge"); - Assert.That(object1Existing.Name, Is.EqualTo(part1Name), "object1 names not identical after merge"); - Assert.That(object1Existing.GroupPosition, Is.EqualTo(part1GroupPosition), "object1 group position not equal after merge"); + Assert.That(object1Existing.Name, Is.EqualTo(part1.Name), "object1 names not identical after merge"); + Assert.That(object1Existing.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal after merge"); SceneObjectPart object2PartMerged = m_scene.GetSceneObjectPart(part2Name); Assert.That(object2PartMerged, Is.Not.Null, "object2 was not present after merge"); From 68c7218fa1557a8e00c3f74829b91a5b43d94069 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 29 Jan 2010 21:42:27 +0000 Subject: [PATCH 10/27] make TestSaveOarV0_2() use a common part2 construction --- .../World/Archiver/Tests/ArchiverTests.cs | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index dea8a45eb4..ae4aece7b9 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -102,6 +102,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; } + protected SceneObjectPart CreateSceneObjectPart2() + { + string partName = "Action Man"; + UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000016"); + PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder(); + Vector3 groupPosition = new Vector3(90, 80, 70); + Quaternion rotationOffset = new Quaternion(60, 70, 80, 90); + Vector3 offsetPosition = new Vector3(20, 25, 30); + + return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName }; + } + /// /// Test saving a V0.2 OpenSim Region Archive. /// @@ -114,24 +126,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests SceneObjectPart part1 = CreateSceneObjectPart1(); m_scene.AddNewSceneObject(new SceneObjectGroup(part1), false); - SceneObjectPart part2; - - // Create and add prim 2 - { - string partName = "Action Man"; - UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000016"); - PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder(); - Vector3 groupPosition = new Vector3(90, 80, 70); - Quaternion rotationOffset = new Quaternion(60, 70, 80, 90); - Vector3 offsetPosition = new Vector3(20, 25, 30); - - part2 - = new SceneObjectPart( - ownerId, shape, groupPosition, rotationOffset, offsetPosition); - part2.Name = partName; - - m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false); - } + SceneObjectPart part2 = CreateSceneObjectPart2(); + m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false); MemoryStream archiveWriteStream = new MemoryStream(); m_scene.EventManager.OnOarFileSaved += SaveCompleted; From 0cf88b34c9690a5c3d1d9983b59abed3b1e67911 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 29 Jan 2010 21:45:07 +0000 Subject: [PATCH 11/27] use common sop2 setup for TestMergeOarV0_2() --- .../World/Archiver/Tests/ArchiverTests.cs | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index ae4aece7b9..c3e57f0574 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -405,11 +405,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests MemoryStream archiveWriteStream = new MemoryStream(); - string part2Name = "objectMerge"; - PrimitiveBaseShape part2Shape = PrimitiveBaseShape.CreateCylinder(); - Vector3 part2GroupPosition = new Vector3(90, 80, 70); - Quaternion part2RotationOffset = new Quaternion(60, 70, 80, 90); - Vector3 part2OffsetPosition = new Vector3(20, 25, 30); +// string part2Name = "objectMerge"; +// PrimitiveBaseShape part2Shape = PrimitiveBaseShape.CreateCylinder(); +// Vector3 part2GroupPosition = new Vector3(90, 80, 70); +// Quaternion part2RotationOffset = new Quaternion(60, 70, 80, 90); +// Vector3 part2OffsetPosition = new Vector3(20, 25, 30); + + SceneObjectPart part2 = CreateSceneObjectPart2(); // Create an oar file that we can use for the merge { @@ -418,15 +420,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests TerrainModule terrainModule = new TerrainModule(); Scene scene = SceneSetupHelpers.SetupScene(); - SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); - - SceneObjectPart part2 - = new SceneObjectPart( - UUID.Zero, part2Shape, part2GroupPosition, part2RotationOffset, part2OffsetPosition); - part2.Name = part2Name; - SceneObjectGroup object2 = new SceneObjectGroup(part2); + SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); - scene.AddNewSceneObject(object2, false); + m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false); // Write out this scene scene.EventManager.OnOarFileSaved += SaveCompleted; @@ -453,10 +449,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests Assert.That(object1Existing.Name, Is.EqualTo(part1.Name), "object1 names not identical after merge"); Assert.That(object1Existing.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal after merge"); - SceneObjectPart object2PartMerged = m_scene.GetSceneObjectPart(part2Name); + SceneObjectPart object2PartMerged = m_scene.GetSceneObjectPart(part2.Name); Assert.That(object2PartMerged, Is.Not.Null, "object2 was not present after merge"); - Assert.That(object2PartMerged.Name, Is.EqualTo(part2Name), "object2 names not identical after merge"); - Assert.That(object2PartMerged.GroupPosition, Is.EqualTo(part2GroupPosition), "object2 group position not equal after merge"); + Assert.That(object2PartMerged.Name, Is.EqualTo(part2.Name), "object2 names not identical after merge"); + Assert.That(object2PartMerged.GroupPosition, Is.EqualTo(part2.GroupPosition), "object2 group position not equal after merge"); } } } From 7b53067d6d503fd3d94a4a0ab3955071ef96669c Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 29 Jan 2010 21:52:13 +0000 Subject: [PATCH 12/27] Apply http://opensimulator.org/mantis/view.php?id=4548 Fix command params check on fcache expire Thanks coyled --- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index adcf6bd4f0..9216e0b410 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -762,7 +762,7 @@ namespace Flotsam.RegionModules.AssetCache case "expire": - if (cmdparams.Length >= 3) + if (cmdparams.Length < 3) { m_log.InfoFormat("[FLOTSAM ASSET CACHE] Invalid parameters for Expire, please specify a valid date & time", cmd); break; From 05a3e37b853fc870b83eb67b47bc70eb724f652e Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 29 Jan 2010 23:12:08 +0000 Subject: [PATCH 13/27] Apply http://opensimulator.org/mantis/view.php?id=3334 Send continuous touch() events if the left mouse button is held down while moving over an object This conforms with Linden Lab practice Thanks Revolution --- .../Region/Framework/Scenes/EventManager.cs | 11 +++++ .../Framework/Scenes/Scene.PacketHandlers.cs | 40 +++++++++++++++++++ OpenSim/Region/Framework/Scenes/Scene.cs | 1 + .../ScriptEngine/XEngine/EventManager.cs | 7 +++- 4 files changed, 58 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 399379ea2c..004ea1f87f 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -104,6 +104,7 @@ namespace OpenSim.Region.Framework.Scenes public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; public event ObjectGrabDelegate OnObjectGrab; + public event ObjectGrabDelegate OnObjectGrabbing; public event ObjectDeGrabDelegate OnObjectDeGrab; public event ScriptResetDelegate OnScriptReset; @@ -408,6 +409,7 @@ namespace OpenSim.Region.Framework.Scenes private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd; private OnShutdownDelegate handlerShutdown = null; //OnShutdown; private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab; + private ObjectGrabDelegate handlerObjectGrabbing = null; //OnObjectGrabbing; private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab; private ScriptResetDelegate handlerScriptReset = null; // OnScriptReset private NewRezScript handlerRezScript = null; //OnRezScript; @@ -620,6 +622,15 @@ namespace OpenSim.Region.Framework.Scenes } } + public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) + { + handlerObjectGrabbing = OnObjectGrabbing; + if (handlerObjectGrabbing != null) + { + handlerObjectGrabbing(localID, originalID, offsetPos, remoteClient, surfaceArgs); + } + } + public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) { handlerObjectDeGrab = OnObjectDeGrab; diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 47fbeb45db..ac04dc795b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -292,6 +292,46 @@ namespace OpenSim.Region.Framework.Scenes } } + public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List surfaceArgs) + { + List EntityList = GetEntities(); + + SurfaceTouchEventArgs surfaceArg = null; + if (surfaceArgs != null && surfaceArgs.Count > 0) + surfaceArg = surfaceArgs[0]; + + foreach (EntityBase ent in EntityList) + { + if (ent is SceneObjectGroup) + { + SceneObjectGroup obj = ent as SceneObjectGroup; + if (obj != null) + { + // Is this prim part of the group + if (obj.HasChildPrim(objectID)) + { + SceneObjectPart part = obj.GetChildPart(objectID); + + // If the touched prim handles touches, deliver it + // If not, deliver to root prim + if ((part.ScriptEvents & scriptEvents.touch) != 0) + EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg); + // Deliver to the root prim if the touched prim doesn't handle touches + // or if we're meant to pass on touches anyway. Don't send to root prim + // if prim touched is the root prim as we just did it + if (((part.ScriptEvents & scriptEvents.touch) == 0) || + (part.PassTouches && (part.LocalId != obj.RootPart.LocalId))) + { + EventManager.TriggerObjectGrabbing(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg); + } + + return; + } + } + } + } + } + public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List surfaceArgs) { List EntityList = GetEntities(); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4da05cf3c1..73b0b3e2e9 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2675,6 +2675,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; client.OnObjectPermissions += HandleObjectPermissionsUpdate; client.OnGrabObject += ProcessObjectGrab; + client.OnGrabUpdate += ProcessObjectGrabUpdate; client.OnDeGrabObject += ProcessObjectDeGrab; client.OnUndo += m_sceneGraph.HandleUndo; client.OnObjectDescription += m_sceneGraph.PrimDescription; diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs index 16309efca4..09b79d07f2 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs @@ -55,6 +55,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine m_log.Info("[XEngine] Hooking up to server events"); myScriptEngine.World.EventManager.OnAttach += attach; myScriptEngine.World.EventManager.OnObjectGrab += touch_start; + myScriptEngine.World.EventManager.OnObjectGrabbing += touch; myScriptEngine.World.EventManager.OnObjectDeGrab += touch_end; myScriptEngine.World.EventManager.OnScriptChangedEvent += changed; myScriptEngine.World.EventManager.OnScriptAtTargetEvent += at_target; @@ -148,7 +149,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine } public void touch(uint localID, uint originalID, Vector3 offsetPos, - IClientAPI remoteClient) + IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) { // Add to queue for all scripts in ObjectID object DetectParams[] det = new DetectParams[1]; @@ -172,6 +173,10 @@ namespace OpenSim.Region.ScriptEngine.XEngine SceneObjectPart originalPart = myScriptEngine.World.GetSceneObjectPart(originalID); det[0].LinkNum = originalPart.LinkNum; } + if (surfaceArgs != null) + { + det[0].SurfaceTouchArgs = surfaceArgs; + } myScriptEngine.PostObjectEvent(localID, new EventParams( "touch", new Object[] { new LSL_Types.LSLInteger(1) }, From 627df50646b9271ca7bcde6b05671db61b92913f Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 29 Jan 2010 23:38:44 +0000 Subject: [PATCH 14/27] Apply http://opensimulator.org/mantis/view.php?id=4504 Stop the REST console crashing when entering return on an empty line Thanks BlueWall --- OpenSim/ConsoleClient/ConsoleClient.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenSim/ConsoleClient/ConsoleClient.cs b/OpenSim/ConsoleClient/ConsoleClient.cs index d195d25296..8c616e0271 100644 --- a/OpenSim/ConsoleClient/ConsoleClient.cs +++ b/OpenSim/ConsoleClient/ConsoleClient.cs @@ -82,9 +82,11 @@ namespace OpenSim.ConsoleClient private static void SendCommand(string module, string[] cmd) { - string sendCmd = cmd[0]; + string sendCmd = ""; if (cmd.Length > 1) { + sendCmd = cmd[0]; + Array.Copy(cmd, 1, cmd, 0, cmd.Length-1); Array.Resize(ref cmd, cmd.Length-1); sendCmd += "\"" + String.Join("\" \"", cmd) + "\""; From 4c1365f1496b2c60c313b6d221362d3e09a8c1d4 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 30 Jan 2010 00:15:37 +0000 Subject: [PATCH 15/27] apply http://opensimulator.org/mantis/view.php?id=4486 fix compilation of mrm scripts using microthreaded parmeter Thanks ziah --- .../Region/OptionalModules/Scripting/Minimodule/MRMModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs index 4521f8ef6a..f2adcb74c2 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs @@ -116,7 +116,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule static string ConvertMRMKeywords(string script) { - script = script.Replace("microthreaded void ", "IEnumerable"); + script = script.Replace("microthreaded void", "IEnumerable"); script = script.Replace("relax;", "yield return null;"); return script; From 53a01dc42273b9252eb290187e87a47a898af86a Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 1 Feb 2010 20:06:43 +0000 Subject: [PATCH 16/27] Don't try to start attachment scripts or send updates if the attachment itself has been unsuccessful --- .../Framework/Scenes/Scene.Inventory.cs | 14 +++- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 77 +++++++++++++------ 2 files changed, 64 insertions(+), 27 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 11754eaca8..7df3e50792 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2376,9 +2376,19 @@ namespace OpenSim.Region.Framework.Scenes } } - public void AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent) + /// + /// Attach an object. + /// + /// + /// + /// + /// + /// + /// + /// true if the object was successfully attached, false otherwise + public bool AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent) { - m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent); + return m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent); } public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index f74fd5d93f..fc2798d7ab 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -478,46 +478,59 @@ namespace OpenSim.Region.Framework.Scenes if (part == null) return; - if (!m_parentScene.Permissions.CanTakeObject( - part.UUID, remoteClient.AgentId)) + if (!m_parentScene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId)) return; // Calls attach with a Zero position - AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false); - m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); - - // Save avatar attachment information - ScenePresence presence; - if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence)) + if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false)) { - m_log.Info("[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", AttachmentPoint: " + AttachmentPt); - m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); + m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); + + // Save avatar attachment information + ScenePresence presence; + if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence)) + { + m_log.Info( + "[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + + ", AttachmentPoint: " + AttachmentPt); + + m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance); + } } } - public SceneObjectGroup RezSingleAttachment( - IClientAPI remoteClient, UUID itemID, uint AttachmentPt) + /// + /// Rez an attachment + /// + /// + /// + /// + /// The scene object that was attached. Null if the scene object could not be found + public SceneObjectGroup RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt) { SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient, itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, false, false, remoteClient.AgentId, true); - if (objatt != null) { bool tainted = false; if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) tainted = true; - AttachObject(remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false); - objatt.ScheduleGroupForFullUpdate(); - if (tainted) - objatt.HasGroupChanged = true; - - // Fire after attach, so we don't get messy perms dialogs - // 3 == AttachedRez - objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3); + if (AttachObject( + remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false)) + { + objatt.ScheduleGroupForFullUpdate(); + if (tainted) + objatt.HasGroupChanged = true; + + // Fire after attach, so we don't get messy perms dialogs + // 3 == AttachedRez + objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3); + } } + return objatt; } @@ -554,7 +567,17 @@ namespace OpenSim.Region.Framework.Scenes } } - protected internal void AttachObject( + /// + /// Attach a scene object to an avatar. + /// + /// + /// + /// + /// + /// + /// + /// true if the attachment was successful, false otherwise + protected internal bool AttachObject( IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent) { SceneObjectGroup group = GetGroupByPrim(objectLocalID); @@ -583,10 +606,8 @@ namespace OpenSim.Region.Framework.Scenes // Stick it on left hand with Zero Offset from the attachment point. AttachmentPt = (uint)AttachmentPoint.LeftHand; attachPos = Vector3.Zero; - } - group.SetAttachmentPoint((byte)AttachmentPt); group.AbsolutePosition = attachPos; @@ -609,15 +630,21 @@ namespace OpenSim.Region.Framework.Scenes // it get cleaned up // group.RootPart.RemFlag(PrimFlags.TemporaryOnRez); - group.HasGroupChanged = false; + group.HasGroupChanged = false; } else { remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false); + return false; } } else + { m_log.DebugFormat("[SCENE GRAPH]: AttachObject found no such scene object {0}", objectLocalID); + return false; + } + + return true; } protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) From 4c1740f7d8e4e577167a84438cce83a7cc32f56d Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 1 Feb 2010 20:15:36 +0000 Subject: [PATCH 17/27] Actually make EventManager.OnAttach() fire when an object is attached. Previously, only detach was firing! --- OpenSim/Region/Framework/Scenes/EventManager.cs | 5 +++-- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 004ea1f87f..464ead8279 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -313,9 +313,10 @@ namespace OpenSim.Region.Framework.Scenes public event EmptyScriptCompileQueue OnEmptyScriptCompileQueue; /// - /// Called whenever an object is attached, or detached - /// from an in-world presence. + /// Called whenever an object is attached, or detached from an in-world presence. /// + /// If the object is being attached, then the avatarID will be present. If the object is being detached then + /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical). public delegate void Attach(uint localID, UUID itemID, UUID avatarID); public event Attach OnAttach; diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index fc2798d7ab..1ac061a1b2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -528,6 +528,9 @@ namespace OpenSim.Region.Framework.Scenes // Fire after attach, so we don't get messy perms dialogs // 3 == AttachedRez objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3); + + // Do this last so that event listeners have access to all the effects of the attachment + m_parentScene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); } } From 3863cd1d2395fb87489ed4e544fc33048c81761c Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 1 Feb 2010 21:35:05 +0000 Subject: [PATCH 18/27] Copy prim face color setting code from LSL_Api down into SOP so that non-LSL callers can use it --- .../Framework/Scenes/SceneObjectPart.cs | 192 ++++++++++++++++++ .../Shared/Api/Implementation/LSL_Api.cs | 1 - 2 files changed, 192 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a5296eb1fd..8b5c348d18 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -90,10 +90,27 @@ namespace OpenSim.Region.Framework.Scenes SCALE = 0x40 } + public enum PrimType : int + { + BOX = 0, + CYLINDER = 1, + PRISM = 2, + SPHERE = 3, + TORUS = 4, + TUBE = 5, + RING = 6, + SCULPT = 7 + } + #endregion Enumerations public class SceneObjectPart : IScriptHost { + /// + /// Denote all sides of the prim + /// + public const int ALL_SIDES = -1; + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // use only one serializer to give the runtime a chance to optimize it (it won't do that if you @@ -737,6 +754,9 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Text color. + /// public Color Color { get { return m_color; } @@ -2955,6 +2975,178 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Set the color of prim faces + /// + /// + /// + public void SetFaceColor(Vector3 color, int face) + { + Primitive.TextureEntry tex = Shape.Textures; + Color4 texcolor; + if (face >= 0 && face < GetNumberOfSides()) + { + texcolor = tex.CreateFace((uint)face).RGBA; + texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); + texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); + texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); + tex.FaceTextures[face].RGBA = texcolor; + UpdateTexture(tex); + return; + } + else if (face == ALL_SIDES) + { + for (uint i = 0; i < GetNumberOfSides(); i++) + { + if (tex.FaceTextures[i] != null) + { + texcolor = tex.FaceTextures[i].RGBA; + texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); + texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); + texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); + tex.FaceTextures[i].RGBA = texcolor; + } + texcolor = tex.DefaultTexture.RGBA; + texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); + texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); + texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); + tex.DefaultTexture.RGBA = texcolor; + } + UpdateTexture(tex); + return; + } + } + + /// + /// Get the number of sides that this part has. + /// + /// + public int GetNumberOfSides() + { + int ret = 0; + bool hasCut; + bool hasHollow; + bool hasDimple; + bool hasProfileCut; + + PrimType primType = getScriptPrimType(); + hasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); + + switch (primType) + { + case PrimType.BOX: + ret = 6; + if (hasCut) ret += 2; + if (hasHollow) ret += 1; + break; + case PrimType.CYLINDER: + ret = 3; + if (hasCut) ret += 2; + if (hasHollow) ret += 1; + break; + case PrimType.PRISM: + ret = 5; + if (hasCut) ret += 2; + if (hasHollow) ret += 1; + break; + case PrimType.SPHERE: + ret = 1; + if (hasCut) ret += 2; + if (hasDimple) ret += 2; + if (hasHollow) ret += 3; // Emulate lsl on secondlife (according to documentation it should have added only +1) + break; + case PrimType.TORUS: + ret = 1; + if (hasCut) ret += 2; + if (hasProfileCut) ret += 2; + if (hasHollow) ret += 1; + break; + case PrimType.TUBE: + ret = 4; + if (hasCut) ret += 2; + if (hasProfileCut) ret += 2; + if (hasHollow) ret += 1; + break; + case PrimType.RING: + ret = 3; + if (hasCut) ret += 2; + if (hasProfileCut) ret += 2; + if (hasHollow) ret += 1; + break; + case PrimType.SCULPT: + ret = 1; + break; + } + return ret; + } + + /// + /// Tell us what type this prim is + /// + /// + /// + public PrimType getScriptPrimType() + { + if (Shape.SculptEntry) + return PrimType.SCULPT; + if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) + { + if (Shape.PathCurve == (byte)Extrusion.Straight) + return PrimType.BOX; + else if (Shape.PathCurve == (byte)Extrusion.Curve1) + return PrimType.TUBE; + } + else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) + { + if (Shape.PathCurve == (byte)Extrusion.Straight) + return PrimType.CYLINDER; + // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits + else if (Shape.PathCurve == (byte)Extrusion.Curve1) + return PrimType.TORUS; + } + else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) + { + if (Shape.PathCurve == (byte)Extrusion.Curve1 || Shape.PathCurve == (byte)Extrusion.Curve2) + return PrimType.SPHERE; + } + else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle) + { + if (Shape.PathCurve == (byte)Extrusion.Straight) + return PrimType.PRISM; + else if (Shape.PathCurve == (byte)Extrusion.Curve1) + return PrimType.RING; + } + + return PrimType.BOX; + } + + /// + /// Tell us if this object has cut, hollow, dimple, and other factors affecting the number of faces + /// + /// + /// + /// + /// + /// + /// + protected static void hasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, + out bool hasDimple, out bool hasProfileCut) + { + if (primType == PrimType.BOX + || + primType == PrimType.CYLINDER + || + primType == PrimType.PRISM) + + hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); + else + hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0); + + hasHollow = shape.ProfileHollow > 0; + hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms + hasProfileCut = hasDimple; // is it the same thing? + } + public void SetGroup(UUID groupID, IClientAPI client) { _groupID = groupID; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c9998c0d86..2f00a1adf1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4394,7 +4394,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return ret; } - /* The new / changed functions were tested with the following LSL script: default From ecc068fbe0b8a95563281c3aaf8e7392e5ef49e9 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 1 Feb 2010 22:08:00 +0000 Subject: [PATCH 19/27] remove now duplicated shape code from LSL_Api.cs --- .../Framework/Scenes/SceneObjectPart.cs | 8 +- .../Shared/Api/Implementation/LSL_Api.cs | 235 ++++-------------- 2 files changed, 49 insertions(+), 194 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 8b5c348d18..33c3fcfa81 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3029,8 +3029,8 @@ namespace OpenSim.Region.Framework.Scenes bool hasDimple; bool hasProfileCut; - PrimType primType = getScriptPrimType(); - hasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); + PrimType primType = GetScriptPrimType(); + HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); switch (primType) { @@ -3085,7 +3085,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public PrimType getScriptPrimType() + public PrimType GetScriptPrimType() { if (Shape.SculptEntry) return PrimType.SCULPT; @@ -3129,7 +3129,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - protected static void hasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, + protected static void HasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, out bool hasDimple, out bool hasProfileCut) { if (primType == PrimType.BOX diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2f00a1adf1..1437bb75cf 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1330,44 +1330,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - SetColor(m_host, color, face); - } - - protected void SetColor(SceneObjectPart part, LSL_Vector color, int face) - { - Primitive.TextureEntry tex = part.Shape.Textures; - Color4 texcolor; - if (face >= 0 && face < GetNumberOfSides(part)) - { - texcolor = tex.CreateFace((uint)face).RGBA; - texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); - texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f); - texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); - tex.FaceTextures[face].RGBA = texcolor; - part.UpdateTexture(tex); - return; - } - else if (face == ScriptBaseClass.ALL_SIDES) - { - for (uint i = 0; i < GetNumberOfSides(part); i++) - { - if (tex.FaceTextures[i] != null) - { - texcolor = tex.FaceTextures[i].RGBA; - texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); - texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f); - texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); - tex.FaceTextures[i].RGBA = texcolor; - } - texcolor = tex.DefaultTexture.RGBA; - texcolor.R = Util.Clip((float)color.x, 0.0f, 1.0f); - texcolor.G = Util.Clip((float)color.y, 0.0f, 1.0f); - texcolor.B = Util.Clip((float)color.z, 0.0f, 1.0f); - tex.DefaultTexture.RGBA = texcolor; - } - part.UpdateTexture(tex); - return; - } + m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); } public void SetTexGen(SceneObjectPart part, int face,int style) @@ -1378,7 +1341,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (style == (int)ScriptBaseClass.PRIM_TEXGEN_PLANAR) textype = MappingType.Planar; - if (face >= 0 && face < GetNumberOfSides(part)) + if (face >= 0 && face < part.GetNumberOfSides()) { tex.CreateFace((uint) face); tex.FaceTextures[face].TexMapType = textype; @@ -1387,7 +1350,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else if (face == ScriptBaseClass.ALL_SIDES) { - for (uint i = 0; i < GetNumberOfSides(part); i++) + for (uint i = 0; i < part.GetNumberOfSides(); i++) { if (tex.FaceTextures[i] != null) { @@ -1403,7 +1366,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void SetGlow(SceneObjectPart part, int face, float glow) { Primitive.TextureEntry tex = part.Shape.Textures; - if (face >= 0 && face < GetNumberOfSides(part)) + if (face >= 0 && face < part.GetNumberOfSides()) { tex.CreateFace((uint) face); tex.FaceTextures[face].Glow = glow; @@ -1412,7 +1375,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else if (face == ScriptBaseClass.ALL_SIDES) { - for (uint i = 0; i < GetNumberOfSides(part); i++) + for (uint i = 0; i < part.GetNumberOfSides(); i++) { if (tex.FaceTextures[i] != null) { @@ -1450,7 +1413,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } Primitive.TextureEntry tex = part.Shape.Textures; - if (face >= 0 && face < GetNumberOfSides(part)) + if (face >= 0 && face < part.GetNumberOfSides()) { tex.CreateFace((uint) face); tex.FaceTextures[face].Shiny = sval; @@ -1460,7 +1423,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else if (face == ScriptBaseClass.ALL_SIDES) { - for (uint i = 0; i < GetNumberOfSides(part); i++) + for (uint i = 0; i < part.GetNumberOfSides(); i++) { if (tex.FaceTextures[i] != null) { @@ -1478,7 +1441,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void SetFullBright(SceneObjectPart part, int face, bool bright) { Primitive.TextureEntry tex = part.Shape.Textures; - if (face >= 0 && face < GetNumberOfSides(part)) + if (face >= 0 && face < part.GetNumberOfSides()) { tex.CreateFace((uint) face); tex.FaceTextures[face].Fullbright = bright; @@ -1487,7 +1450,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else if (face == ScriptBaseClass.ALL_SIDES) { - for (uint i = 0; i < GetNumberOfSides(part); i++) + for (uint i = 0; i < part.GetNumberOfSides(); i++) { if (tex.FaceTextures[i] != null) { @@ -1514,11 +1477,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { int i; double sum = 0.0; - for (i = 0 ; i < GetNumberOfSides(part) ; i++) + for (i = 0 ; i < part.GetNumberOfSides(); i++) sum += (double)tex.GetFace((uint)i).RGBA.A; return sum; } - if (face >= 0 && face < GetNumberOfSides(part)) + if (face >= 0 && face < part.GetNumberOfSides()) { return (double)tex.GetFace((uint)face).RGBA.A; } @@ -1546,7 +1509,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { Primitive.TextureEntry tex = part.Shape.Textures; Color4 texcolor; - if (face >= 0 && face < GetNumberOfSides(part)) + if (face >= 0 && face < part.GetNumberOfSides()) { texcolor = tex.CreateFace((uint)face).RGBA; texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); @@ -1556,7 +1519,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else if (face == ScriptBaseClass.ALL_SIDES) { - for (int i = 0; i < GetNumberOfSides(part); i++) + for (int i = 0; i < part.GetNumberOfSides(); i++) { if (tex.FaceTextures[i] != null) { @@ -1661,7 +1624,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { int i; - for (i = 0 ; i < GetNumberOfSides(part) ; i++) + for (i = 0 ; i < part.GetNumberOfSides(); i++) { texcolor = tex.GetFace((uint)i).RGBA; rgb.x += texcolor.R; @@ -1669,13 +1632,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api rgb.z += texcolor.B; } - rgb.x /= (float)GetNumberOfSides(part); - rgb.y /= (float)GetNumberOfSides(part); - rgb.z /= (float)GetNumberOfSides(part); + rgb.x /= (float)part.GetNumberOfSides(); + rgb.y /= (float)part.GetNumberOfSides(); + rgb.z /= (float)part.GetNumberOfSides(); return rgb; } - if (face >= 0 && face < GetNumberOfSides(part)) + if (face >= 0 && face < part.GetNumberOfSides()) { texcolor = tex.GetFace((uint)face).RGBA; rgb.x = texcolor.R; @@ -1722,7 +1685,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Primitive.TextureEntry tex = part.Shape.Textures; - if (face >= 0 && face < GetNumberOfSides(part)) + if (face >= 0 && face < part.GetNumberOfSides()) { Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); texface.TextureID = textureID; @@ -1732,7 +1695,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else if (face == ScriptBaseClass.ALL_SIDES) { - for (uint i = 0; i < GetNumberOfSides(part); i++) + for (uint i = 0; i < part.GetNumberOfSides(); i++) { if (tex.FaceTextures[i] != null) { @@ -1756,7 +1719,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected void ScaleTexture(SceneObjectPart part, double u, double v, int face) { Primitive.TextureEntry tex = part.Shape.Textures; - if (face >= 0 && face < GetNumberOfSides(part)) + if (face >= 0 && face < part.GetNumberOfSides()) { Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); texface.RepeatU = (float)u; @@ -1767,7 +1730,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } if (face == ScriptBaseClass.ALL_SIDES) { - for (int i = 0; i < GetNumberOfSides(part); i++) + for (int i = 0; i < part.GetNumberOfSides(); i++) { if (tex.FaceTextures[i] != null) { @@ -1792,7 +1755,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected void OffsetTexture(SceneObjectPart part, double u, double v, int face) { Primitive.TextureEntry tex = part.Shape.Textures; - if (face >= 0 && face < GetNumberOfSides(part)) + if (face >= 0 && face < part.GetNumberOfSides()) { Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); texface.OffsetU = (float)u; @@ -1803,7 +1766,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } if (face == ScriptBaseClass.ALL_SIDES) { - for (int i = 0; i < GetNumberOfSides(part); i++) + for (int i = 0; i < part.GetNumberOfSides(); i++) { if (tex.FaceTextures[i] != null) { @@ -1828,7 +1791,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected void RotateTexture(SceneObjectPart part, double rotation, int face) { Primitive.TextureEntry tex = part.Shape.Textures; - if (face >= 0 && face < GetNumberOfSides(part)) + if (face >= 0 && face < part.GetNumberOfSides()) { Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); texface.Rotation = (float)rotation; @@ -1838,7 +1801,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } if (face == ScriptBaseClass.ALL_SIDES) { - for (int i = 0; i < GetNumberOfSides(part); i++) + for (int i = 0; i < part.GetNumberOfSides(); i++) { if (tex.FaceTextures[i] != null) { @@ -1864,7 +1827,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { face = 0; } - if (face >= 0 && face < GetNumberOfSides(part)) + if (face >= 0 && face < part.GetNumberOfSides()) { Primitive.TextureEntryFace texface; texface = tex.GetFace((uint)face); @@ -3414,7 +3377,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) - SetColor(part, color, face); + part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); } public void llCreateLink(string target, int parent) @@ -4271,127 +4234,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return result; } - // this function to understand which shape it is (taken from meshmerizer) - // quite useful can be used by meshmerizer to have a centralized point of understanding the shape - // except that it refers to scripting constants - public int getScriptPrimType(PrimitiveBaseShape primShape) - { - if (primShape.SculptEntry) - return ScriptBaseClass.PRIM_TYPE_SCULPT; - if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Square) - { - if (primShape.PathCurve == (byte)Extrusion.Straight) - return ScriptBaseClass.PRIM_TYPE_BOX; - else if (primShape.PathCurve == (byte)Extrusion.Curve1) - return ScriptBaseClass.PRIM_TYPE_TUBE; - } - else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle) - { - if (primShape.PathCurve == (byte)Extrusion.Straight) - return ScriptBaseClass.PRIM_TYPE_CYLINDER; - // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits - else if (primShape.PathCurve == (byte)Extrusion.Curve1) - return ScriptBaseClass.PRIM_TYPE_TORUS; - } - else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle) - { - if (primShape.PathCurve == (byte)Extrusion.Curve1 || primShape.PathCurve == (byte)Extrusion.Curve2) - return ScriptBaseClass.PRIM_TYPE_SPHERE; - } - else if ((primShape.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle) - { - if (primShape.PathCurve == (byte)Extrusion.Straight) - return ScriptBaseClass.PRIM_TYPE_PRISM; - else if (primShape.PathCurve == (byte)Extrusion.Curve1) - return ScriptBaseClass.PRIM_TYPE_RING; - } - return ScriptBaseClass.PRIM_TYPE_BOX; - } - - // Helper functions to understand if object has cut, hollow, dimple, and other affecting number of faces - protected void hasCutHollowDimpleProfileCut(int primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow, - out bool hasDimple, out bool hasProfileCut) - { - if (primType == ScriptBaseClass.PRIM_TYPE_BOX - || - primType == ScriptBaseClass.PRIM_TYPE_CYLINDER - || - primType == ScriptBaseClass.PRIM_TYPE_PRISM) - - hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); - else - hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0); - - hasHollow = shape.ProfileHollow > 0; - hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms - hasProfileCut = hasDimple; // is it the same thing? - - } - public LSL_Integer llGetNumberOfSides() { m_host.AddScriptLPS(1); - return GetNumberOfSides(m_host); - } - - protected int GetNumberOfSides(SceneObjectPart part) - { - int ret = 0; - bool hasCut; - bool hasHollow; - bool hasDimple; - bool hasProfileCut; - - int primType = getScriptPrimType(part.Shape); - hasCutHollowDimpleProfileCut(primType, part.Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); - - switch (primType) - { - case ScriptBaseClass.PRIM_TYPE_BOX: - ret = 6; - if (hasCut) ret += 2; - if (hasHollow) ret += 1; - break; - case ScriptBaseClass.PRIM_TYPE_CYLINDER: - ret = 3; - if (hasCut) ret += 2; - if (hasHollow) ret += 1; - break; - case ScriptBaseClass.PRIM_TYPE_PRISM: - ret = 5; - if (hasCut) ret += 2; - if (hasHollow) ret += 1; - break; - case ScriptBaseClass.PRIM_TYPE_SPHERE: - ret = 1; - if (hasCut) ret += 2; - if (hasDimple) ret += 2; - if (hasHollow) ret += 3; // Emulate lsl on secondlife (according to documentation it should have added only +1) - break; - case ScriptBaseClass.PRIM_TYPE_TORUS: - ret = 1; - if (hasCut) ret += 2; - if (hasProfileCut) ret += 2; - if (hasHollow) ret += 1; - break; - case ScriptBaseClass.PRIM_TYPE_TUBE: - ret = 4; - if (hasCut) ret += 2; - if (hasProfileCut) ret += 2; - if (hasHollow) ret += 1; - break; - case ScriptBaseClass.PRIM_TYPE_RING: - ret = 3; - if (hasCut) ret += 2; - if (hasProfileCut) ret += 2; - if (hasHollow) ret += 1; - break; - case ScriptBaseClass.PRIM_TYPE_SCULPT: - ret = 1; - break; - } - return ret; + return m_host.GetNumberOfSides(); } /* The new / changed functions were tested with the following LSL script: @@ -4588,7 +4435,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { face = 0; } - if (face >= 0 && face < GetNumberOfSides(part)) + if (face >= 0 && face < part.GetNumberOfSides()) { offset.x = tex.GetFace((uint)face).OffsetU; offset.y = tex.GetFace((uint)face).OffsetV; @@ -4629,7 +4476,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { face = 0; } - if (face >= 0 && face < GetNumberOfSides(part)) + if (face >= 0 && face < part.GetNumberOfSides()) { return tex.GetFace((uint)face).Rotation; } @@ -7019,10 +6866,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_Vector color=rules.GetVector3Item(idx++); double alpha=(double)rules.GetLSLFloatItem(idx++); - SetColor(part, color, face); + part.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); SetAlpha(part, alpha, face); break; + case (int)ScriptBaseClass.PRIM_FLEXIBLE: if (remain < 7) return; @@ -7038,6 +6886,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SetFlexi(part, flexi, softness, gravity, friction, wind, tension, force); break; + case (int)ScriptBaseClass.PRIM_POINT_LIGHT: if (remain < 5) return; @@ -7050,6 +6899,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SetPointLight(part, light, lightcolor, intensity, radius, falloff); break; + case (int)ScriptBaseClass.PRIM_GLOW: if (remain < 2) return; @@ -7059,6 +6909,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SetGlow(part, face, glow); break; + case (int)ScriptBaseClass.PRIM_BUMP_SHINY: if (remain < 3) return; @@ -7069,6 +6920,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SetShiny(part, face, shiny, bump); break; + case (int)ScriptBaseClass.PRIM_FULLBRIGHT: if (remain < 2) return; @@ -7076,6 +6928,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api bool st = rules.GetLSLIntegerItem(idx++); SetFullBright(part, face , st); break; + case (int)ScriptBaseClass.PRIM_MATERIAL: if (remain < 1) return; @@ -7085,6 +6938,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api part.Material = Convert.ToByte(mat); break; + case (int)ScriptBaseClass.PRIM_PHANTOM: if (remain < 1) return; @@ -7099,6 +6953,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api part.ScriptSetPhantomStatus(phantom); break; + case (int)ScriptBaseClass.PRIM_PHYSICS: if (remain < 1) return; @@ -7112,6 +6967,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api part.ScriptSetPhysicsStatus(physics); break; + case (int)ScriptBaseClass.PRIM_TEMP_ON_REZ: if (remain < 1) return; @@ -7379,7 +7235,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules) { - LSL_List res = new LSL_List(); int idx=0; while (idx < rules.Length) @@ -7441,7 +7296,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TYPE: // implementing box PrimitiveBaseShape Shape = part.Shape; - int primType = getScriptPrimType(part.Shape); + int primType = (int)part.GetScriptPrimType(); res.Add(new LSL_Integer(primType)); double topshearx = (double)(sbyte)Shape.PathShearX / 100.0; // Fix negative values for PathShearX double topsheary = (double)(sbyte)Shape.PathShearY / 100.0; // and PathShearY. @@ -7521,7 +7376,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Primitive.TextureEntry tex = part.Shape.Textures; if (face == ScriptBaseClass.ALL_SIDES) { - for (face = 0 ; face < GetNumberOfSides(part) ; face++) + for (face = 0 ; face < part.GetNumberOfSides() ; face++) { Primitive.TextureEntryFace texface = tex.GetFace((uint)face); @@ -7537,7 +7392,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - if (face >= 0 && face < GetNumberOfSides(part)) + if (face >= 0 && face < part.GetNumberOfSides()) { Primitive.TextureEntryFace texface = tex.GetFace((uint)face); @@ -7563,7 +7418,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Color4 texcolor; if (face == ScriptBaseClass.ALL_SIDES) { - for (face = 0 ; face < GetNumberOfSides(part) ; face++) + for (face = 0 ; face < part.GetNumberOfSides() ; face++) { texcolor = tex.GetFace((uint)face).RGBA; res.Add(new LSL_Vector(texcolor.R, From 5432925a3b153737adf7f59483e05202068ce2af Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 1 Feb 2010 22:29:21 +0000 Subject: [PATCH 20/27] move hollow sphere faces bug back up to LSL_Api.cs --- .../Framework/Scenes/SceneObjectPart.cs | 2 +- .../Shared/Api/Implementation/LSL_Api.cs | 87 +++++++++++-------- 2 files changed, 52 insertions(+), 37 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 33c3fcfa81..4f9beb7221 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3053,7 +3053,7 @@ namespace OpenSim.Region.Framework.Scenes ret = 1; if (hasCut) ret += 2; if (hasDimple) ret += 2; - if (hasHollow) ret += 3; // Emulate lsl on secondlife (according to documentation it should have added only +1) + if (hasHollow) ret += 1; break; case PrimType.TORUS: ret = 1; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1437bb75cf..3dc7613b62 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -53,8 +53,8 @@ using OpenSim.Region.ScriptEngine.Interfaces; using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; using OpenSim.Services.Interfaces; +using PrimType = OpenSim.Region.Framework.Scenes.PrimType; using GridRegion = OpenSim.Services.Interfaces.GridRegion; - using AssetLandmark = OpenSim.Framework.AssetLandmark; using LSL_Float = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLFloat; @@ -1330,6 +1330,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); + if (face == ScriptBaseClass.ALL_SIDES) + face = SceneObjectPart.ALL_SIDES; + m_host.SetFaceColor(new Vector3((float)color.x, (float)color.y, (float)color.z), face); } @@ -1341,7 +1344,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (style == (int)ScriptBaseClass.PRIM_TEXGEN_PLANAR) textype = MappingType.Planar; - if (face >= 0 && face < part.GetNumberOfSides()) + if (face >= 0 && face < GetNumberOfSides(part)) { tex.CreateFace((uint) face); tex.FaceTextures[face].TexMapType = textype; @@ -1350,7 +1353,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else if (face == ScriptBaseClass.ALL_SIDES) { - for (uint i = 0; i < part.GetNumberOfSides(); i++) + for (uint i = 0; i < GetNumberOfSides(part); i++) { if (tex.FaceTextures[i] != null) { @@ -1366,7 +1369,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void SetGlow(SceneObjectPart part, int face, float glow) { Primitive.TextureEntry tex = part.Shape.Textures; - if (face >= 0 && face < part.GetNumberOfSides()) + if (face >= 0 && face < GetNumberOfSides(part)) { tex.CreateFace((uint) face); tex.FaceTextures[face].Glow = glow; @@ -1375,7 +1378,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else if (face == ScriptBaseClass.ALL_SIDES) { - for (uint i = 0; i < part.GetNumberOfSides(); i++) + for (uint i = 0; i < GetNumberOfSides(part); i++) { if (tex.FaceTextures[i] != null) { @@ -1413,7 +1416,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } Primitive.TextureEntry tex = part.Shape.Textures; - if (face >= 0 && face < part.GetNumberOfSides()) + if (face >= 0 && face < GetNumberOfSides(part)) { tex.CreateFace((uint) face); tex.FaceTextures[face].Shiny = sval; @@ -1423,7 +1426,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else if (face == ScriptBaseClass.ALL_SIDES) { - for (uint i = 0; i < part.GetNumberOfSides(); i++) + for (uint i = 0; i < GetNumberOfSides(part); i++) { if (tex.FaceTextures[i] != null) { @@ -1441,7 +1444,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void SetFullBright(SceneObjectPart part, int face, bool bright) { Primitive.TextureEntry tex = part.Shape.Textures; - if (face >= 0 && face < part.GetNumberOfSides()) + if (face >= 0 && face < GetNumberOfSides(part)) { tex.CreateFace((uint) face); tex.FaceTextures[face].Fullbright = bright; @@ -1450,7 +1453,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else if (face == ScriptBaseClass.ALL_SIDES) { - for (uint i = 0; i < part.GetNumberOfSides(); i++) + for (uint i = 0; i < GetNumberOfSides(part); i++) { if (tex.FaceTextures[i] != null) { @@ -1477,11 +1480,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { int i; double sum = 0.0; - for (i = 0 ; i < part.GetNumberOfSides(); i++) + for (i = 0 ; i < GetNumberOfSides(part); i++) sum += (double)tex.GetFace((uint)i).RGBA.A; return sum; } - if (face >= 0 && face < part.GetNumberOfSides()) + if (face >= 0 && face < GetNumberOfSides(part)) { return (double)tex.GetFace((uint)face).RGBA.A; } @@ -1509,7 +1512,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { Primitive.TextureEntry tex = part.Shape.Textures; Color4 texcolor; - if (face >= 0 && face < part.GetNumberOfSides()) + if (face >= 0 && face < GetNumberOfSides(part)) { texcolor = tex.CreateFace((uint)face).RGBA; texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); @@ -1519,7 +1522,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else if (face == ScriptBaseClass.ALL_SIDES) { - for (int i = 0; i < part.GetNumberOfSides(); i++) + for (int i = 0; i < GetNumberOfSides(part); i++) { if (tex.FaceTextures[i] != null) { @@ -1624,7 +1627,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { int i; - for (i = 0 ; i < part.GetNumberOfSides(); i++) + for (i = 0 ; i < GetNumberOfSides(part); i++) { texcolor = tex.GetFace((uint)i).RGBA; rgb.x += texcolor.R; @@ -1632,13 +1635,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api rgb.z += texcolor.B; } - rgb.x /= (float)part.GetNumberOfSides(); - rgb.y /= (float)part.GetNumberOfSides(); - rgb.z /= (float)part.GetNumberOfSides(); + rgb.x /= (float)GetNumberOfSides(part); + rgb.y /= (float)GetNumberOfSides(part); + rgb.z /= (float)GetNumberOfSides(part); return rgb; } - if (face >= 0 && face < part.GetNumberOfSides()) + if (face >= 0 && face < GetNumberOfSides(part)) { texcolor = tex.GetFace((uint)face).RGBA; rgb.x = texcolor.R; @@ -1685,7 +1688,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Primitive.TextureEntry tex = part.Shape.Textures; - if (face >= 0 && face < part.GetNumberOfSides()) + if (face >= 0 && face < GetNumberOfSides(part)) { Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); texface.TextureID = textureID; @@ -1695,7 +1698,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else if (face == ScriptBaseClass.ALL_SIDES) { - for (uint i = 0; i < part.GetNumberOfSides(); i++) + for (uint i = 0; i < GetNumberOfSides(part); i++) { if (tex.FaceTextures[i] != null) { @@ -1719,7 +1722,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected void ScaleTexture(SceneObjectPart part, double u, double v, int face) { Primitive.TextureEntry tex = part.Shape.Textures; - if (face >= 0 && face < part.GetNumberOfSides()) + if (face >= 0 && face < GetNumberOfSides(part)) { Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); texface.RepeatU = (float)u; @@ -1730,7 +1733,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } if (face == ScriptBaseClass.ALL_SIDES) { - for (int i = 0; i < part.GetNumberOfSides(); i++) + for (int i = 0; i < GetNumberOfSides(part); i++) { if (tex.FaceTextures[i] != null) { @@ -1755,7 +1758,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected void OffsetTexture(SceneObjectPart part, double u, double v, int face) { Primitive.TextureEntry tex = part.Shape.Textures; - if (face >= 0 && face < part.GetNumberOfSides()) + if (face >= 0 && face < GetNumberOfSides(part)) { Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); texface.OffsetU = (float)u; @@ -1766,7 +1769,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } if (face == ScriptBaseClass.ALL_SIDES) { - for (int i = 0; i < part.GetNumberOfSides(); i++) + for (int i = 0; i < GetNumberOfSides(part); i++) { if (tex.FaceTextures[i] != null) { @@ -1791,7 +1794,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected void RotateTexture(SceneObjectPart part, double rotation, int face) { Primitive.TextureEntry tex = part.Shape.Textures; - if (face >= 0 && face < part.GetNumberOfSides()) + if (face >= 0 && face < GetNumberOfSides(part)) { Primitive.TextureEntryFace texface = tex.CreateFace((uint)face); texface.Rotation = (float)rotation; @@ -1801,7 +1804,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } if (face == ScriptBaseClass.ALL_SIDES) { - for (int i = 0; i < part.GetNumberOfSides(); i++) + for (int i = 0; i < GetNumberOfSides(part); i++) { if (tex.FaceTextures[i] != null) { @@ -1827,7 +1830,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { face = 0; } - if (face >= 0 && face < part.GetNumberOfSides()) + if (face >= 0 && face < GetNumberOfSides(part)) { Primitive.TextureEntryFace texface; texface = tex.GetFace((uint)face); @@ -4225,7 +4228,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { if (item.Type == 10 && item.ItemID == m_itemID) { - result = item.Name!=null?item.Name:String.Empty; + result = item.Name != null ? item.Name : String.Empty; break; } } @@ -4238,9 +4241,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); - return m_host.GetNumberOfSides(); + return GetNumberOfSides(m_host); } + protected int GetNumberOfSides(SceneObjectPart part) + { + int sides = part.GetNumberOfSides(); + + if (part.GetScriptPrimType() == PrimType.SPHERE && part.Shape.ProfileHollow > 0) + { + // Make up for a bug where LSL shows 4 sides rather than 2 + sides += 2; + } + + return sides; + } + + /* The new / changed functions were tested with the following LSL script: default @@ -4264,8 +4281,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } */ - - // Xantor 29/apr/2008 // Returns rotation described by rotating angle radians about axis. // q = cos(a/2) + i (x * sin(a/2)) + j (y * sin(a/2)) + k (z * sin(a/2)) @@ -4435,7 +4450,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { face = 0; } - if (face >= 0 && face < part.GetNumberOfSides()) + if (face >= 0 && face < GetNumberOfSides(part)) { offset.x = tex.GetFace((uint)face).OffsetU; offset.y = tex.GetFace((uint)face).OffsetV; @@ -4476,7 +4491,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { face = 0; } - if (face >= 0 && face < part.GetNumberOfSides()) + if (face >= 0 && face < GetNumberOfSides(part)) { return tex.GetFace((uint)face).Rotation; } @@ -7376,7 +7391,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Primitive.TextureEntry tex = part.Shape.Textures; if (face == ScriptBaseClass.ALL_SIDES) { - for (face = 0 ; face < part.GetNumberOfSides() ; face++) + for (face = 0 ; face < GetNumberOfSides(part); face++) { Primitive.TextureEntryFace texface = tex.GetFace((uint)face); @@ -7392,7 +7407,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - if (face >= 0 && face < part.GetNumberOfSides()) + if (face >= 0 && face < GetNumberOfSides(part)) { Primitive.TextureEntryFace texface = tex.GetFace((uint)face); @@ -7418,7 +7433,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api Color4 texcolor; if (face == ScriptBaseClass.ALL_SIDES) { - for (face = 0 ; face < part.GetNumberOfSides() ; face++) + for (face = 0 ; face < GetNumberOfSides(part); face++) { texcolor = tex.GetFace((uint)face).RGBA; res.Add(new LSL_Vector(texcolor.R, From 08721be3740624fb10a205bcf1ddcfd58bff7f87 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Mon, 1 Feb 2010 22:33:15 +0000 Subject: [PATCH 21/27] minor: rename GetScriptPrimType() to GetPrimType() --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++-- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4f9beb7221..ef9005fc01 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3029,7 +3029,7 @@ namespace OpenSim.Region.Framework.Scenes bool hasDimple; bool hasProfileCut; - PrimType primType = GetScriptPrimType(); + PrimType primType = GetPrimType(); HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut); switch (primType) @@ -3085,7 +3085,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public PrimType GetScriptPrimType() + public PrimType GetPrimType() { if (Shape.SculptEntry) return PrimType.SCULPT; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 3dc7613b62..a1db77ee73 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4248,7 +4248,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { int sides = part.GetNumberOfSides(); - if (part.GetScriptPrimType() == PrimType.SPHERE && part.Shape.ProfileHollow > 0) + if (part.GetPrimType() == PrimType.SPHERE && part.Shape.ProfileHollow > 0) { // Make up for a bug where LSL shows 4 sides rather than 2 sides += 2; @@ -7311,7 +7311,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TYPE: // implementing box PrimitiveBaseShape Shape = part.Shape; - int primType = (int)part.GetScriptPrimType(); + int primType = (int)part.GetPrimType(); res.Add(new LSL_Integer(primType)); double topshearx = (double)(sbyte)Shape.PathShearX / 100.0; // Fix negative values for PathShearX double topsheary = (double)(sbyte)Shape.PathShearY / 100.0; // and PathShearY. From 6478617c932e87bf091266dba2db4d73fcdd046f Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 2 Feb 2010 03:49:00 +0000 Subject: [PATCH 22/27] Revert "improve locking of m_items in SceneObjectPartInventory" This reverts commit 968b9e160d70568fbdea5b190d1386e9431316e3. --- .../Scenes/SceneObjectPartInventory.cs | 218 +++++++----------- 1 file changed, 85 insertions(+), 133 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 87c1a95197..b37e1a29cf 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -44,8 +44,6 @@ namespace OpenSim.Region.Framework.Scenes { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); - private string m_inventoryFileName = String.Empty; private int m_inventoryFileNameSerial = 0; @@ -272,12 +270,8 @@ namespace OpenSim.Region.Framework.Scenes if (stateSource == 1 && // Prim crossing m_part.ParentGroup.Scene.m_trustBinaries) { - lock (m_items) - { - m_items[item.ItemID].PermsMask = 0; - m_items[item.ItemID].PermsGranter = UUID.Zero; - } - + m_items[item.ItemID].PermsMask = 0; + m_items[item.ItemID].PermsGranter = UUID.Zero; m_part.ParentGroup.Scene.EventManager.TriggerRezScript( m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource); m_part.ParentGroup.AddActiveScriptCount(1); @@ -285,38 +279,33 @@ namespace OpenSim.Region.Framework.Scenes return; } - m_part.ParentGroup.Scene.AssetService.Get( - item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset) - { - if (null == asset) - { - m_log.ErrorFormat( - "[PRIM INVENTORY]: " + - "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", - item.Name, item.ItemID, m_part.AbsolutePosition, - m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); - } - else - { - if (m_part.ParentGroup.m_savedScriptState != null) - RestoreSavedScriptState(item.OldItemID, item.ItemID); - - lock (m_items) - { - m_items[item.ItemID].PermsMask = 0; - m_items[item.ItemID].PermsGranter = UUID.Zero; - } - - string script = Utils.BytesToString(asset.Data); - m_part.ParentGroup.Scene.EventManager.TriggerRezScript( - m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); - m_part.ParentGroup.AddActiveScriptCount(1); - m_part.ScheduleFullUpdate(); - } - } - ); + m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset) + { + if (null == asset) + { + m_log.ErrorFormat( + "[PRIM INVENTORY]: " + + "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", + item.Name, item.ItemID, m_part.AbsolutePosition, + m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); + } + else + { + if (m_part.ParentGroup.m_savedScriptState != null) + RestoreSavedScriptState(item.OldItemID, item.ItemID); + m_items[item.ItemID].PermsMask = 0; + m_items[item.ItemID].PermsGranter = UUID.Zero; + string script = Utils.BytesToString(asset.Data); + m_part.ParentGroup.Scene.EventManager.TriggerRezScript( + m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); + m_part.ParentGroup.AddActiveScriptCount(1); + m_part.ScheduleFullUpdate(); + } + }); } - } + } + + static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); private void RestoreSavedScriptState(UUID oldID, UUID newID) { @@ -408,15 +397,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void RemoveScriptInstance(UUID itemId, bool sceneObjectBeingDeleted) { - bool scriptPresent = false; - - lock (m_items) - { - if (m_items.ContainsKey(itemId)) - scriptPresent = true; - } - - if (scriptPresent) + if (m_items.ContainsKey(itemId)) { if (!sceneObjectBeingDeleted) m_part.RemoveScriptEvents(itemId); @@ -488,13 +469,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop) { - List il; - - lock (m_items) - { - il = new List(m_items.Values); - } - + List il = new List(m_items.Values); foreach (TaskInventoryItem i in il) { if (i.Name == item.Name) @@ -576,9 +551,7 @@ namespace OpenSim.Region.Framework.Scenes public TaskInventoryItem GetInventoryItem(UUID itemId) { TaskInventoryItem item; - - lock (m_items) - m_items.TryGetValue(itemId, out item); + m_items.TryGetValue(itemId, out item); return item; } @@ -904,61 +877,54 @@ namespace OpenSim.Region.Framework.Scenes { uint mask=0x7fffffff; - lock (m_items) + foreach (TaskInventoryItem item in m_items.Values) { - foreach (TaskInventoryItem item in m_items.Values) + if (item.InvType != (int)InventoryType.Object) { - if (item.InvType != (int)InventoryType.Object) - { - if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) - mask &= ~((uint)PermissionMask.Copy >> 13); - if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0) - mask &= ~((uint)PermissionMask.Transfer >> 13); - if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) - mask &= ~((uint)PermissionMask.Modify >> 13); - } - else - { - if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) - mask &= ~((uint)PermissionMask.Copy >> 13); - if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) - mask &= ~((uint)PermissionMask.Transfer >> 13); - if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) - mask &= ~((uint)PermissionMask.Modify >> 13); - } - - if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) - mask &= ~(uint)PermissionMask.Copy; - if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) - mask &= ~(uint)PermissionMask.Transfer; - if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0) - mask &= ~(uint)PermissionMask.Modify; + if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0) + mask &= ~((uint)PermissionMask.Copy >> 13); + if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0) + mask &= ~((uint)PermissionMask.Transfer >> 13); + if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0) + mask &= ~((uint)PermissionMask.Modify >> 13); } + else + { + if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) + mask &= ~((uint)PermissionMask.Copy >> 13); + if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) + mask &= ~((uint)PermissionMask.Transfer >> 13); + if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) + mask &= ~((uint)PermissionMask.Modify >> 13); + } + + if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) + mask &= ~(uint)PermissionMask.Copy; + if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) + mask &= ~(uint)PermissionMask.Transfer; + if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0) + mask &= ~(uint)PermissionMask.Modify; } - return mask; } public void ApplyNextOwnerPermissions() { - lock (m_items) + foreach (TaskInventoryItem item in m_items.Values) { - foreach (TaskInventoryItem item in m_items.Values) + if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) { - if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0) - { - if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) - item.CurrentPermissions &= ~(uint)PermissionMask.Copy; - if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) - item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; - if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) - item.CurrentPermissions &= ~(uint)PermissionMask.Modify; - item.CurrentPermissions |= 8; - } - item.CurrentPermissions &= item.NextPermissions; - item.BasePermissions &= item.NextPermissions; - item.EveryonePermissions &= item.NextPermissions; + if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0) + item.CurrentPermissions &= ~(uint)PermissionMask.Copy; + if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0) + item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; + if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) + item.CurrentPermissions &= ~(uint)PermissionMask.Modify; + item.CurrentPermissions |= 8; } + item.CurrentPermissions &= item.NextPermissions; + item.BasePermissions &= item.NextPermissions; + item.EveryonePermissions &= item.NextPermissions; } m_part.TriggerScriptChangedEvent(Changed.OWNER); @@ -966,29 +932,22 @@ namespace OpenSim.Region.Framework.Scenes public void ApplyGodPermissions(uint perms) { - lock (m_items) + foreach (TaskInventoryItem item in m_items.Values) { - foreach (TaskInventoryItem item in m_items.Values) - { - item.CurrentPermissions = perms; - item.BasePermissions = perms; - } + item.CurrentPermissions = perms; + item.BasePermissions = perms; } } public bool ContainsScripts() { - lock (m_items) + foreach (TaskInventoryItem item in m_items.Values) { - foreach (TaskInventoryItem item in m_items.Values) + if (item.InvType == (int)InventoryType.LSL) { - if (item.InvType == (int)InventoryType.LSL) - { - return true; - } + return true; } } - return false; } @@ -996,11 +955,8 @@ namespace OpenSim.Region.Framework.Scenes { List ret = new List(); - lock (m_items) - { - foreach (TaskInventoryItem item in m_items.Values) - ret.Add(item.ItemID); - } + foreach (TaskInventoryItem item in m_items.Values) + ret.Add(item.ItemID); return ret; } @@ -1013,30 +969,26 @@ namespace OpenSim.Region.Framework.Scenes if (engines == null) // No engine at all return ret; - lock (m_items) + foreach (TaskInventoryItem item in m_items.Values) { - foreach (TaskInventoryItem item in m_items.Values) + if (item.InvType == (int)InventoryType.LSL) { - if (item.InvType == (int)InventoryType.LSL) + foreach (IScriptModule e in engines) { - foreach (IScriptModule e in engines) + if (e != null) { - if (e != null) + string n = e.GetXMLState(item.ItemID); + if (n != String.Empty) { - string n = e.GetXMLState(item.ItemID); - if (n != String.Empty) - { - if (!ret.ContainsKey(item.ItemID)) - ret[item.ItemID] = n; - break; - } + if (!ret.ContainsKey(item.ItemID)) + ret[item.ItemID] = n; + break; } } } } } - return ret; } } -} \ No newline at end of file +} From 96d5c8196a3c756639e9f57a7fb3d630d174d0c4 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 2 Feb 2010 15:45:41 +0000 Subject: [PATCH 23/27] minor: add reminder to lock SOG.Children before using it directly in order to avoid threading issues --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index ec41ac76c0..8c568707aa 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -235,6 +235,9 @@ namespace OpenSim.Region.Framework.Scenes set { m_rootPart.GroupID = value; } } + /// + /// The parts of this scene object group. You must lock this property before using it. + /// public Dictionary Children { get { return m_parts; } @@ -2097,7 +2100,7 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Get a child part with a given UUID + /// Get a part with a given UUID /// /// /// null if a child part with the primID was not found @@ -2112,7 +2115,7 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Get a child part with a given local ID + /// Get a part with a given local ID /// /// /// null if a child part with the local ID was not found From 0e23c5fffb8eced017c696ee85bee32131e18d51 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 2 Feb 2010 18:19:15 +0000 Subject: [PATCH 24/27] minor: add some documentation to EventManager.OnObjectGrab --- .../Region/Framework/Scenes/EventManager.cs | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 464ead8279..a4a1abc551 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -92,8 +92,7 @@ namespace OpenSim.Region.Framework.Scenes public delegate void OnShutdownDelegate(); public event OnShutdownDelegate OnShutdown; - - public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); + public delegate void ObjectDeGrabDelegate(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); public delegate void ScriptResetDelegate(uint localID, UUID itemID); @@ -103,7 +102,14 @@ namespace OpenSim.Region.Framework.Scenes public event OnSetRootAgentSceneDelegate OnSetRootAgentScene; + /// + /// Called when an object is touched/grabbed. + /// + /// The originalID is the local ID of the part that was actually touched. The localID itself is always that of + /// the root part. + public delegate void ObjectGrabDelegate(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs); public event ObjectGrabDelegate OnObjectGrab; + public event ObjectGrabDelegate OnObjectGrabbing; public event ObjectDeGrabDelegate OnObjectDeGrab; public event ScriptResetDelegate OnScriptReset; @@ -111,55 +117,42 @@ namespace OpenSim.Region.Framework.Scenes public event OnPermissionErrorDelegate OnPermissionError; public delegate void NewRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource); - public event NewRezScript OnRezScript; public delegate void RemoveScript(uint localID, UUID itemID); - public event RemoveScript OnRemoveScript; public delegate void StartScript(uint localID, UUID itemID); - public event StartScript OnStartScript; public delegate void StopScript(uint localID, UUID itemID); - public event StopScript OnStopScript; public delegate bool SceneGroupMoved(UUID groupID, Vector3 delta); - public event SceneGroupMoved OnSceneGroupMove; public delegate void SceneGroupGrabed(UUID groupID, Vector3 offset, UUID userID); - public event SceneGroupGrabed OnSceneGroupGrab; public delegate bool SceneGroupSpinStarted(UUID groupID); - public event SceneGroupSpinStarted OnSceneGroupSpinStart; public delegate bool SceneGroupSpun(UUID groupID, Quaternion rotation); - public event SceneGroupSpun OnSceneGroupSpin; public delegate void LandObjectAdded(ILandObject newParcel); - public event LandObjectAdded OnLandObjectAdded; public delegate void LandObjectRemoved(UUID globalID); - public event LandObjectRemoved OnLandObjectRemoved; public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); - public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; public delegate void SignificantClientMovement(IClientAPI remote_client); - public event SignificantClientMovement OnSignificantClientMovement; public delegate void IncomingInstantMessage(GridInstantMessage message); - public event IncomingInstantMessage OnIncomingInstantMessage; public event IncomingInstantMessage OnUnhandledInstantMessage; From dc8240910620b1ca2faa0709c0db00d405124193 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 2 Feb 2010 19:04:06 +0000 Subject: [PATCH 25/27] minor: add method doc to sop.SetScriptEvents() --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ef9005fc01..d7f9bbb3a4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3178,6 +3178,11 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Set the events that this part will pass on to listeners. + /// + /// + /// public void SetScriptEvents(UUID scriptid, int events) { // scriptEvents oldparts; From 0faeaf98a66bbe32a171ee32024ea38fc17b6db2 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 2 Feb 2010 19:42:45 +0000 Subject: [PATCH 26/27] minor: copy some method doc from the WorldComm implementation to the interface --- .../Region/Framework/Interfaces/IWorldComm.cs | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs index 74526c452f..948b9dc522 100644 --- a/OpenSim/Region/Framework/Interfaces/IWorldComm.cs +++ b/OpenSim/Region/Framework/Interfaces/IWorldComm.cs @@ -49,10 +49,49 @@ namespace OpenSim.Region.Framework.Interfaces public interface IWorldComm { + /// + /// Create a listen event callback with the specified filters. + /// The parameters localID,itemID are needed to uniquely identify + /// the script during 'peek' time. Parameter hostID is needed to + /// determine the position of the script. + /// + /// localID of the script engine + /// UUID of the script engine + /// UUID of the SceneObjectPart + /// channel to listen on + /// name to filter on + /// key to filter on (user given, could be totally faked) + /// msg to filter on + /// number of the scripts handle int Listen(uint LocalID, UUID itemID, UUID hostID, int channel, string name, UUID id, string msg); + + /// + /// This method scans over the objects which registered an interest in listen callbacks. + /// For everyone it finds, it checks if it fits the given filter. If it does, then + /// enqueue the message for delivery to the objects listen event handler. + /// The enqueued ListenerInfo no longer has filter values, but the actually trigged values. + /// Objects that do an llSay have their messages delivered here and for nearby avatars, + /// the OnChatFromClient event is used. + /// + /// type of delvery (whisper,say,shout or regionwide) + /// channel to sent on + /// name of sender (object or avatar) + /// key of sender (object or avatar) + /// msg to sent void DeliverMessage(ChatTypeEnum type, int channel, string name, UUID id, string msg); + + /// + /// Are there any listen events ready to be dispatched? + /// + /// boolean indication bool HasMessages(); + + /// + /// Pop the first availlable listen event from the queue + /// + /// ListenerInfo with filter filled in IWorldCommListenerInfo GetNextMessage(); + void ListenControl(UUID itemID, int handle, int active); void ListenRemove(UUID itemID, int handle); void DeleteListener(UUID itemID); From 88d0fc3b093e1ae79ef17e2496348251e196a5fa Mon Sep 17 00:00:00 2001 From: radams1 Date: Tue, 2 Feb 2010 16:20:02 -0800 Subject: [PATCH 27/27] allow terrain collision events after regular collision check Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ef9005fc01..b1c6fb90d3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1921,7 +1921,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (uint localId in startedColliders) { if (localId == 0) - return; + continue; // always running this check because if the user deletes the object it would return a null reference. if (m_parentGroup == null) return; @@ -2057,7 +2057,7 @@ namespace OpenSim.Region.Framework.Scenes { // always running this check because if the user deletes the object it would return a null reference. if (localId == 0) - return; + continue; if (m_parentGroup == null) return; @@ -2189,7 +2189,7 @@ namespace OpenSim.Region.Framework.Scenes foreach (uint localId in endedColliders) { if (localId == 0) - return; + continue; // always running this check because if the user deletes the object it would return a null reference. if (m_parentGroup == null)