aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs53
1 files changed, 43 insertions, 10 deletions
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 {