From 34043cd35143a25fb48412026b3a6ccb2c030255 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Fri, 21 Sep 2007 06:00:34 +0000 Subject: * Slowly but surely working my way towards Regionality... --- .../Environment/Scenes/Scene.PacketHandlers.cs | 10 ++-- OpenSim/Region/Environment/Scenes/Scene.cs | 17 ++++-- OpenSim/Region/Environment/Scenes/ScenePresence.cs | 61 +++++++++------------- 3 files changed, 44 insertions(+), 44 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 91b9634..43a9d86 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs @@ -504,12 +504,12 @@ namespace OpenSim.Region.Environment.Scenes } } - public void StartAnimation(IClientAPI client, LLUUID animID, int seq) + public void StartAnimation(LLUUID animID, int seq, LLUUID agentId) { - ForEachScenePresence(delegate(ScenePresence presence) - { - presence.ControllingClient.SendAnimation(animID, seq, client.AgentId); - }); + Broadcast(delegate(IClientAPI client) + { + client.SendAnimation(animID, seq, agentId); + }); } 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 ab52ebf..adf501e 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -367,6 +367,10 @@ namespace OpenSim.Region.Environment.Scenes updateLock.ReleaseMutex(); } + /// + /// Perform delegate action on all clients subscribing to updates from this region. + /// + /// internal void Broadcast(Action whatToDo) { m_region.Broadcast(whatToDo); @@ -775,7 +779,6 @@ namespace OpenSim.Region.Environment.Scenes client.SendKillObject(avatar.RegionHandle, avatar.LocalId); }); - ForEachScenePresence( delegate(ScenePresence presence) { @@ -898,12 +901,20 @@ namespace OpenSim.Region.Environment.Scenes public void SendKillObject(uint localID) { - ForEachScenePresence(delegate(ScenePresence presence) + Broadcast(delegate(IClientAPI client) { - presence.ControllingClient.SendKillObject(m_regionHandle, localID); + client.SendKillObject(m_regionHandle, localID); }); } + public void NotifyMyCoarseLocationChange() + { + ForEachScenePresence(delegate(ScenePresence presence) + { + presence.CoarseLocationChange(); + }); + } + public void SendAllSceneObjectsToClient(ScenePresence presence) { foreach (EntityBase ent in Entities.Values) diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs index d70752d..fa37b9f 100644 --- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs @@ -60,8 +60,8 @@ namespace OpenSim.Region.Environment.Scenes public bool IsRestrictedToRegion = false; private bool m_newForce = false; - private bool newAvatar = false; - private bool newCoarseLocations = true; + private bool m_newAvatar = false; + private bool m_newCoarseLocations = true; protected RegionInfo m_regionInfo; protected ulong crossingFromRegion = 0; @@ -279,7 +279,7 @@ namespace OpenSim.Region.Environment.Scenes //temporary until we move some code into the body classes - if (newAvatar) + if (m_newAvatar) { //do we need to use newAvatar? not sure so have added this to kill the compile warning } @@ -338,7 +338,7 @@ namespace OpenSim.Region.Environment.Scenes public void MakeAvatarPhysical(LLVector3 pos, bool isFlying) { - newAvatar = true; + m_newAvatar = true; m_isChildAgent = false; AbsolutePosition = pos; @@ -402,7 +402,7 @@ namespace OpenSim.Region.Environment.Scenes visualParams[i] = visualParam[i].ParamValue; } - SendArrearanceToAllOtherAgents(); + SendAppearanceToAllOtherAgents(); } /// @@ -541,10 +541,10 @@ namespace OpenSim.Region.Environment.Scenes { SendPrimUpdates(); - if (newCoarseLocations) + if (m_newCoarseLocations) { SendCoarseLocations(); - newCoarseLocations = false; + m_newCoarseLocations = false; } if (m_isChildAgent == false) @@ -605,13 +605,9 @@ namespace OpenSim.Region.Environment.Scenes /// public void SendTerseUpdateToAllClients() { - m_scene.ForEachScenePresence(delegate(ScenePresence presence) - { - SendTerseUpdateToClient(presence.m_controllingClient); - }); + m_scene.Broadcast( SendTerseUpdateToClient ); } - public void SendCoarseLocations() { List CoarseLocations = new List(); @@ -629,19 +625,10 @@ namespace OpenSim.Region.Environment.Scenes public void CoarseLocationChange() { - newCoarseLocations = true; + m_newCoarseLocations = true; } - private void NotifyMyCoarseLocationChange() - { - m_scene.ForEachScenePresence(delegate(ScenePresence presence) - { - if (presence != this) - { - presence.CoarseLocationChange(); - } - }); - } + /// @@ -681,11 +668,11 @@ namespace OpenSim.Region.Environment.Scenes if (!m_isChildAgent) { m_scene.InformClientOfNeighbours(m_controllingClient); - newAvatar = false; + m_newAvatar = false; } SendFullUpdateToAllClients(); - SendArrearanceToAllOtherAgents(); + SendAppearanceToAllOtherAgents(); } /// @@ -697,7 +684,7 @@ namespace OpenSim.Region.Environment.Scenes m_controllingClient.SendWearables(Wearables); //this.SendFullUpdateToAllClients(); - //this.SendArrearanceToAllOtherAgents(); + //this.SendAppearanceToAllOtherAgents(); m_scene.SendAllSceneObjectsToClient(this); m_controllingClient.SendViewerTime(m_scene.TimePhase); @@ -716,11 +703,14 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void SendArrearanceToAllOtherAgents() + public void SendAppearanceToAllOtherAgents() { m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) { - SendAppearanceToOtherAgent(scenePresence); + if (scenePresence != this) + { + SendAppearanceToOtherAgent(scenePresence); + } }); } @@ -743,12 +733,12 @@ namespace OpenSim.Region.Environment.Scenes { CurrentAnimation = animID; AnimationSeq = seq; + LLUUID sourceAgentId = m_controllingClient.AgentId; - m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) - { - scenePresence.m_controllingClient.SendAnimation(animID, seq, - m_controllingClient.AgentId); - }); + m_scene.Broadcast(delegate(IClientAPI client) + { + client.SendAnimation(animID, seq, sourceAgentId); + }); } /// @@ -771,7 +761,7 @@ namespace OpenSim.Region.Environment.Scenes if (OnSignificantClientMovement != null) { OnSignificantClientMovement(m_controllingClient); - NotifyMyCoarseLocationChange(); + m_scene.NotifyMyCoarseLocationChange(); } } } @@ -845,14 +835,13 @@ namespace OpenSim.Region.Environment.Scenes m_physicsActor.Flying); if (res) { - //TODO: following line is hard coded to port 9000, really need to change this as soon as possible AgentCircuitData circuitdata = m_controllingClient.RequestClientInfo(); string capsPath = Util.GetCapsURL(m_controllingClient.AgentId); m_controllingClient.CrossRegion(neighbourHandle, newpos, vel, neighbourRegion.ExternalEndPoint, capsPath); MakeChildAgent(); m_scene.SendKillObject(m_localId); - NotifyMyCoarseLocationChange(); + m_scene.NotifyMyCoarseLocationChange(); } } } -- cgit v1.1