diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneManager.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/ScenePresence.cs | 82 |
3 files changed, 55 insertions, 42 deletions
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> |