From 5fab795bf0fd3fe794e4635fc28b295963cfbb9e Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Fri, 21 Sep 2007 05:23:17 +0000 Subject: * Continued work on Region layer * Added Close() to ScenePresence to remove and destroy PhysicsActor --- OpenSim/Region/Environment/Scenes/Scene.cs | 40 ++++++++++++++++-------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 1e19c30..ab52ebf 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -307,7 +307,7 @@ namespace OpenSim.Region.Environment.Scenes float[] terData = Terrain.GetHeights1D(); - Broadcast( delegate( IClientAPI client ) + Broadcast(delegate(IClientAPI client) { for (int x = 0; x < 16; x++) { @@ -321,7 +321,7 @@ namespace OpenSim.Region.Environment.Scenes } }); - + Terrain.ResetTaint(); } @@ -369,7 +369,7 @@ namespace OpenSim.Region.Environment.Scenes internal void Broadcast(Action whatToDo) { - m_region.Broadcast( whatToDo ); + m_region.Broadcast(whatToDo); } /// /// @@ -641,6 +641,7 @@ namespace OpenSim.Region.Environment.Scenes public override void AddNewClient(IClientAPI client, bool child) { SubscribeToClientEvents(client); + m_estateManager.sendRegionHandshake(client); CreateAndAddScenePresence(client, child); @@ -769,33 +770,34 @@ namespace OpenSim.Region.Environment.Scenes ScenePresence avatar = GetScenePresence(agentID); + Broadcast(delegate(IClientAPI client) + { + client.SendKillObject(avatar.RegionHandle, avatar.LocalId); + }); + + ForEachScenePresence( delegate(ScenePresence presence) { - presence.CoarseLocationChange(avatar); - presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId); - if (presence.PhysicsActor != null) - { - phyScene.RemoveAvatar(presence.PhysicsActor); - presence.PhysicsActor = null; - } + presence.CoarseLocationChange(); }); lock (m_scenePresences) { - if (m_scenePresences.ContainsKey(agentID)) - { - m_scenePresences.Remove(agentID); - } + m_scenePresences.Remove(agentID); + } + + lock (m_region) + { + m_region.Remove(agentID); } + lock (Entities) { - if (Entities.ContainsKey(agentID)) - { - Entities.Remove(agentID); - } + Entities.Remove(agentID); } - // TODO: Add the removal from physics ? + + avatar.Close(); // Remove client agent from profile, so new logins will work commsManager.UserServer.clearUserAgent(agentID); -- cgit v1.1