aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
authorlbsa712007-10-29 11:54:31 +0000
committerlbsa712007-10-29 11:54:31 +0000
commit03d49b0217c0962d06ab93b97299cdf629dff755 (patch)
tree0c9c975d86ac87493c2d3d416992d12f38876d84 /OpenSim/Region/Environment
parentStarted the process of cleaning up AssetCache and moving most of the code int... (diff)
downloadopensim-SC-03d49b0217c0962d06ab93b97299cdf629dff755.zip
opensim-SC-03d49b0217c0962d06ab93b97299cdf629dff755.tar.gz
opensim-SC-03d49b0217c0962d06ab93b97299cdf629dff755.tar.bz2
opensim-SC-03d49b0217c0962d06ab93b97299cdf629dff755.tar.xz
* ModuleLoader: Privatized some too-public fields
* Scene: Changed name from MakeAvatarPhysical to MakeRootAgent and added ForEachClient * SceneManager: Added ForEachScene * Worked some on appearances.
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/ModuleLoader.cs37
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs10
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs5
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs82
4 files changed, 79 insertions, 55 deletions
diff --git a/OpenSim/Region/Environment/ModuleLoader.cs b/OpenSim/Region/Environment/ModuleLoader.cs
index 442ee77..c0dd52a 100644
--- a/OpenSim/Region/Environment/ModuleLoader.cs
+++ b/OpenSim/Region/Environment/ModuleLoader.cs
@@ -27,6 +27,7 @@
27*/ 27*/
28 28
29using System; 29using System;
30using System.Collections;
30using System.Collections.Generic; 31using System.Collections.Generic;
31using System.IO; 32using System.IO;
32using System.Reflection; 33using System.Reflection;
@@ -42,10 +43,10 @@ namespace OpenSim.Region.Environment
42 { 43 {
43 public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>(); 44 public Dictionary<string, Assembly> LoadedAssemblys = new Dictionary<string, Assembly>();
44 45
45 public List<IRegionModule> LoadedModules = new List<IRegionModule>(); 46 private readonly List<IRegionModule> m_loadedModules = new List<IRegionModule>();
46 public Dictionary<string, IRegionModule> LoadedSharedModules = new Dictionary<string, IRegionModule>(); 47 private Dictionary<string, IRegionModule> m_loadedSharedModules = new Dictionary<string, IRegionModule>();
47 private readonly LogBase m_log; 48 private readonly LogBase m_log;
48 private IConfigSource m_config; 49 private readonly IConfigSource m_config;
49 50
50 public ModuleLoader(LogBase log, IConfigSource config) 51 public ModuleLoader(LogBase log, IConfigSource config)
51 { 52 {
@@ -53,6 +54,16 @@ namespace OpenSim.Region.Environment
53 m_config = config; 54 m_config = config;
54 } 55 }
55 56
57 public IRegionModule[] GetLoadedSharedModules
58 {
59 get
60 {
61 IRegionModule[] regionModules = new IRegionModule[ m_loadedSharedModules.Count ];
62 m_loadedSharedModules.Values.CopyTo( regionModules, 0 );
63 return regionModules;
64 }
65 }
66
56 public void PickupModules(Scene scene, string moduleDir) 67 public void PickupModules(Scene scene, string moduleDir)
57 { 68 {
58 DirectoryInfo dir = new DirectoryInfo(moduleDir); 69 DirectoryInfo dir = new DirectoryInfo(moduleDir);
@@ -66,19 +77,19 @@ namespace OpenSim.Region.Environment
66 public void LoadDefaultSharedModules() 77 public void LoadDefaultSharedModules()
67 { 78 {
68 DynamicTextureModule dynamicModule = new DynamicTextureModule(); 79 DynamicTextureModule dynamicModule = new DynamicTextureModule();
69 LoadedSharedModules.Add(dynamicModule.Name, dynamicModule); 80 m_loadedSharedModules.Add(dynamicModule.Name, dynamicModule);
70 81
71 ChatModule chat = new ChatModule(); 82 ChatModule chat = new ChatModule();
72 LoadedSharedModules.Add(chat.Name, chat); 83 m_loadedSharedModules.Add(chat.Name, chat);
73 84
74 InstantMessageModule imMod = new InstantMessageModule(); 85 InstantMessageModule imMod = new InstantMessageModule();
75 LoadedSharedModules.Add(imMod.Name, imMod); 86 m_loadedSharedModules.Add(imMod.Name, imMod);
76 87
77 LoadImageURLModule loadMod = new LoadImageURLModule(); 88 LoadImageURLModule loadMod = new LoadImageURLModule();
78 LoadedSharedModules.Add(loadMod.Name, loadMod); 89 m_loadedSharedModules.Add(loadMod.Name, loadMod);
79 90
80 AvatarFactoryModule avatarFactory = new AvatarFactoryModule(); 91 AvatarFactoryModule avatarFactory = new AvatarFactoryModule();
81 LoadedSharedModules.Add(avatarFactory.Name, avatarFactory); 92 m_loadedSharedModules.Add(avatarFactory.Name, avatarFactory);
82 93
83 //TextureDownloadModule textureModule = new TextureDownloadModule(); 94 //TextureDownloadModule textureModule = new TextureDownloadModule();
84 //LoadedSharedModules.Add(textureModule.Name, textureModule); 95 //LoadedSharedModules.Add(textureModule.Name, textureModule);
@@ -86,7 +97,7 @@ namespace OpenSim.Region.Environment
86 97
87 public void InitialiseSharedModules(Scene scene) 98 public void InitialiseSharedModules(Scene scene)
88 { 99 {
89 foreach (IRegionModule module in LoadedSharedModules.Values) 100 foreach (IRegionModule module in m_loadedSharedModules.Values)
90 { 101 {
91 module.Initialise(scene, m_config); 102 module.Initialise(scene, m_config);
92 scene.AddModule(module.Name, module); //should be doing this? 103 scene.AddModule(module.Name, module); //should be doing this?
@@ -97,7 +108,7 @@ namespace OpenSim.Region.Environment
97 { 108 {
98 module.Initialise(scene, m_config); 109 module.Initialise(scene, m_config);
99 scene.AddModule(module.Name, module); 110 scene.AddModule(module.Name, module);
100 LoadedModules.Add(module); 111 m_loadedModules.Add(module);
101 } 112 }
102 113
103 /// <summary> 114 /// <summary>
@@ -111,7 +122,7 @@ namespace OpenSim.Region.Environment
111 IRegionModule module = LoadModule(dllName, moduleName); 122 IRegionModule module = LoadModule(dllName, moduleName);
112 if (module != null) 123 if (module != null)
113 { 124 {
114 LoadedSharedModules.Add(module.Name, module); 125 m_loadedSharedModules.Add(module.Name, module);
115 } 126 }
116 } 127 }
117 128
@@ -204,12 +215,12 @@ namespace OpenSim.Region.Environment
204 215
205 public void PostInitialise() 216 public void PostInitialise()
206 { 217 {
207 foreach (IRegionModule module in LoadedSharedModules.Values) 218 foreach (IRegionModule module in m_loadedSharedModules.Values)
208 { 219 {
209 module.PostInitialise(); 220 module.PostInitialise();
210 } 221 }
211 222
212 foreach (IRegionModule module in LoadedModules) 223 foreach (IRegionModule module in m_loadedModules)
213 { 224 {
214 module.PostInitialise(); 225 module.PostInitialise();
215 } 226 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index e86562d..1f50e1b 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1134,7 +1134,7 @@ namespace OpenSim.Region.Environment.Scenes
1134 { 1134 {
1135 if (m_scenePresences.ContainsKey(agentID)) 1135 if (m_scenePresences.ContainsKey(agentID))
1136 { 1136 {
1137 m_scenePresences[agentID].MakeAvatarPhysical(position, isFlying); 1137 m_scenePresences[agentID].MakeRootAgent(position, isFlying);
1138 } 1138 }
1139 } 1139 }
1140 } 1140 }
@@ -1570,5 +1570,13 @@ namespace OpenSim.Region.Environment.Scenes
1570 avatar = null; 1570 avatar = null;
1571 return false; 1571 return false;
1572 } 1572 }
1573
1574 internal void ForEachClient( Action<IClientAPI> action )
1575 {
1576 foreach (ScenePresence presence in m_scenePresences.Values )
1577 {
1578 action(presence.ControllingClient);
1579 }
1580 }
1573 } 1581 }
1574} 1582}
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index 76ff6cf..e844462 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -310,5 +310,10 @@ namespace OpenSim.Region.Environment.Scenes
310 avatar = null; 310 avatar = null;
311 return false; 311 return false;
312 } 312 }
313
314 public void ForEachScene(Action<Scene> action )
315 {
316 m_localScenes.ForEach( action );
317 }
313 } 318 }
314} 319}
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 716aaa6..9b6e58d 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -248,8 +248,8 @@ namespace OpenSim.Region.Environment.Scenes
248 Animations.LoadAnims(); 248 Animations.LoadAnims();
249 249
250 //register for events 250 //register for events
251 m_controllingClient.OnRequestWearables += SendOurAppearance; 251 m_controllingClient.OnRequestWearables += SendAppearance;
252 m_controllingClient.OnSetAppearance += new SetAppearance(SetAppearance); 252 m_controllingClient.OnSetAppearance += SetAppearance;
253 m_controllingClient.OnCompleteMovementToRegion += CompleteMovement; 253 m_controllingClient.OnCompleteMovementToRegion += CompleteMovement;
254 m_controllingClient.OnCompleteMovementToRegion += SendInitialData; 254 m_controllingClient.OnCompleteMovementToRegion += SendInitialData;
255 m_controllingClient.OnAgentUpdate += HandleAgentUpdate; 255 m_controllingClient.OnAgentUpdate += HandleAgentUpdate;
@@ -343,7 +343,7 @@ namespace OpenSim.Region.Environment.Scenes
343 343
344 #region Status Methods 344 #region Status Methods
345 345
346 public void MakeAvatarPhysical(LLVector3 pos, bool isFlying) 346 public void MakeRootAgent(LLVector3 pos, bool isFlying)
347 { 347 {
348 m_newAvatar = true; 348 m_newAvatar = true;
349 m_isChildAgent = false; 349 m_isChildAgent = false;
@@ -412,7 +412,7 @@ namespace OpenSim.Region.Environment.Scenes
412 m_visualParams[i] = visualParam[i].ParamValue; 412 m_visualParams[i] = visualParam[i].ParamValue;
413 } 413 }
414 414
415 SendAppearanceToAllOtherAgents(); 415 SendAppearanceToAllOtherClients();
416 } 416 }
417 417
418 /// <summary> 418 /// <summary>
@@ -433,7 +433,7 @@ namespace OpenSim.Region.Environment.Scenes
433 m_isChildAgent = false; 433 m_isChildAgent = false;
434 434
435 //this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient); 435 //this.m_scene.SendAllSceneObjectsToClient(this.ControllingClient);
436 this.MakeAvatarPhysical(this.AbsolutePosition, false); 436 this.MakeRootAgent(this.AbsolutePosition, false);
437 } 437 }
438 } 438 }
439 439
@@ -707,16 +707,19 @@ namespace OpenSim.Region.Environment.Scenes
707 707
708 public void SendFullUpdateToAllClients() 708 public void SendFullUpdateToAllClients()
709 { 709 {
710 List<ScenePresence> avatars = m_scene.GetScenePresences(); 710 List<ScenePresence> agents = m_scene.GetScenePresences();
711 foreach (ScenePresence avatar in avatars) 711 foreach (ScenePresence agent in agents)
712 { 712 {
713 SendFullUpdateToOtherClient(avatar); 713 IClientAPI client = agent.ControllingClient;
714 if (avatar.LocalId != LocalId) 714 client.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_uuid,
715 LocalId, AbsolutePosition, m_textureEntry.ToBytes(), m_parentID );
716
717 if (agent.LocalId != LocalId)
715 { 718 {
716 if (!avatar.m_isChildAgent) 719 if (!agent.m_isChildAgent)
717 { 720 {
718 avatar.SendFullUpdateToOtherClient(this); 721 client.SendAppearance(m_controllingClient.AgentId, m_visualParams,
719 avatar.SendAppearanceToOtherAgent(this); 722 m_textureEntry.ToBytes());
720 } 723 }
721 } 724 }
722 } 725 }
@@ -736,22 +739,28 @@ namespace OpenSim.Region.Environment.Scenes
736 } 739 }
737 740
738 SendFullUpdateToAllClients(); 741 SendFullUpdateToAllClients();
739 SendAppearanceToAllOtherAgents(); 742 SendAppearanceToAllOtherClients();
740 } 743 }
741 744
742 /// <summary> 745 public void SetWearable( int wearableId, AvatarWearable wearable )
743 /// 746 {
744 /// </summary> 747 m_wearables[wearableId] = wearable;
745 /// <param name="OurClient"></param> 748
746 public void SendOurAppearance(IClientAPI OurClient) 749 m_scene.ForEachClient( delegate( IClientAPI client )
750 {
751 SendAppearance( client );
752 });
753 }
754
755 public void SendAppearance(IClientAPI client)
747 { 756 {
748 m_controllingClient.SendWearables(m_wearables); 757 client.SendWearables(m_wearables);
749 758
750 //this.SendFullUpdateToAllClients(); 759 //this.SendFullUpdateToAllClients();
751 //this.SendAppearanceToAllOtherAgents(); 760 //this.SendAppearanceToAllOtherClients();
752 761
753 m_scene.SendAllSceneObjectsToClient(this); 762 m_scene.SendAllSceneObjectsToClient(this);
754 m_controllingClient.SendViewerTime(m_scene.TimePhase); 763 client.SendViewerTime(m_scene.TimePhase);
755 764
756 //Please don't remove the following code (at least not yet), just leave it commented out 765 //Please don't remove the following code (at least not yet), just leave it commented out
757 //gives the user god powers, should help with debuging things in the future 766 //gives the user god powers, should help with debuging things in the future
@@ -767,25 +776,16 @@ namespace OpenSim.Region.Environment.Scenes
767 /// <summary> 776 /// <summary>
768 /// 777 ///
769 /// </summary> 778 /// </summary>
770 public void SendAppearanceToAllOtherAgents() 779 public void SendAppearanceToAllOtherClients()
771 { 780 {
772 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 781 m_scene.ForEachClient(delegate(IClientAPI client)
773 { 782 {
774 if (scenePresence != this) 783 if( client != m_controllingClient )
775 { 784 {
776 SendAppearanceToOtherAgent(scenePresence); 785 client.SendAppearance(m_controllingClient.AgentId, m_visualParams,
777 } 786 m_textureEntry.ToBytes() );
778 }); 787 }
779 } 788 });
780
781 /// <summary>
782 ///
783 /// </summary>
784 /// <param name="avatarInfo"></param>
785 public void SendAppearanceToOtherAgent(ScenePresence avatarInfo)
786 {
787 avatarInfo.m_controllingClient.SendAppearance(m_controllingClient.AgentId, m_visualParams,
788 m_textureEntry.ToBytes());
789 } 789 }
790 790
791 /// <summary> 791 /// <summary>