aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs70
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneManager.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
6 files changed, 48 insertions, 56 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index cd5ac6c..1a3e3bb 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1460,12 +1460,10 @@ namespace OpenSim.Region.Framework.Scenes
1460 /// <param name="stats">Stats on the Simulator's performance</param> 1460 /// <param name="stats">Stats on the Simulator's performance</param>
1461 private void SendSimStatsPackets(SimStats stats) 1461 private void SendSimStatsPackets(SimStats stats)
1462 { 1462 {
1463 ForEachRootScenePresence( 1463 ForEachRootClient(delegate(IClientAPI client)
1464 delegate(ScenePresence agent) 1464 {
1465 { 1465 client.SendSimStats(stats);
1466 agent.ControllingClient.SendSimStats(stats); 1466 });
1467 }
1468 );
1469 } 1467 }
1470 1468
1471 /// <summary> 1469 /// <summary>
@@ -4387,35 +4385,32 @@ namespace OpenSim.Region.Framework.Scenes
4387 return m_sceneGraph.GetScenePresence(localID); 4385 return m_sceneGraph.GetScenePresence(localID);
4388 } 4386 }
4389 4387
4388 /// <summary>
4389 /// Returns true if scene presence is a child (no avatar in this scene)
4390 /// </summary>
4391 /// <param name="avatarID"></param>
4392 /// <returns></returns>
4390 public override bool PresenceChildStatus(UUID avatarID) 4393 public override bool PresenceChildStatus(UUID avatarID)
4391 { 4394 {
4392 ScenePresence cp = GetScenePresence(avatarID); 4395 ScenePresence sp;
4393 4396 return TryGetScenePresence(avatarID, out sp) && sp.IsChildAgent;
4394 // FIXME: This is really crap - some logout code is relying on a NullReferenceException to halt its processing
4395 // This needs to be fixed properly by cleaning up the logout code.
4396 //if (cp != null)
4397 // return cp.IsChildAgent;
4398
4399 //return false;
4400
4401 return cp.IsChildAgent;
4402 } 4397 }
4403 4398
4404 /// <summary> 4399 /// <summary>
4405 /// Performs action on all ROOT (not child) scene presences. 4400 /// Performs action on all avatars in the scene (root scene presences)
4406 /// This is just a shortcut function since frequently actions only appy to root SPs 4401 /// Avatars may be an NPC or a 'real' client.
4407 /// </summary> 4402 /// </summary>
4408 /// <param name="action"></param> 4403 /// <param name="action"></param>
4409 public void ForEachRootScenePresence(Action<ScenePresence> action) 4404 public void ForEachRootScenePresence(Action<ScenePresence> action)
4410 { 4405 {
4411 if(m_sceneGraph != null) 4406 if(m_sceneGraph != null)
4412 { 4407 {
4413 m_sceneGraph.ForEachRootScenePresence(action); 4408 m_sceneGraph.ForEachAvatar(action);
4414 } 4409 }
4415 } 4410 }
4416 4411
4417 /// <summary> 4412 /// <summary>
4418 /// Performs action on all scene presences. 4413 /// Performs action on all scene presences (root and child)
4419 /// </summary> 4414 /// </summary>
4420 /// <param name="action"></param> 4415 /// <param name="action"></param>
4421 public void ForEachScenePresence(Action<ScenePresence> action) 4416 public void ForEachScenePresence(Action<ScenePresence> action)
@@ -4427,25 +4422,6 @@ namespace OpenSim.Region.Framework.Scenes
4427 } 4422 }
4428 4423
4429 /// <summary> 4424 /// <summary>
4430 /// Perform the given action for each object
4431 /// </summary>
4432 /// <param name="action"></param>
4433 // public void ForEachObject(Action<SceneObjectGroup> action)
4434 // {
4435 // List<SceneObjectGroup> presenceList;
4436 //
4437 // lock (m_sceneObjects)
4438 // {
4439 // presenceList = new List<SceneObjectGroup>(m_sceneObjects.Values);
4440 // }
4441 //
4442 // foreach (SceneObjectGroup presence in presenceList)
4443 // {
4444 // action(presence);
4445 // }
4446 // }
4447
4448 /// <summary>
4449 /// Get a group via its UUID 4425 /// Get a group via its UUID
4450 /// </summary> 4426 /// </summary>
4451 /// <param name="fullID"></param> 4427 /// <param name="fullID"></param>
@@ -4517,6 +4493,22 @@ namespace OpenSim.Region.Framework.Scenes
4517 return m_sceneGraph.TryGetAvatarByName(avatarName, out avatar); 4493 return m_sceneGraph.TryGetAvatarByName(avatarName, out avatar);
4518 } 4494 }
4519 4495
4496 /// <summary>
4497 /// Perform an action on all clients with an avatar in this scene (root only)
4498 /// </summary>
4499 /// <param name="action"></param>
4500 public void ForEachRootClient(Action<IClientAPI> action)
4501 {
4502 ForEachRootScenePresence(delegate(ScenePresence presence)
4503 {
4504 action(presence.ControllingClient);
4505 });
4506 }
4507
4508 /// <summary>
4509 /// Perform an action on all clients connected to the region (root and child)
4510 /// </summary>
4511 /// <param name="action"></param>
4520 public void ForEachClient(Action<IClientAPI> action) 4512 public void ForEachClient(Action<IClientAPI> action)
4521 { 4513 {
4522 m_clientManager.ForEachSync(action); 4514 m_clientManager.ForEachSync(action);
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index e1fde64..d780fb3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1265,7 +1265,7 @@ namespace OpenSim.Region.Framework.Scenes
1265 /// This is just a shortcut function since frequently actions only appy to root SPs 1265 /// This is just a shortcut function since frequently actions only appy to root SPs
1266 /// </summary> 1266 /// </summary>
1267 /// <param name="action"></param> 1267 /// <param name="action"></param>
1268 public void ForEachRootScenePresence(Action<ScenePresence> action) 1268 public void ForEachAvatar(Action<ScenePresence> action)
1269 { 1269 {
1270 ForEachScenePresence(delegate(ScenePresence sp) 1270 ForEachScenePresence(delegate(ScenePresence sp)
1271 { 1271 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs
index 3bfd866..eeb087f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneManager.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs
@@ -458,16 +458,16 @@ namespace OpenSim.Region.Framework.Scenes
458 ForEachCurrentScene( 458 ForEachCurrentScene(
459 delegate(Scene scene) 459 delegate(Scene scene)
460 { 460 {
461 scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) 461 scene.ForEachRootClient(delegate(IClientAPI client)
462 { 462 {
463 if (name == null || scenePresence.Name == name) 463 if (name == null || client.Name == name)
464 { 464 {
465 m_log.DebugFormat("Packet debug for {0} {1} set to {2}", 465 m_log.DebugFormat("Packet debug for {0} {1} set to {2}",
466 scenePresence.Firstname, 466 client.FirstName,
467 scenePresence.Lastname, 467 client.LastName,
468 newDebug); 468 newDebug);
469 469
470 scenePresence.ControllingClient.DebugPacketLevel = newDebug; 470 client.DebugPacketLevel = newDebug;
471 } 471 }
472 }); 472 });
473 } 473 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 6204b4f..84d0e71 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1473,7 +1473,7 @@ namespace OpenSim.Region.Framework.Scenes
1473 { 1473 {
1474 SceneObjectPart part = parts[i]; 1474 SceneObjectPart part = parts[i];
1475 1475
1476 Scene.ForEachScenePresence(delegate(ScenePresence avatar) 1476 Scene.ForEachRootScenePresence(delegate(ScenePresence avatar)
1477 { 1477 {
1478 if (avatar.ParentID == LocalId) 1478 if (avatar.ParentID == LocalId)
1479 avatar.StandUp(); 1479 avatar.StandUp();
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 948518a..c8f28c7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1025,7 +1025,7 @@ namespace OpenSim.Region.Framework.Scenes
1025 public PrimitiveBaseShape Shape 1025 public PrimitiveBaseShape Shape
1026 { 1026 {
1027 get { return m_shape; } 1027 get { return m_shape; }
1028 set { m_shape = value; } 1028 set { m_shape = value;}
1029 } 1029 }
1030 1030
1031 /// <summary> 1031 /// <summary>
@@ -1389,12 +1389,12 @@ namespace OpenSim.Region.Framework.Scenes
1389 /// <param name="AgentID"></param> 1389 /// <param name="AgentID"></param>
1390 private void SendRootPartPropertiesToClient(UUID AgentID) 1390 private void SendRootPartPropertiesToClient(UUID AgentID)
1391 { 1391 {
1392 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) 1392 m_parentGroup.Scene.ForEachClient(delegate(IClientAPI client)
1393 { 1393 {
1394 // Ugly reference :( 1394 // Ugly reference :(
1395 if (avatar.UUID == AgentID) 1395 if (client.AgentId == AgentID)
1396 { 1396 {
1397 m_parentGroup.SendPropertiesToClient(avatar.ControllingClient); 1397 m_parentGroup.SendPropertiesToClient(client);
1398 } 1398 }
1399 }); 1399 });
1400 } 1400 }
@@ -1514,9 +1514,9 @@ namespace OpenSim.Region.Framework.Scenes
1514 if (volume < 0) 1514 if (volume < 0)
1515 volume = 0; 1515 volume = 0;
1516 1516
1517 m_parentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence sp) 1517 m_parentGroup.Scene.ForEachRootClient(delegate(IClientAPI client)
1518 { 1518 {
1519 sp.ControllingClient.SendAttachedSoundGainChange(UUID, (float)volume); 1519 client.SendAttachedSoundGainChange(UUID, (float)volume);
1520 }); 1520 });
1521 } 1521 }
1522 1522
@@ -2270,7 +2270,7 @@ namespace OpenSim.Region.Framework.Scenes
2270 } 2270 }
2271 else 2271 else
2272 { 2272 {
2273 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence av) 2273 m_parentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence av)
2274 { 2274 {
2275 if (av.LocalId == localId) 2275 if (av.LocalId == localId)
2276 { 2276 {
@@ -2401,7 +2401,7 @@ namespace OpenSim.Region.Framework.Scenes
2401 } 2401 }
2402 else 2402 else
2403 { 2403 {
2404 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence av) 2404 m_parentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence av)
2405 { 2405 {
2406 if (av.LocalId == localId) 2406 if (av.LocalId == localId)
2407 { 2407 {
@@ -2524,7 +2524,7 @@ namespace OpenSim.Region.Framework.Scenes
2524 } 2524 }
2525 else 2525 else
2526 { 2526 {
2527 m_parentGroup.Scene.ForEachScenePresence(delegate(ScenePresence av) 2527 m_parentGroup.Scene.ForEachRootScenePresence(delegate(ScenePresence av)
2528 { 2528 {
2529 if (av.LocalId == localId) 2529 if (av.LocalId == localId)
2530 { 2530 {
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index aa1c15e..9bf5bea 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1072,7 +1072,7 @@ namespace OpenSim.Region.Framework.Scenes
1072 } 1072 }
1073 1073
1074 // send the animations of the other presences to me 1074 // send the animations of the other presences to me
1075 m_scene.ForEachScenePresence(delegate(ScenePresence presence) 1075 m_scene.ForEachRootScenePresence(delegate(ScenePresence presence)
1076 { 1076 {
1077 if (presence != this) 1077 if (presence != this)
1078 presence.Animator.SendAnimPackToClient(ControllingClient); 1078 presence.Animator.SendAnimPackToClient(ControllingClient);