diff options
author | lbsa71 | 2007-09-20 13:04:51 +0000 |
---|---|---|
committer | lbsa71 | 2007-09-20 13:04:51 +0000 |
commit | 7335e5710bd0c22c9e5bd9fa0b576d0985d2fba9 (patch) | |
tree | 866c1cf215fddc3404181c679783f903c925e000 /OpenSim/Region/Environment/Scenes | |
parent | * moved SceneManager to RegionApplicationBase (diff) | |
download | opensim-SC_OLD-7335e5710bd0c22c9e5bd9fa0b576d0985d2fba9.zip opensim-SC_OLD-7335e5710bd0c22c9e5bd9fa0b576d0985d2fba9.tar.gz opensim-SC_OLD-7335e5710bd0c22c9e5bd9fa0b576d0985d2fba9.tar.bz2 opensim-SC_OLD-7335e5710bd0c22c9e5bd9fa0b576d0985d2fba9.tar.xz |
Rev 1971 : The Lbsa71 vintage commit
* Refactored to prepare for some serious restructuring
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
5 files changed, 69 insertions, 70 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index efd682f..c63424a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -136,7 +136,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
136 | Entities.Add(copy.UUID, copy); | 136 | Entities.Add(copy.UUID, copy); |
137 | 137 | ||
138 | copy.ScheduleGroupForFullUpdate(); | 138 | copy.ScheduleGroupForFullUpdate(); |
139 | /* List<ScenePresence> avatars = this.RequestAvatarList(); | 139 | /* List<ScenePresence> avatars = this.GetScenePresences(); |
140 | for (int i = 0; i < avatars.Count; i++) | 140 | for (int i = 0; i < avatars.Count; i++) |
141 | { | 141 | { |
142 | // copy.SendAllChildPrimsToClient(avatars[i].ControllingClient); | 142 | // copy.SendAllChildPrimsToClient(avatars[i].ControllingClient); |
@@ -506,11 +506,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
506 | 506 | ||
507 | public void StartAnimation(IClientAPI client, LLUUID animID, int seq) | 507 | public void StartAnimation(IClientAPI client, LLUUID animID, int seq) |
508 | { | 508 | { |
509 | List<ScenePresence> avatars = RequestAvatarList(); | 509 | ForEachScenePresence(delegate(ScenePresence presence) |
510 | for (int i = 0; i < avatars.Count; i++) | 510 | { |
511 | { | 511 | presence.ControllingClient.SendAnimation(animID, seq, client.AgentId); |
512 | avatars[i].ControllingClient.SendAnimation(animID, seq, client.AgentId); | 512 | }); |
513 | } | ||
514 | } | 513 | } |
515 | 514 | ||
516 | public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) | 515 | public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient) |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index a542ab0..bdb8957 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -346,15 +346,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
346 | m_timeUpdateCount++; | 346 | m_timeUpdateCount++; |
347 | if (m_timeUpdateCount > 600) | 347 | if (m_timeUpdateCount > 600) |
348 | { | 348 | { |
349 | List<ScenePresence> Avatars = RequestAvatarList(); | 349 | List<ScenePresence> avatars = GetAvatars(); |
350 | foreach (ScenePresence avatar in Avatars) | 350 | foreach (ScenePresence avatar in avatars) |
351 | { | 351 | { |
352 | if (!avatar.childAgent) | 352 | avatar.ControllingClient.SendViewerTime(m_timePhase); |
353 | { | ||
354 | //Console.WriteLine("sending time update " + timePhase + " from region " + m_regionHandle + " to avatar " + avatar.Firstname); | ||
355 | avatar.ControllingClient.SendViewerTime(m_timePhase); | ||
356 | } | ||
357 | } | 353 | } |
354 | |||
358 | m_timeUpdateCount = 0; | 355 | m_timeUpdateCount = 0; |
359 | m_timePhase++; | 356 | m_timePhase++; |
360 | if (m_timePhase > 94) | 357 | if (m_timePhase > 94) |
@@ -831,7 +828,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
831 | { | 828 | { |
832 | m_eventManager.TriggerOnRemovePresence(agentID); | 829 | m_eventManager.TriggerOnRemovePresence(agentID); |
833 | 830 | ||
834 | ScenePresence avatar = RequestAvatar(agentID); | 831 | ScenePresence avatar = GetScenePresence(agentID); |
835 | 832 | ||
836 | ForEachScenePresence( | 833 | ForEachScenePresence( |
837 | delegate(ScenePresence presence) | 834 | delegate(ScenePresence presence) |
@@ -877,14 +874,19 @@ namespace OpenSim.Region.Environment.Scenes | |||
877 | /// Request a List of all Avatars in this World | 874 | /// Request a List of all Avatars in this World |
878 | /// </summary> | 875 | /// </summary> |
879 | /// <returns></returns> | 876 | /// <returns></returns> |
880 | public List<ScenePresence> RequestAvatarList() | 877 | public List<ScenePresence> GetScenePresences() |
881 | { | 878 | { |
882 | List<ScenePresence> result = new List<ScenePresence>(); | 879 | List<ScenePresence> result = new List<ScenePresence>(Avatars.Values); |
883 | 880 | ||
884 | foreach (ScenePresence avatar in Avatars.Values) | 881 | return result; |
885 | { | 882 | } |
886 | result.Add(avatar); | 883 | |
887 | } | 884 | public List<ScenePresence> GetAvatars() |
885 | { | ||
886 | List<ScenePresence> result = GetScenePresences(delegate(ScenePresence scenePresence) | ||
887 | { | ||
888 | return !scenePresence.childAgent; | ||
889 | }); | ||
888 | 890 | ||
889 | return result; | 891 | return result; |
890 | } | 892 | } |
@@ -893,7 +895,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
893 | /// Request a filtered list of Avatars in this World | 895 | /// Request a filtered list of Avatars in this World |
894 | /// </summary> | 896 | /// </summary> |
895 | /// <returns></returns> | 897 | /// <returns></returns> |
896 | public List<ScenePresence> RequestAvatarList(FilterAvatarList filter) | 898 | public List<ScenePresence> GetScenePresences(FilterAvatarList filter) |
897 | { | 899 | { |
898 | List<ScenePresence> result = new List<ScenePresence>(); | 900 | List<ScenePresence> result = new List<ScenePresence>(); |
899 | 901 | ||
@@ -913,7 +915,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
913 | /// </summary> | 915 | /// </summary> |
914 | /// <param name="avatarID"></param> | 916 | /// <param name="avatarID"></param> |
915 | /// <returns></returns> | 917 | /// <returns></returns> |
916 | public ScenePresence RequestAvatar(LLUUID avatarID) | 918 | public ScenePresence GetScenePresence(LLUUID avatarID) |
917 | { | 919 | { |
918 | if (Avatars.ContainsKey(avatarID)) | 920 | if (Avatars.ContainsKey(avatarID)) |
919 | { | 921 | { |
@@ -954,11 +956,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
954 | 956 | ||
955 | public void SendKillObject(uint localID) | 957 | public void SendKillObject(uint localID) |
956 | { | 958 | { |
957 | List<ScenePresence> avatars = RequestAvatarList(); | 959 | ForEachScenePresence(delegate(ScenePresence presence) |
958 | for (int i = 0; i < avatars.Count; i++) | 960 | { |
959 | { | 961 | presence.ControllingClient.SendKillObject(m_regionHandle, localID); |
960 | avatars[i].ControllingClient.SendKillObject(m_regionHandle, localID); | 962 | }); |
961 | } | ||
962 | } | 963 | } |
963 | 964 | ||
964 | public void SendAllSceneObjectsToClient(ScenePresence presence) | 965 | public void SendAllSceneObjectsToClient(ScenePresence presence) |
@@ -1419,7 +1420,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1419 | 1420 | ||
1420 | public override void Close() | 1421 | public override void Close() |
1421 | { | 1422 | { |
1422 | m_heartbeatTimer.Close(); | 1423 | m_heartbeatTimer.Close(); |
1423 | 1424 | ||
1424 | base.Close(); | 1425 | base.Close(); |
1425 | } | 1426 | } |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index 3182204..08c8d59 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -1055,9 +1055,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
1055 | /// | 1055 | /// |
1056 | /// </summary> | 1056 | /// </summary> |
1057 | /// <returns></returns> | 1057 | /// <returns></returns> |
1058 | public List<ScenePresence> RequestSceneAvatars() | 1058 | public List<ScenePresence> GetScenePresences() |
1059 | { | 1059 | { |
1060 | return m_scene.RequestAvatarList(); | 1060 | return m_scene.GetScenePresences(); |
1061 | } | 1061 | } |
1062 | 1062 | ||
1063 | #region Events | 1063 | #region Events |
@@ -1233,7 +1233,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1233 | DetachFromBackup(this); | 1233 | DetachFromBackup(this); |
1234 | foreach (SceneObjectPart part in m_parts.Values) | 1234 | foreach (SceneObjectPart part in m_parts.Values) |
1235 | { | 1235 | { |
1236 | List<ScenePresence> avatars = RequestSceneAvatars(); | 1236 | List<ScenePresence> avatars = GetScenePresences(); |
1237 | for (int i = 0; i < avatars.Count; i++) | 1237 | for (int i = 0; i < avatars.Count; i++) |
1238 | { | 1238 | { |
1239 | avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalID); | 1239 | avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalID); |
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index deacd18..468def0 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs | |||
@@ -678,7 +678,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
678 | 678 | ||
679 | public void AddFullUpdateToAllAvatars() | 679 | public void AddFullUpdateToAllAvatars() |
680 | { | 680 | { |
681 | List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars(); | 681 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); |
682 | for (int i = 0; i < avatars.Count; i++) | 682 | for (int i = 0; i < avatars.Count; i++) |
683 | { | 683 | { |
684 | avatars[i].AddFullPart(this); | 684 | avatars[i].AddFullPart(this); |
@@ -697,7 +697,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
697 | /// </summary> | 697 | /// </summary> |
698 | public void SendFullUpdateToAllClients() | 698 | public void SendFullUpdateToAllClients() |
699 | { | 699 | { |
700 | List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars(); | 700 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); |
701 | for (int i = 0; i < avatars.Count; i++) | 701 | for (int i = 0; i < avatars.Count; i++) |
702 | { | 702 | { |
703 | m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this); | 703 | m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this); |
@@ -742,7 +742,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
742 | /// Terse updates | 742 | /// Terse updates |
743 | public void AddTerseUpdateToAllAvatars() | 743 | public void AddTerseUpdateToAllAvatars() |
744 | { | 744 | { |
745 | List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars(); | 745 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); |
746 | for (int i = 0; i < avatars.Count; i++) | 746 | for (int i = 0; i < avatars.Count; i++) |
747 | { | 747 | { |
748 | avatars[i].AddTersePart(this); | 748 | avatars[i].AddTersePart(this); |
@@ -761,7 +761,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
761 | /// </summary> | 761 | /// </summary> |
762 | public void SendTerseUpdateToAllClients() | 762 | public void SendTerseUpdateToAllClients() |
763 | { | 763 | { |
764 | List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars(); | 764 | List<ScenePresence> avatars = m_parentGroup.GetScenePresences(); |
765 | for (int i = 0; i < avatars.Count; i++) | 765 | for (int i = 0; i < avatars.Count; i++) |
766 | { | 766 | { |
767 | m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this); | 767 | m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this); |
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index 811c962..538e46c 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs | |||
@@ -301,7 +301,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
301 | public void Teleport(LLVector3 pos) | 301 | public void Teleport(LLVector3 pos) |
302 | { | 302 | { |
303 | AbsolutePosition = pos; | 303 | AbsolutePosition = pos; |
304 | SendTerseUpdateToALLClients(); | 304 | SendTerseUpdateToAllClients(); |
305 | } | 305 | } |
306 | 306 | ||
307 | /// <summary> | 307 | /// <summary> |
@@ -473,7 +473,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
473 | /// check for user movement 'forces' (ie commands to move) | 473 | /// check for user movement 'forces' (ie commands to move) |
474 | if (newForce) | 474 | if (newForce) |
475 | { | 475 | { |
476 | SendTerseUpdateToALLClients(); | 476 | SendTerseUpdateToAllClients(); |
477 | _updateCount = 0; | 477 | _updateCount = 0; |
478 | } | 478 | } |
479 | 479 | ||
@@ -483,7 +483,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
483 | _updateCount++; | 483 | _updateCount++; |
484 | if (_updateCount > 3) | 484 | if (_updateCount > 3) |
485 | { | 485 | { |
486 | SendTerseUpdateToALLClients(); | 486 | SendTerseUpdateToAllClients(); |
487 | _updateCount = 0; | 487 | _updateCount = 0; |
488 | } | 488 | } |
489 | } | 489 | } |
@@ -491,7 +491,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
491 | /// check for physics-related movement | 491 | /// check for physics-related movement |
492 | else if (lastPhysPos.GetDistanceTo(AbsolutePosition) > 0.02) | 492 | else if (lastPhysPos.GetDistanceTo(AbsolutePosition) > 0.02) |
493 | { | 493 | { |
494 | SendTerseUpdateToALLClients(); | 494 | SendTerseUpdateToAllClients(); |
495 | _updateCount = 0; | 495 | _updateCount = 0; |
496 | lastPhysPos = AbsolutePosition; | 496 | lastPhysPos = AbsolutePosition; |
497 | } | 497 | } |
@@ -524,27 +524,27 @@ namespace OpenSim.Region.Environment.Scenes | |||
524 | /// <summary> | 524 | /// <summary> |
525 | /// | 525 | /// |
526 | /// </summary> | 526 | /// </summary> |
527 | public void SendTerseUpdateToALLClients() | 527 | public void SendTerseUpdateToAllClients() |
528 | { | 528 | { |
529 | List<ScenePresence> avatars = m_scene.RequestAvatarList(); | 529 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) |
530 | for (int i = 0; i < avatars.Count; i++) | 530 | { |
531 | { | 531 | SendTerseUpdateToClient(presence.ControllingClient); |
532 | SendTerseUpdateToClient(avatars[i].ControllingClient); | 532 | }); |
533 | } | ||
534 | } | 533 | } |
535 | 534 | ||
536 | 535 | ||
537 | public void SendCoarseLocations() | 536 | public void SendCoarseLocations() |
538 | { | 537 | { |
539 | List<LLVector3> CoarseLocations = new List<LLVector3>(); | 538 | List<LLVector3> CoarseLocations = new List<LLVector3>(); |
540 | List<ScenePresence> avatars = m_scene.RequestAvatarList(); | 539 | List<ScenePresence> avatars = m_scene.GetAvatars(); |
541 | for (int i = 0; i < avatars.Count; i++) | 540 | for (int i = 0; i < avatars.Count; i++) |
542 | { | 541 | { |
543 | if (avatars[i] != this && (!avatars[i].childAgent)) | 542 | if (avatars[i] != this ) |
544 | { | 543 | { |
545 | CoarseLocations.Add(avatars[i].AbsolutePosition); | 544 | CoarseLocations.Add(avatars[i].AbsolutePosition); |
546 | } | 545 | } |
547 | } | 546 | } |
547 | |||
548 | ControllingClient.SendCoarseLocationUpdate(CoarseLocations); | 548 | ControllingClient.SendCoarseLocationUpdate(CoarseLocations); |
549 | } | 549 | } |
550 | 550 | ||
@@ -555,14 +555,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
555 | 555 | ||
556 | private void NotifyMyCoarseLocationChange() | 556 | private void NotifyMyCoarseLocationChange() |
557 | { | 557 | { |
558 | List<ScenePresence> avatars = m_scene.RequestAvatarList(); | 558 | m_scene.ForEachScenePresence(delegate(ScenePresence presence) |
559 | for (int i = 0; i < avatars.Count; i++) | 559 | { |
560 | { | 560 | if (presence != this) |
561 | if (avatars[i] != this) | 561 | { |
562 | { | 562 | presence.CoarseLocationChange(this); |
563 | avatars[i].CoarseLocationChange(this); | 563 | } |
564 | } | 564 | }); |
565 | } | ||
566 | } | 565 | } |
567 | 566 | ||
568 | 567 | ||
@@ -576,10 +575,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
576 | LocalId, AbsolutePosition, m_textureEntry.ToBytes()); | 575 | LocalId, AbsolutePosition, m_textureEntry.ToBytes()); |
577 | } | 576 | } |
578 | 577 | ||
579 | public void SendFullUpdateToALLClients() | 578 | public void SendFullUpdateToAllClients() |
580 | { | 579 | { |
581 | List<ScenePresence> avatars = m_scene.RequestAvatarList(); | 580 | List<ScenePresence> avatars = m_scene.GetScenePresences(); |
582 | foreach (ScenePresence avatar in m_scene.RequestAvatarList()) | 581 | foreach (ScenePresence avatar in avatars) |
583 | { | 582 | { |
584 | SendFullUpdateToOtherClient(avatar); | 583 | SendFullUpdateToOtherClient(avatar); |
585 | if (avatar.LocalId != LocalId) | 584 | if (avatar.LocalId != LocalId) |
@@ -606,7 +605,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
606 | newAvatar = false; | 605 | newAvatar = false; |
607 | } | 606 | } |
608 | 607 | ||
609 | SendFullUpdateToALLClients(); | 608 | SendFullUpdateToAllClients(); |
610 | SendArrearanceToAllOtherAgents(); | 609 | SendArrearanceToAllOtherAgents(); |
611 | } | 610 | } |
612 | 611 | ||
@@ -618,7 +617,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
618 | { | 617 | { |
619 | ControllingClient.SendWearables(Wearables); | 618 | ControllingClient.SendWearables(Wearables); |
620 | 619 | ||
621 | //this.SendFullUpdateToALLClients(); | 620 | //this.SendFullUpdateToAllClients(); |
622 | //this.SendArrearanceToAllOtherAgents(); | 621 | //this.SendArrearanceToAllOtherAgents(); |
623 | 622 | ||
624 | m_scene.SendAllSceneObjectsToClient(this); | 623 | m_scene.SendAllSceneObjectsToClient(this); |
@@ -640,11 +639,10 @@ namespace OpenSim.Region.Environment.Scenes | |||
640 | /// </summary> | 639 | /// </summary> |
641 | public void SendArrearanceToAllOtherAgents() | 640 | public void SendArrearanceToAllOtherAgents() |
642 | { | 641 | { |
643 | List<ScenePresence> avatars = m_scene.RequestAvatarList(); | 642 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
644 | foreach (ScenePresence avatar in m_scene.RequestAvatarList()) | 643 | { |
645 | { | 644 | SendAppearanceToOtherAgent(scenePresence); |
646 | SendAppearanceToOtherAgent(avatar); | 645 | }); |
647 | } | ||
648 | } | 646 | } |
649 | 647 | ||
650 | /// <summary> | 648 | /// <summary> |
@@ -666,11 +664,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
666 | { | 664 | { |
667 | current_anim = animID; | 665 | current_anim = animID; |
668 | anim_seq = seq; | 666 | anim_seq = seq; |
669 | List<ScenePresence> avatars = m_scene.RequestAvatarList(); | 667 | |
670 | for (int i = 0; i < avatars.Count; i++) | 668 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
671 | { | 669 | { |
672 | avatars[i].ControllingClient.SendAnimation(animID, seq, ControllingClient.AgentId); | 670 | scenePresence.ControllingClient.SendAnimation(animID, seq, |
673 | } | 671 | ControllingClient.AgentId); |
672 | }); | ||
674 | } | 673 | } |
675 | 674 | ||
676 | /// <summary> | 675 | /// <summary> |