aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorMelanie Thielker2008-09-25 17:26:32 +0000
committerMelanie Thielker2008-09-25 17:26:32 +0000
commitf11107821e259d544dc42648f4cdba2b123cd71e (patch)
tree5d288d96a2eb07788ae40130736215599eb9bcec /OpenSim/Region/Environment
parentMantis#2017. Thank you kindly, Tyre, for a patch that solves: (diff)
downloadopensim-SC_OLD-f11107821e259d544dc42648f4cdba2b123cd71e.zip
opensim-SC_OLD-f11107821e259d544dc42648f4cdba2b123cd71e.tar.gz
opensim-SC_OLD-f11107821e259d544dc42648f4cdba2b123cd71e.tar.bz2
opensim-SC_OLD-f11107821e259d544dc42648f4cdba2b123cd71e.tar.xz
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
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs6
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs53
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneBase.cs5
3 files changed, 54 insertions, 10 deletions
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
178 remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false); 178 remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false);
179 return UUID.Zero; 179 return UUID.Zero;
180 } 180 }
181 remoteClient.SendAgentAlertMessage("Notecard saved", false);
181 } 182 }
182 else if ((InventoryType) item.InvType == InventoryType.LSL) 183 else if ((InventoryType) item.InvType == InventoryType.LSL)
183 { 184 {
@@ -186,6 +187,7 @@ namespace OpenSim.Region.Environment.Scenes
186 remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); 187 remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false);
187 return UUID.Zero; 188 return UUID.Zero;
188 } 189 }
190 remoteClient.SendAgentAlertMessage("Script saved", false);
189 } 191 }
190 192
191 AssetBase asset = 193 AssetBase asset =
@@ -287,6 +289,10 @@ namespace OpenSim.Region.Environment.Scenes
287 // 289 //
288 part.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine); 290 part.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine);
289 } 291 }
292 else
293 {
294 remoteClient.SendAgentAlertMessage("Script saved", false);
295 }
290 } 296 }
291 297
292 /// <summary> 298 /// <summary>
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
124 { 124 {
125 get { return m_modules; } 125 get { return m_modules; }
126 } 126 }
127 protected Dictionary<Type, object> ModuleInterfaces = new Dictionary<Type, object>(); 127 protected Dictionary<Type, List<object> > ModuleInterfaces = new Dictionary<Type, List<object> >();
128 protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>(); 128 protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>();
129 protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>(); 129 protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>();
130 130
@@ -3025,10 +3025,27 @@ namespace OpenSim.Region.Environment.Scenes
3025 { 3025 {
3026 if (!ModuleInterfaces.ContainsKey(typeof(M))) 3026 if (!ModuleInterfaces.ContainsKey(typeof(M)))
3027 { 3027 {
3028 ModuleInterfaces.Add(typeof(M), mod); 3028 List<Object> l = new List<Object>();
3029 l.Add(mod);
3030 ModuleInterfaces.Add(typeof(M), l);
3029 } 3031 }
3030 } 3032 }
3031 3033
3034 public void StackModuleInterface<M>(M mod)
3035 {
3036 List<Object> l;
3037 if (ModuleInterfaces.ContainsKey(typeof(M)))
3038 l = ModuleInterfaces[typeof(M)];
3039 else
3040 l = new List<Object>();
3041
3042 if (l.Contains(mod))
3043 return;
3044
3045 l.Add(mod);
3046 ModuleInterfaces[typeof(M)] = l;
3047 }
3048
3032 /// <summary> 3049 /// <summary>
3033 /// For the given interface, retrieve the region module which implements it. 3050 /// For the given interface, retrieve the region module which implements it.
3034 /// </summary> 3051 /// </summary>
@@ -3037,7 +3054,7 @@ namespace OpenSim.Region.Environment.Scenes
3037 { 3054 {
3038 if (ModuleInterfaces.ContainsKey(typeof(T))) 3055 if (ModuleInterfaces.ContainsKey(typeof(T)))
3039 { 3056 {
3040 return (T)ModuleInterfaces[typeof(T)]; 3057 return (T)ModuleInterfaces[typeof(T)][0];
3041 } 3058 }
3042 else 3059 else
3043 { 3060 {
@@ -3045,6 +3062,22 @@ namespace OpenSim.Region.Environment.Scenes
3045 } 3062 }
3046 } 3063 }
3047 3064
3065 public override T[] RequestModuleInterfaces<T>()
3066 {
3067 if (ModuleInterfaces.ContainsKey(typeof(T)))
3068 {
3069 List<T> ret = new List<T>();
3070
3071 foreach(Object o in ModuleInterfaces[typeof(T)])
3072 ret.Add((T)o);
3073 return ret.ToArray();
3074 }
3075 else
3076 {
3077 return new T[] { default(T) };
3078 }
3079 }
3080
3048 public void SetObjectCapacity(int objects) 3081 public void SetObjectCapacity(int objects)
3049 { 3082 {
3050 if (m_statsReporter != null) 3083 if (m_statsReporter != null)
@@ -3628,7 +3661,7 @@ namespace OpenSim.Region.Environment.Scenes
3628 m_eventManager.TriggerNotAtTargetEvent(localID); 3661 m_eventManager.TriggerNotAtTargetEvent(localID);
3629 } 3662 }
3630 3663
3631 private bool scriptDanger(SceneObjectPart part,Vector3 pos) 3664 private bool ScriptDanger(SceneObjectPart part,Vector3 pos)
3632 { 3665 {
3633 ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y); 3666 ILandObject parcel = LandChannel.GetLandObject(pos.X, pos.Y);
3634 if (part != null) 3667 if (part != null)
@@ -3684,12 +3717,12 @@ namespace OpenSim.Region.Environment.Scenes
3684 } 3717 }
3685 } 3718 }
3686 3719
3687 public bool scriptDanger(uint localID, Vector3 pos) 3720 public bool ScriptDanger(uint localID, Vector3 pos)
3688 { 3721 {
3689 SceneObjectPart part = GetSceneObjectPart(localID); 3722 SceneObjectPart part = GetSceneObjectPart(localID);
3690 if (part != null) 3723 if (part != null)
3691 { 3724 {
3692 return scriptDanger(part, pos); 3725 return ScriptDanger(part, pos);
3693 } 3726 }
3694 else 3727 else
3695 { 3728 {
@@ -3697,19 +3730,19 @@ namespace OpenSim.Region.Environment.Scenes
3697 } 3730 }
3698 } 3731 }
3699 3732
3700 public bool pipeEventsForScript(uint localID) 3733 public bool PipeEventsForScript(uint localID)
3701 { 3734 {
3702 SceneObjectPart part = GetSceneObjectPart(localID); 3735 SceneObjectPart part = GetSceneObjectPart(localID);
3703 if (part != null) 3736 if (part != null)
3704 { 3737 {
3705 // Changed so that child prims of attachments return scriptDanger for their parent, so that 3738 // Changed so that child prims of attachments return ScriptDanger for their parent, so that
3706 // their scripts will actually run. 3739 // their scripts will actually run.
3707 // -- Leaf, Tue Aug 12 14:17:05 EDT 2008 3740 // -- Leaf, Tue Aug 12 14:17:05 EDT 2008
3708 SceneObjectPart parent = part.ParentGroup.RootPart; 3741 SceneObjectPart parent = part.ParentGroup.RootPart;
3709 if (parent != null && parent.IsAttachment) 3742 if (parent != null && parent.IsAttachment)
3710 return scriptDanger(parent, parent.GetWorldPosition()); 3743 return ScriptDanger(parent, parent.GetWorldPosition());
3711 else 3744 else
3712 return scriptDanger(part, part.GetWorldPosition()); 3745 return ScriptDanger(part, part.GetWorldPosition());
3713 } 3746 }
3714 else 3747 else
3715 { 3748 {
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
225 { 225 {
226 return default(T); 226 return default(T);
227 } 227 }
228
229 public virtual T[] RequestModuleInterfaces<T>()
230 {
231 return new T[] { default(T) };
232 }
228 } 233 }
229} 234}