aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authorlbsa712007-09-20 05:02:44 +0000
committerlbsa712007-09-20 05:02:44 +0000
commit4ce0c0794afae5f068a0a5c1d6b54fd4487334d7 (patch)
treee0534f4ba389e1d45e8d1552a89bf251667b82f8 /OpenSim/Region/Environment/Scenes
parent* A feeble attempt at adding Grid db support to SQLite, just adding some code... (diff)
downloadopensim-SC-4ce0c0794afae5f068a0a5c1d6b54fd4487334d7.zip
opensim-SC-4ce0c0794afae5f068a0a5c1d6b54fd4487334d7.tar.gz
opensim-SC-4ce0c0794afae5f068a0a5c1d6b54fd4487334d7.tar.bz2
opensim-SC-4ce0c0794afae5f068a0a5c1d6b54fd4487334d7.tar.xz
* Added TryGetAvatar to SceneManager
* Refactored some names for clarity
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs84
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs431
2 files changed, 273 insertions, 242 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 3a45e23..874bb41 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -48,7 +48,7 @@ using OpenSim.Region.Environment.Scenes.Scripting;
48using OpenSim.Region.Environment.Types; 48using OpenSim.Region.Environment.Types;
49using OpenSim.Region.Physics.Manager; 49using OpenSim.Region.Physics.Manager;
50using OpenSim.Region.Terrain; 50using OpenSim.Region.Terrain;
51using Timer=System.Timers.Timer; 51using Timer = System.Timers.Timer;
52 52
53namespace OpenSim.Region.Environment.Scenes 53namespace OpenSim.Region.Environment.Scenes
54{ 54{
@@ -195,7 +195,7 @@ namespace OpenSim.Region.Environment.Scenes
195 Prims = new Dictionary<LLUUID, SceneObjectGroup>(); 195 Prims = new Dictionary<LLUUID, SceneObjectGroup>();
196 196
197 MainLog.Instance.Verbose("Creating LandMap"); 197 MainLog.Instance.Verbose("Creating LandMap");
198 Terrain = new TerrainEngine((int) RegionInfo.RegionLocX, (int) RegionInfo.RegionLocY); 198 Terrain = new TerrainEngine((int)RegionInfo.RegionLocX, (int)RegionInfo.RegionLocY);
199 199
200 ScenePresence.LoadAnims(); 200 ScenePresence.LoadAnims();
201 201
@@ -254,7 +254,7 @@ namespace OpenSim.Region.Environment.Scenes
254 if (phyScene.IsThreaded) 254 if (phyScene.IsThreaded)
255 { 255 {
256 phyScene.GetResults(); 256 phyScene.GetResults();
257 /// no engines implement this, and what does it have to do with threading? possible DEAD CODE 257 /// no engines implement this, and what does it have to do with threading? possible DEAD CODE
258 } 258 }
259 259
260 List<EntityBase> moveEntities = new List<EntityBase>(Entities.Values); 260 List<EntityBase> moveEntities = new List<EntityBase>(Entities.Values);
@@ -313,7 +313,7 @@ namespace OpenSim.Region.Environment.Scenes
313 { 313 {
314 for (int y = 0; y < 16; y++) 314 for (int y = 0; y < 16; y++)
315 { 315 {
316 if (Terrain.Tainted(x*16, y*16)) 316 if (Terrain.Tainted(x * 16, y * 16))
317 { 317 {
318 SendLayerData(x, y, presence.ControllingClient, 318 SendLayerData(x, y, presence.ControllingClient,
319 terData); 319 terData);
@@ -526,7 +526,7 @@ namespace OpenSim.Region.Environment.Scenes
526 { 526 {
527 AddEntityFromStorage(prim); 527 AddEntityFromStorage(prim);
528 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID); 528 SceneObjectPart rootPart = prim.GetChildPart(prim.UUID);
529 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) 529 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0)
530 rootPart.PhysActor = phyScene.AddPrim( 530 rootPart.PhysActor = phyScene.AddPrim(
531 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, 531 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
532 rootPart.AbsolutePosition.Z), 532 rootPart.AbsolutePosition.Z),
@@ -570,10 +570,10 @@ namespace OpenSim.Region.Environment.Scenes
570 // if grass or tree, make phantom 570 // if grass or tree, make phantom
571 if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255)) 571 if ((rootPart.Shape.PCode == 95) || (rootPart.Shape.PCode == 255))
572 { 572 {
573 rootPart.ObjectFlags += (uint) LLObject.ObjectFlags.Phantom; 573 rootPart.ObjectFlags += (uint)LLObject.ObjectFlags.Phantom;
574 } 574 }
575 // if not phantom, add to physics 575 // if not phantom, add to physics
576 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) 576 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0)
577 rootPart.PhysActor = 577 rootPart.PhysActor =
578 phyScene.AddPrim(new PhysicsVector(pos.X, pos.Y, pos.Z), 578 phyScene.AddPrim(new PhysicsVector(pos.X, pos.Y, pos.Z),
579 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z), 579 new PhysicsVector(shape.Scale.X, shape.Scale.Y, shape.Scale.Z),
@@ -587,9 +587,9 @@ namespace OpenSim.Region.Environment.Scenes
587 { 587 {
588 if (obj is SceneObjectGroup) 588 if (obj is SceneObjectGroup)
589 { 589 {
590 if (((SceneObjectGroup) obj).LocalId == localID) 590 if (((SceneObjectGroup)obj).LocalId == localID)
591 { 591 {
592 RemoveEntity((SceneObjectGroup) obj); 592 RemoveEntity((SceneObjectGroup)obj);
593 return; 593 return;
594 } 594 }
595 } 595 }
@@ -657,7 +657,7 @@ namespace OpenSim.Region.Environment.Scenes
657 AddEntity(obj); 657 AddEntity(obj);
658 658
659 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); 659 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
660 if ((rootPart.ObjectFlags & (uint) LLObject.ObjectFlags.Phantom) == 0) 660 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0)
661 rootPart.PhysActor = phyScene.AddPrim( 661 rootPart.PhysActor = phyScene.AddPrim(
662 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, 662 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y,
663 rootPart.AbsolutePosition.Z), 663 rootPart.AbsolutePosition.Z),
@@ -683,7 +683,7 @@ namespace OpenSim.Region.Environment.Scenes
683 { 683 {
684 if (ent is SceneObjectGroup) 684 if (ent is SceneObjectGroup)
685 { 685 {
686 stream.WriteLine(((SceneObjectGroup) ent).ToXmlString()); 686 stream.WriteLine(((SceneObjectGroup)ent).ToXmlString());
687 primCount++; 687 primCount++;
688 } 688 }
689 } 689 }
@@ -706,9 +706,9 @@ namespace OpenSim.Region.Environment.Scenes
706 { 706 {
707 SubscribeToClientEvents(client); 707 SubscribeToClientEvents(client);
708 m_estateManager.sendRegionHandshake(client); 708 m_estateManager.sendRegionHandshake(client);
709 709
710 CreateAndAddScenePresence(client, child); 710 CreateAndAddScenePresence(client, child);
711 711
712 m_LandManager.sendParcelOverlay(client); 712 m_LandManager.sendParcelOverlay(client);
713 commsManager.UserProfiles.AddNewUser(client.AgentId); 713 commsManager.UserProfiles.AddNewUser(client.AgentId);
714 commsManager.TransactionsManager.AddUser(client.AgentId); 714 commsManager.TransactionsManager.AddUser(client.AgentId);
@@ -793,7 +793,7 @@ namespace OpenSim.Region.Environment.Scenes
793 MainLog.Instance.Verbose(RegionInfo.RegionName + ": Creating new root agent."); 793 MainLog.Instance.Verbose(RegionInfo.RegionName + ": Creating new root agent.");
794 MainLog.Instance.Verbose(RegionInfo.RegionName + ": Adding Physical agent."); 794 MainLog.Instance.Verbose(RegionInfo.RegionName + ": Adding Physical agent.");
795 795
796 newAvatar.AddToPhysicalScene( ); 796 newAvatar.AddToPhysicalScene();
797 } 797 }
798 798
799 lock (Entities) 799 lock (Entities)
@@ -835,14 +835,14 @@ namespace OpenSim.Region.Environment.Scenes
835 835
836 ForEachScenePresence( 836 ForEachScenePresence(
837 delegate(ScenePresence presence) 837 delegate(ScenePresence presence)
838 {
839 presence.CoarseLocationChange(avatar);
840 presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId);
841 if (presence.PhysActor != null)
838 { 842 {
839 presence.CoarseLocationChange(avatar); 843 phyScene.RemoveAvatar(presence.PhysActor);
840 presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId); 844 }
841 if (presence.PhysActor != null) 845 });
842 {
843 phyScene.RemoveAvatar(presence.PhysActor);
844 }
845 });
846 846
847 lock (Avatars) 847 lock (Avatars)
848 { 848 {
@@ -968,7 +968,7 @@ namespace OpenSim.Region.Environment.Scenes
968 if (ent is SceneObjectGroup) 968 if (ent is SceneObjectGroup)
969 { 969 {
970 // ((SceneObjectGroup)ent).SendFullUpdateToClient(client); 970 // ((SceneObjectGroup)ent).SendFullUpdateToClient(client);
971 ((SceneObjectGroup) ent).ScheduleFullUpdateToAvatar(presence); 971 ((SceneObjectGroup)ent).ScheduleFullUpdateToAvatar(presence);
972 } 972 }
973 } 973 }
974 } 974 }
@@ -1157,17 +1157,17 @@ namespace OpenSim.Region.Environment.Scenes
1157 1157
1158 public void RegisterModuleInterface<M>(M mod) 1158 public void RegisterModuleInterface<M>(M mod)
1159 { 1159 {
1160 if (!ModuleInterfaces.ContainsKey(typeof (M))) 1160 if (!ModuleInterfaces.ContainsKey(typeof(M)))
1161 { 1161 {
1162 ModuleInterfaces.Add(typeof (M), mod); 1162 ModuleInterfaces.Add(typeof(M), mod);
1163 } 1163 }
1164 } 1164 }
1165 1165
1166 public T RequestModuleInterface<T>() 1166 public T RequestModuleInterface<T>()
1167 { 1167 {
1168 if (ModuleInterfaces.ContainsKey(typeof (T))) 1168 if (ModuleInterfaces.ContainsKey(typeof(T)))
1169 { 1169 {
1170 return (T) ModuleInterfaces[typeof (T)]; 1170 return (T)ModuleInterfaces[typeof(T)];
1171 } 1171 }
1172 else 1172 else
1173 { 1173 {
@@ -1257,7 +1257,7 @@ namespace OpenSim.Region.Environment.Scenes
1257 { 1257 {
1258 if (ent is SceneObjectGroup) 1258 if (ent is SceneObjectGroup)
1259 { 1259 {
1260 ((SceneObjectGroup) ent).ScheduleGroupForFullUpdate(); 1260 ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate();
1261 } 1261 }
1262 } 1262 }
1263 } 1263 }
@@ -1269,7 +1269,7 @@ namespace OpenSim.Region.Environment.Scenes
1269 { 1269 {
1270 if (ent is SceneObjectGroup) 1270 if (ent is SceneObjectGroup)
1271 { 1271 {
1272 SceneObjectPart part = ((SceneObjectGroup) ent).GetChildPart(((SceneObjectGroup) ent).UUID); 1272 SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID);
1273 if (part != null) 1273 if (part != null)
1274 { 1274 {
1275 if (part.Name == cmmdparams[0]) 1275 if (part.Name == cmmdparams[0])
@@ -1357,10 +1357,10 @@ namespace OpenSim.Region.Environment.Scenes
1357 { 1357 {
1358 if (ent is SceneObjectGroup) 1358 if (ent is SceneObjectGroup)
1359 { 1359 {
1360 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); 1360 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
1361 if (hasPrim != false) 1361 if (hasPrim != false)
1362 { 1362 {
1363 return ((SceneObjectGroup) ent).GetPartsFullID(localID); 1363 return ((SceneObjectGroup)ent).GetPartsFullID(localID);
1364 } 1364 }
1365 } 1365 }
1366 } 1366 }
@@ -1374,10 +1374,10 @@ namespace OpenSim.Region.Environment.Scenes
1374 { 1374 {
1375 if (ent is SceneObjectGroup) 1375 if (ent is SceneObjectGroup)
1376 { 1376 {
1377 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(localID); 1377 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(localID);
1378 if (hasPrim != false) 1378 if (hasPrim != false)
1379 { 1379 {
1380 return ((SceneObjectGroup) ent).GetChildPart(localID); 1380 return ((SceneObjectGroup)ent).GetChildPart(localID);
1381 } 1381 }
1382 } 1382 }
1383 } 1383 }
@@ -1391,14 +1391,30 @@ namespace OpenSim.Region.Environment.Scenes
1391 { 1391 {
1392 if (ent is SceneObjectGroup) 1392 if (ent is SceneObjectGroup)
1393 { 1393 {
1394 hasPrim = ((SceneObjectGroup) ent).HasChildPrim(fullID); 1394 hasPrim = ((SceneObjectGroup)ent).HasChildPrim(fullID);
1395 if (hasPrim != false) 1395 if (hasPrim != false)
1396 { 1396 {
1397 return ((SceneObjectGroup) ent).GetChildPart(fullID); 1397 return ((SceneObjectGroup)ent).GetChildPart(fullID);
1398 } 1398 }
1399 } 1399 }
1400 } 1400 }
1401 return null; 1401 return null;
1402 } 1402 }
1403
1404 internal bool TryGetAvatar(LLUUID avatarId, out ScenePresence avatar)
1405 {
1406 ScenePresence presence;
1407 if (Avatars.TryGetValue(avatarId, out presence))
1408 {
1409 if (!presence.childAgent)
1410 {
1411 avatar = presence;
1412 return true;
1413 }
1414 }
1415
1416 avatar = null;
1417 return false;
1418 }
1403 } 1419 }
1404} \ No newline at end of file 1420} \ No newline at end of file
diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs
index effd4b2..0670fc7 100644
--- a/OpenSim/Region/Environment/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs
@@ -2,215 +2,230 @@ using System;
2using System.Collections.Generic; 2using System.Collections.Generic;
3using OpenSim.Framework.Console; 3using OpenSim.Framework.Console;
4using OpenSim.Framework.Types; 4using OpenSim.Framework.Types;
5using libsecondlife;
5 6
6namespace OpenSim.Region.Environment.Scenes 7namespace OpenSim.Region.Environment.Scenes
7{ 8{
8 public class SceneManager 9 public class SceneManager
9 { 10 {
10 private readonly List<Scene> m_localScenes; 11 private readonly List<Scene> m_localScenes;
11 private Scene m_currentScene = null; 12 private Scene m_currentScene = null;
12 13
13 public Scene CurrentScene 14 public Scene CurrentScene
14 { 15 {
15 get { return m_currentScene; } 16 get { return m_currentScene; }
16 } 17 }
17 18
18 private Scene CurrentOrFirstScene 19 public Scene CurrentOrFirstScene
19 { 20 {
20 get 21 get
21 { 22 {
22 if (m_currentScene == null) 23 if (m_currentScene == null)
23 { 24 {
24 return m_localScenes[0]; 25 return m_localScenes[0];
25 } 26 }
26 else 27 else
27 { 28 {
28 return m_currentScene; 29 return m_currentScene;
29 } 30 }
30 } 31 }
31 } 32 }
32 33
33 public SceneManager() 34 public SceneManager()
34 { 35 {
35 m_localScenes = new List<Scene>(); 36 m_localScenes = new List<Scene>();
36 } 37 }
37 38
38 public void Close() 39 public void Close()
39 { 40 {
40 for (int i = 0; i < m_localScenes.Count; i++) 41 for (int i = 0; i < m_localScenes.Count; i++)
41 { 42 {
42 m_localScenes[i].Close(); 43 m_localScenes[i].Close();
43 } 44 }
44 } 45 }
45 46
46 public void Add(Scene scene) 47 public void Add(Scene scene)
47 { 48 {
48 m_localScenes.Add(scene); 49 m_localScenes.Add(scene);
49 } 50 }
50 51
51 public void SavePrimsToXml(string filename) 52 public void SaveCurrentSceneToXml(string filename)
52 { 53 {
53 CurrentOrFirstScene.SavePrimsToXml(filename); 54 CurrentOrFirstScene.SavePrimsToXml(filename);
54 } 55 }
55 56
56 public void LoadPrimsFromXml(string filename) 57 public void LoadCurrentSceneFromXml(string filename)
57 { 58 {
58 CurrentOrFirstScene.LoadPrimsFromXml(filename); 59 CurrentOrFirstScene.LoadPrimsFromXml(filename);
59 } 60 }
60 61
61 public bool RunTerrainCmd(string[] cmdparams, ref string result) 62 public bool RunTerrainCmdOnCurrentScene(string[] cmdparams, ref string result)
62 { 63 {
63 if (m_currentScene == null) 64 if (m_currentScene == null)
64 { 65 {
65 bool success = true; 66 bool success = true;
66 foreach (Scene scene in m_localScenes) 67 foreach (Scene scene in m_localScenes)
67 { 68 {
68 if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName)) 69 if (!scene.Terrain.RunTerrainCmd(cmdparams, ref result, scene.RegionInfo.RegionName))
69 { 70 {
70 success = false; 71 success = false;
71 } 72 }
72 } 73 }
73 74
74 return success; 75 return success;
75 } 76 }
76 else 77 else
77 { 78 {
78 return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName); 79 return m_currentScene.Terrain.RunTerrainCmd(cmdparams, ref result, m_currentScene.RegionInfo.RegionName);
79 } 80 }
80 } 81 }
81 82
82 public void SendCommandToScripts(string[] cmdparams) 83 public void SendCommandToCurrentSceneScripts(string[] cmdparams)
83 { 84 {
84 ForEach(delegate(Scene scene) { scene.SendCommandToScripts(cmdparams); }); 85 ForEachCurrentScene(delegate(Scene scene) { scene.SendCommandToScripts(cmdparams); });
85 } 86 }
86 87
87 public void BypassPermissions(bool bypassPermissions) 88 public void SetBypassPermissionsOnCurrentScene(bool bypassPermissions)
88 { 89 {
89 ForEach(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; }); 90 ForEachCurrentScene(delegate(Scene scene) { scene.PermissionsMngr.BypassPermissions = bypassPermissions; });
90 } 91 }
91 92
92 private void ForEach(Action<Scene> func) 93 private void ForEachCurrentScene(Action<Scene> func)
93 { 94 {
94 if (m_currentScene == null) 95 if (m_currentScene == null)
95 { 96 {
96 m_localScenes.ForEach(func); 97 m_localScenes.ForEach(func);
97 } 98 }
98 else 99 else
99 { 100 {
100 func(m_currentScene); 101 func(m_currentScene);
101 } 102 }
102 } 103 }
103 104
104 public void Backup() 105 public void BackupCurrentScene()
105 { 106 {
106 ForEach(delegate(Scene scene) { scene.Backup(); }); 107 ForEachCurrentScene(delegate(Scene scene) { scene.Backup(); });
107 } 108 }
108 109
109 public void HandleAlertCommand(string[] cmdparams) 110 public void HandleAlertCommandOnCurrentScene(string[] cmdparams)
110 { 111 {
111 ForEach(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); }); 112 ForEachCurrentScene(delegate(Scene scene) { scene.HandleAlertCommand(cmdparams); });
112 } 113 }
113 114
114 public bool TrySetCurrentRegion(string regionName) 115 public bool TrySetCurrentScene(string regionName)
115 { 116 {
116 if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0)) 117 if ((String.Compare(regionName, "root") == 0) || (String.Compare(regionName, "..") == 0))
117 { 118 {
118 m_currentScene = null; 119 m_currentScene = null;
119 return true; 120 return true;
120 } 121 }
121 else 122 else
122 { 123 {
123 Console.WriteLine("Searching for Region: '" + regionName + "'"); 124 Console.WriteLine("Searching for Region: '" + regionName + "'");
124 125
125 foreach (Scene scene in m_localScenes) 126 foreach (Scene scene in m_localScenes)
126 { 127 {
127 if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0) 128 if (String.Compare(scene.RegionInfo.RegionName, regionName, true) == 0)
128 { 129 {
129 m_currentScene = scene; 130 m_currentScene = scene;
130 return true; 131 return true;
131 } 132 }
132 } 133 }
133 134
134 return false; 135 return false;
135 } 136 }
136 } 137 }
137 138
138 public void DebugPacket(LogBase log, int newDebug) 139 public void SetDebugPacketOnCurrentScene(LogBase log, int newDebug)
139 { 140 {
140 ForEach(delegate(Scene scene) 141 ForEachCurrentScene(delegate(Scene scene)
141 { 142 {
142 foreach (EntityBase entity in scene.Entities.Values) 143 foreach (EntityBase entity in scene.Entities.Values)
143 { 144 {
144 if (entity is ScenePresence) 145 if (entity is ScenePresence)
145 { 146 {
146 ScenePresence scenePrescence = entity as ScenePresence; 147 ScenePresence scenePrescence = entity as ScenePresence;
147 if (!scenePrescence.childAgent) 148 if (!scenePrescence.childAgent)
148 { 149 {
149 log.Error(String.Format("Packet debug for {0} {1} set to {2}", 150 log.Error(String.Format("Packet debug for {0} {1} set to {2}",
150 scenePrescence.Firstname, scenePrescence.Lastname, 151 scenePrescence.Firstname, scenePrescence.Lastname,
151 newDebug)); 152 newDebug));
152 153
153 scenePrescence.ControllingClient.SetDebug(newDebug); 154 scenePrescence.ControllingClient.SetDebug(newDebug);
154 } 155 }
155 } 156 }
156 } 157 }
157 }); 158 });
158 } 159 }
159 160
160 public List<ScenePresence> GetAvatars() 161 public List<ScenePresence> GetCurrentSceneAvatars()
161 { 162 {
162 List<ScenePresence> avatars = new List<ScenePresence>(); 163 List<ScenePresence> avatars = new List<ScenePresence>();
163 164
164 ForEach(delegate(Scene scene) 165 ForEachCurrentScene(delegate(Scene scene)
165 { 166 {
166 foreach (EntityBase entity in scene.Entities.Values) 167 foreach (EntityBase entity in scene.Entities.Values)
167 { 168 {
168 if (entity is ScenePresence) 169 if (entity is ScenePresence)
169 { 170 {
170 ScenePresence scenePrescence = entity as ScenePresence; 171 ScenePresence scenePrescence = entity as ScenePresence;
171 if (!scenePrescence.childAgent) 172 if (!scenePrescence.childAgent)
172 { 173 {
173 avatars.Add(scenePrescence); 174 avatars.Add(scenePrescence);
174 } 175 }
175 } 176 }
176 } 177 }
177 }); 178 });
178 179
179 return avatars; 180 return avatars;
180 } 181 }
181 182
182 public RegionInfo GetRegionInfo(ulong regionHandle) 183 public RegionInfo GetRegionInfo(ulong regionHandle)
183 { 184 {
184 foreach (Scene scene in m_localScenes) 185 foreach (Scene scene in m_localScenes)
185 { 186 {
186 if (scene.RegionInfo.RegionHandle == regionHandle) 187 if (scene.RegionInfo.RegionHandle == regionHandle)
187 { 188 {
188 return scene.RegionInfo; 189 return scene.RegionInfo;
189 } 190 }
190 } 191 }
191 192
192 return null; 193 return null;
193 } 194 }
194 195
195 public void SetTimePhase(int timePhase) 196 public void SetCurrentSceneTimePhase(int timePhase)
196 { 197 {
197 ForEach(delegate(Scene scene) 198 ForEachCurrentScene(delegate(Scene scene)
198 { 199 {
199 scene.SetTimePhase( 200 scene.SetTimePhase(
200 timePhase) 201 timePhase)
201 ; 202 ;
202 }); 203 });
203 } 204 }
204 205
205 206
206 public void ForceClientUpdate() 207 public void ForceCurrentSceneClientUpdate()
207 { 208 {
208 ForEach(delegate(Scene scene) { scene.ForceClientUpdate(); }); 209 ForEachCurrentScene(delegate(Scene scene) { scene.ForceClientUpdate(); });
209 } 210 }
210 211
211 public void HandleEditCommand(string[] cmdparams) 212 public void HandleEditCommandOnCurrentScene(string[] cmdparams)
212 { 213 {
213 ForEach(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); }); 214 ForEachCurrentScene(delegate(Scene scene) { scene.HandleEditCommand(cmdparams); });
214 } 215 }
215 } 216
217 public bool TryGetAvatar( LLUUID avatarId, out ScenePresence avatar )
218 {
219 foreach (Scene scene in m_localScenes)
220 {
221 if( scene.TryGetAvatar( avatarId, out avatar ))
222 {
223 return true;
224 }
225 }
226
227 avatar = null;
228 return false;
229 }
230 }
216} \ No newline at end of file 231} \ No newline at end of file