aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs186
1 files changed, 9 insertions, 177 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 8d3792c..f798a0e 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -113,25 +113,6 @@ namespace OpenSim.Region.Environment.Scenes
113 get { return m_sceneGridService; } 113 get { return m_sceneGridService; }
114 } 114 }
115 115
116 /// <value>
117 /// All the region modules attached to this scene.
118 /// </value>
119 public Dictionary<string, IRegionModule> Modules
120 {
121 get { return m_modules; }
122 }
123 protected Dictionary<string, IRegionModule> m_modules = new Dictionary<string, IRegionModule>();
124
125 /// <value>
126 /// The module interfaces available from this scene.
127 /// </value>
128 protected Dictionary<Type, List<object> > ModuleInterfaces = new Dictionary<Type, List<object> >();
129
130 protected Dictionary<string, object> ModuleAPIMethods = new Dictionary<string, object>();
131 protected Dictionary<string, ICommander> m_moduleCommanders = new Dictionary<string, ICommander>();
132
133 //API module interfaces
134
135 public IXfer XferManager; 116 public IXfer XferManager;
136 117
137 protected IXMLRPC m_xmlrpcModule; 118 protected IXMLRPC m_xmlrpcModule;
@@ -281,11 +262,6 @@ namespace OpenSim.Region.Environment.Scenes
281 262
282 public int objectCapacity = 45000; 263 public int objectCapacity = 45000;
283 264
284 /// <value>
285 /// Registered classes that are capable of creating entities.
286 /// </value>
287 protected Dictionary<PCode, IEntityCreator> m_entityCreators = new Dictionary<PCode, IEntityCreator>();
288
289 #endregion 265 #endregion
290 266
291 #region Constructors 267 #region Constructors
@@ -737,16 +713,6 @@ namespace OpenSim.Region.Environment.Scenes
737 // De-register with region communications (events cleanup) 713 // De-register with region communications (events cleanup)
738 UnRegisterRegionWithComms(); 714 UnRegisterRegionWithComms();
739 715
740 // Shut down all non shared modules.
741 foreach (IRegionModule module in Modules.Values)
742 {
743 if (!module.IsSharedModule)
744 {
745 module.Close();
746 }
747 }
748 Modules.Clear();
749
750 // call the base class Close method. 716 // call the base class Close method.
751 base.Close(); 717 base.Close();
752 } 718 }
@@ -1838,6 +1804,7 @@ namespace OpenSim.Region.Environment.Scenes
1838 /// <summary> 1804 /// <summary>
1839 /// Add an object into the scene that has come from storage 1805 /// Add an object into the scene that has come from storage
1840 /// </summary> 1806 /// </summary>
1807 ///
1841 /// <param name="sceneObject"></param> 1808 /// <param name="sceneObject"></param>
1842 /// <param name="attachToBackup"> 1809 /// <param name="attachToBackup">
1843 /// If true, changes to the object will be reflected in its persisted data 1810 /// If true, changes to the object will be reflected in its persisted data
@@ -3158,128 +3125,8 @@ namespace OpenSim.Region.Environment.Scenes
3158 3125
3159 #endregion 3126 #endregion
3160 3127
3161 #region Module Methods 3128 #region Other Methods
3162 3129
3163 /// <summary>
3164 /// Add a module to this scene.
3165 /// </summary>
3166 /// <param name="name"></param>
3167 /// <param name="module"></param>
3168 public void AddModule(string name, IRegionModule module)
3169 {
3170 if (!Modules.ContainsKey(name))
3171 {
3172 Modules.Add(name, module);
3173 }
3174 }
3175
3176 public void RegisterModuleCommander(string name, ICommander commander)
3177 {
3178 lock (m_moduleCommanders)
3179 {
3180 m_moduleCommanders.Add(name, commander);
3181 }
3182 }
3183
3184 public ICommander GetCommander(string name)
3185 {
3186 lock (m_moduleCommanders)
3187 {
3188 return m_moduleCommanders[name];
3189 }
3190 }
3191
3192 public Dictionary<string, ICommander> GetCommanders()
3193 {
3194 return m_moduleCommanders;
3195 }
3196
3197 /// <summary>
3198 /// Register an interface to a region module. This allows module methods to be called directly as
3199 /// well as via events. If there is already a module registered for this interface, it is not replaced
3200 /// (is this the best behaviour?)
3201 /// </summary>
3202 /// <param name="mod"></param>
3203 public void RegisterModuleInterface<M>(M mod)
3204 {
3205 if (!ModuleInterfaces.ContainsKey(typeof(M)))
3206 {
3207 List<Object> l = new List<Object>();
3208 l.Add(mod);
3209 ModuleInterfaces.Add(typeof(M), l);
3210
3211 if (mod is IEntityCreator)
3212 {
3213 IEntityCreator entityCreator = (IEntityCreator)mod;
3214 foreach (PCode pcode in entityCreator.CreationCapabilities)
3215 {
3216 m_entityCreators[pcode] = entityCreator;
3217 }
3218 }
3219 }
3220 }
3221
3222 public void StackModuleInterface<M>(M mod)
3223 {
3224 List<Object> l;
3225 if (ModuleInterfaces.ContainsKey(typeof(M)))
3226 l = ModuleInterfaces[typeof(M)];
3227 else
3228 l = new List<Object>();
3229
3230 if (l.Contains(mod))
3231 return;
3232
3233 l.Add(mod);
3234
3235 if (mod is IEntityCreator)
3236 {
3237 IEntityCreator entityCreator = (IEntityCreator)mod;
3238 foreach (PCode pcode in entityCreator.CreationCapabilities)
3239 {
3240 m_entityCreators[pcode] = entityCreator;
3241 }
3242 }
3243
3244 ModuleInterfaces[typeof(M)] = l;
3245 }
3246
3247 /// <summary>
3248 /// For the given interface, retrieve the region module which implements it.
3249 /// </summary>
3250 /// <returns>null if there is no registered module implementing that interface</returns>
3251 public override T RequestModuleInterface<T>()
3252 {
3253 if (ModuleInterfaces.ContainsKey(typeof(T)))
3254 {
3255 return (T)ModuleInterfaces[typeof(T)][0];
3256 }
3257 else
3258 {
3259 return default(T);
3260 }
3261 }
3262
3263 /// <summary>
3264 /// For the given interface, retrieve an array of region modules that implement it.
3265 /// </summary>
3266 /// <returns>an empty array if there are no registered modules implementing that interface</returns>
3267 public override T[] RequestModuleInterfaces<T>()
3268 {
3269 if (ModuleInterfaces.ContainsKey(typeof(T)))
3270 {
3271 List<T> ret = new List<T>();
3272
3273 foreach (Object o in ModuleInterfaces[typeof(T)])
3274 ret.Add((T)o);
3275 return ret.ToArray();
3276 }
3277 else
3278 {
3279 return new T[] { default(T) };
3280 }
3281 }
3282
3283 public void SetObjectCapacity(int objects) 3130 public void SetObjectCapacity(int objects)
3284 { 3131 {
3285 // Region specific config overrides global 3132 // Region specific config overrides global
@@ -3293,7 +3140,7 @@ namespace OpenSim.Region.Environment.Scenes
3293 } 3140 }
3294 objectCapacity = objects; 3141 objectCapacity = objects;
3295 } 3142 }
3296 3143
3297 public List<FriendListItem> GetFriendList(UUID avatarID) 3144 public List<FriendListItem> GetFriendList(UUID avatarID)
3298 { 3145 {
3299 return CommsManager.GetUserFriendList(avatarID); 3146 return CommsManager.GetUserFriendList(avatarID);
@@ -3314,10 +3161,6 @@ namespace OpenSim.Region.Environment.Scenes
3314 return CommsManager.TriggerTerminateFriend(regionHandle, agentID, exFriendID); 3161 return CommsManager.TriggerTerminateFriend(regionHandle, agentID, exFriendID);
3315 } 3162 }
3316 3163
3317 #endregion
3318
3319 #region Other Methods
3320
3321 public virtual void StoreAddFriendship(UUID ownerID, UUID friendID, uint perms) 3164 public virtual void StoreAddFriendship(UUID ownerID, UUID friendID, uint perms)
3322 { 3165 {
3323 m_sceneGridService.AddNewUserFriend(ownerID, friendID, perms); 3166 m_sceneGridService.AddNewUserFriend(ownerID, friendID, perms);
@@ -3563,12 +3406,10 @@ namespace OpenSim.Region.Environment.Scenes
3563 } 3406 }
3564 } 3407 }
3565 3408
3566 /// <summary> 3409 public override void Show(string[] showParams)
3567 /// Shows various details about the sim based on the parameters supplied by the console command in openSimMain.
3568 /// </summary>
3569 /// <param name="showParams">What to show</param>
3570 public void Show(string[] showParams)
3571 { 3410 {
3411 base.Show(showParams);
3412
3572 switch (showParams[0]) 3413 switch (showParams[0])
3573 { 3414 {
3574 case "users": 3415 case "users":
@@ -3587,18 +3428,9 @@ namespace OpenSim.Region.Environment.Scenes
3587 "Unknown", 3428 "Unknown",
3588 RegionInfo.RegionName); 3429 RegionInfo.RegionName);
3589 } 3430 }
3431
3590 break; 3432 break;
3591 case "modules": 3433 }
3592 m_log.Error("The currently loaded modules in " + RegionInfo.RegionName + " are:");
3593 foreach (IRegionModule module in Modules.Values)
3594 {
3595 if (!module.IsSharedModule)
3596 {
3597 m_log.Error("Region Module: " + module.Name);
3598 }
3599 }
3600 break;
3601 }
3602 } 3434 }
3603 3435
3604 #region Script Handling Methods 3436 #region Script Handling Methods