From f11107821e259d544dc42648f4cdba2b123cd71e Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Thu, 25 Sep 2008 17:26:32 +0000 Subject: Add an extension to allow registering multiple interfaces of a type with Scene. Make the script engines check that the engine name in the //Engine:language comment is a valid engine and treat it as a normal comment if it's not. //DotNetEngine: needs to be written as //ScriptEngine.DotNetEngine: now, since that is it's real internal name. //XEngine: still works --- .../Region/Environment/Scenes/Scene.Inventory.cs | 6 +++ OpenSim/Region/Environment/Scenes/Scene.cs | 53 ++++++++++++++++++---- OpenSim/Region/Environment/Scenes/SceneBase.cs | 5 ++ 3 files changed, 54 insertions(+), 10 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 2a9be81..8fec13f 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -178,6 +178,7 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false); return UUID.Zero; } + remoteClient.SendAgentAlertMessage("Notecard saved", false); } else if ((InventoryType) item.InvType == InventoryType.LSL) { @@ -186,6 +187,7 @@ namespace OpenSim.Region.Environment.Scenes remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); return UUID.Zero; } + remoteClient.SendAgentAlertMessage("Script saved", false); } AssetBase asset = @@ -287,6 +289,10 @@ namespace OpenSim.Region.Environment.Scenes // part.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine); } + else + { + remoteClient.SendAgentAlertMessage("Script saved", false); + } } /// diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 74502b8..e5f10b8 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -124,7 +124,7 @@ namespace OpenSim.Region.Environment.Scenes { get { return m_modules; } } - protected Dictionary ModuleInterfaces = new Dictionary(); + protected Dictionary > ModuleInterfaces = new Dictionary >(); protected Dictionary ModuleAPIMethods = new Dictionary(); protected Dictionary m_moduleCommanders = new Dictionary(); @@ -3025,10 +3025,27 @@ namespace OpenSim.Region.Environment.Scenes { if (!ModuleInterfaces.ContainsKey(typeof(M))) { - ModuleInterfaces.Add(typeof(M), mod); + List l = new List(); + l.Add(mod); + ModuleInterfaces.Add(typeof(M), l); } } + public void StackModuleInterface(M mod) + { + List l; + if (ModuleInterfaces.ContainsKey(typeof(M))) + l = ModuleInterfaces[typeof(M)]; + else + l = new List(); + + if (l.Contains(mod)) + return; + + l.Add(mod); + ModuleInterfaces[typeof(M)] = l; + } + /// /// For the given interface, retrieve the region module which implements it. /// @@ -3037,7 +3054,7 @@ namespace OpenSim.Region.Environment.Scenes { if (ModuleInterfaces.ContainsKey(typeof(T))) { - return (T)ModuleInterfaces[typeof(T)]; + return (T)ModuleInterfaces[typeof(T)][0]; } else { @@ -3045,6 +3062,22 @@ namespace OpenSim.Region.Environment.Scenes } } + public override T[] RequestModuleInterfaces() + { + if (ModuleInterfaces.ContainsKey(typeof(T))) + { + List ret = new List(); + + foreach(Object o in ModuleInterfaces[typeof(T)]) + ret.Add((T)o); + return ret.ToArray(); + } + else + { + return new T[] { default(T) }; + } + } + public void SetObjectCapacity(int objects) { if (m_statsReporter != null) @@ -3628,7 +3661,7 @@ namespace OpenSim.Region.Environment.Scenes m_eventManager.TriggerNotAtTargetEvent(localID); } - private bool scriptDanger(SceneObjectPart part,Vector3 pos) + private bool ScriptDanger(SceneObjectPart part,Vector3 pos) { ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); if (part != null) @@ -3684,12 +3717,12 @@ namespace OpenSim.Region.Environment.Scenes } } - public bool scriptDanger(uint localID, Vector3 pos) + public bool ScriptDanger(uint localID, Vector3 pos) { SceneObjectPart part = GetSceneObjectPart(localID); if (part != null) { - return scriptDanger(part, pos); + return ScriptDanger(part, pos); } else { @@ -3697,19 +3730,19 @@ namespace OpenSim.Region.Environment.Scenes } } - public bool pipeEventsForScript(uint localID) + public bool PipeEventsForScript(uint localID) { SceneObjectPart part = GetSceneObjectPart(localID); if (part != null) { - // Changed so that child prims of attachments return scriptDanger for their parent, so that + // Changed so that child prims of attachments return ScriptDanger for their parent, so that // their scripts will actually run. // -- Leaf, Tue Aug 12 14:17:05 EDT 2008 SceneObjectPart parent = part.ParentGroup.RootPart; if (parent != null && parent.IsAttachment) - return scriptDanger(parent, parent.GetWorldPosition()); + return ScriptDanger(parent, parent.GetWorldPosition()); else - return scriptDanger(part, part.GetWorldPosition()); + return ScriptDanger(part, part.GetWorldPosition()); } else { diff --git a/OpenSim/Region/Environment/Scenes/SceneBase.cs b/OpenSim/Region/Environment/Scenes/SceneBase.cs index 955fd22..1406b47 100644 --- a/OpenSim/Region/Environment/Scenes/SceneBase.cs +++ b/OpenSim/Region/Environment/Scenes/SceneBase.cs @@ -225,5 +225,10 @@ namespace OpenSim.Region.Environment.Scenes { return default(T); } + + public virtual T[] RequestModuleInterfaces() + { + return new T[] { default(T) }; + } } } -- cgit v1.1