From 40abeed7d425065e273e3a33264425f8ded35f3e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sun, 17 Aug 2008 18:41:13 +0000 Subject: Add the IInventoryModule interface and a sample method call to Scene.INventory.cs --- .../Modules/Avatar/Inventory/InventoryModule.cs | 36 ++++++++++++++-------- .../Region/Environment/Scenes/Scene.Inventory.cs | 9 ++++++ 2 files changed, 32 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Modules/Avatar/Inventory/InventoryModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Inventory/InventoryModule.cs index e1cc688..cc088a0 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Inventory/InventoryModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Inventory/InventoryModule.cs @@ -36,7 +36,7 @@ using OpenSim.Region.Environment.Scenes; namespace OpenSim.Region.Environment.Modules.Avatar.Inventory { - public class InventoryModule : IRegionModule + public class InventoryModule : IInventoryModule, IRegionModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -48,14 +48,20 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory /// private IDictionary m_pendingOffers = new Dictionary(); - private Scene m_scene; + private List m_Scenelist = new List(); #region IRegionModule Members public void Initialise(Scene scene, IConfigSource config) { - m_scene = scene; - scene.EventManager.OnNewClient += OnNewClient; + if(!m_Scenelist.Contains(scene)) + { + m_Scenelist.Add(scene); + + scene.RegisterModuleInterface(this); + + scene.EventManager.OnNewClient += OnNewClient; + } } public void PostInitialise() @@ -73,7 +79,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory public bool IsSharedModule { - get { return false; } + get { return true; } } #endregion @@ -97,9 +103,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory "[AGENT INVENTORY]: Routing inventory offering message from {0}, {1} to {2}", client.AgentId, client.Name, toAgentID); - if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence) + if (((Scene)(client.Scene)).Entities.ContainsKey(toAgentID) && ((Scene)(client.Scene)).Entities[toAgentID] is ScenePresence) { - ScenePresence user = (ScenePresence) m_scene.Entities[toAgentID]; + ScenePresence user = (ScenePresence) ((Scene)(client.Scene)).Entities[toAgentID]; if (!user.IsChildAgent) { @@ -143,9 +149,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory "[AGENT INVENTORY]: Routing inventory accepted message from {0}, {1} to {2}", client.AgentId, client.Name, toAgentID); - if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence) + if (((Scene)(client.Scene)).Entities.ContainsKey(toAgentID) && ((Scene)(client.Scene)).Entities[toAgentID] is ScenePresence) { - ScenePresence user = (ScenePresence) m_scene.Entities[toAgentID]; + ScenePresence user = (ScenePresence) ((Scene)(client.Scene)).Entities[toAgentID]; if (!user.IsChildAgent) { @@ -160,7 +166,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory // Since the message originates from the accepting client, the toAgentID is // the agent giving the item. - m_scene.GiveInventoryItem(client, toAgentID, m_pendingOffers[imSessionID]); + ((Scene)(client.Scene)).GiveInventoryItem(client, toAgentID, m_pendingOffers[imSessionID]); m_pendingOffers.Remove(imSessionID); } @@ -189,9 +195,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory } else if (dialog == (byte) InstantMessageDialog.InventoryDeclined) { - if (m_scene.Entities.ContainsKey(toAgentID) && m_scene.Entities[toAgentID] is ScenePresence) + if (((Scene)(client.Scene)).Entities.ContainsKey(toAgentID) && ((Scene)(client.Scene)).Entities[toAgentID] is ScenePresence) { - ScenePresence user = (ScenePresence) m_scene.Entities[toAgentID]; + ScenePresence user = (ScenePresence) ((Scene)(client.Scene)).Entities[toAgentID]; if (!user.IsChildAgent) { @@ -216,5 +222,9 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Inventory } } } + +// public void TestFunction() +// { +// } } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 3f62610..fe66dd5 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -2308,5 +2308,14 @@ namespace OpenSim.Region.Environment.Scenes else EventManager.TriggerStopScript(part.LocalId, itemID); } + +// public void TestFunction() +// { +// IInventoryModule imod = RequestModuleInterface(); +// if (imod == null) +// return; +// +// imod.TestFunction(); +// } } } -- cgit v1.1