* Continued work on Region layer

* Added Close() to ScenePresence to remove and destroy PhysicsActor
afrisby
lbsa71 2007-09-21 05:23:17 +00:00
parent e4a78a9b30
commit 5fab795bf0
5 changed files with 59 additions and 45 deletions

View File

@ -341,10 +341,9 @@ namespace OpenSim.Region.Environment
public void sendRegionHandshakeToAll() public void sendRegionHandshakeToAll()
{ {
m_scene.ForEachScenePresence( delegate( ScenePresence scenePresence ) m_scene.Broadcast(
{ sendRegionHandshake
sendRegionHandshake(scenePresence.ControllingClient); );
});
} }
public void sendRegionInfoPacket(IClientAPI remote_client) public void sendRegionInfoPacket(IClientAPI remote_client)

View File

@ -40,5 +40,10 @@ namespace OpenSim.Region.Environment.Regions
whatToDo(subscription.Client); whatToDo(subscription.Client);
} }
} }
internal void Remove(LLUUID agentID)
{
// TODO : Well, remove it!
}
} }
} }

View File

@ -641,6 +641,7 @@ namespace OpenSim.Region.Environment.Scenes
public override void AddNewClient(IClientAPI client, bool child) public override void AddNewClient(IClientAPI client, bool child)
{ {
SubscribeToClientEvents(client); SubscribeToClientEvents(client);
m_estateManager.sendRegionHandshake(client); m_estateManager.sendRegionHandshake(client);
CreateAndAddScenePresence(client, child); CreateAndAddScenePresence(client, child);
@ -769,33 +770,34 @@ namespace OpenSim.Region.Environment.Scenes
ScenePresence avatar = GetScenePresence(agentID); ScenePresence avatar = GetScenePresence(agentID);
Broadcast(delegate(IClientAPI client)
{
client.SendKillObject(avatar.RegionHandle, avatar.LocalId);
});
ForEachScenePresence( ForEachScenePresence(
delegate(ScenePresence presence) delegate(ScenePresence presence)
{ {
presence.CoarseLocationChange(avatar); presence.CoarseLocationChange();
presence.ControllingClient.SendKillObject(avatar.RegionHandle, avatar.LocalId);
if (presence.PhysicsActor != null)
{
phyScene.RemoveAvatar(presence.PhysicsActor);
presence.PhysicsActor = null;
}
}); });
lock (m_scenePresences) lock (m_scenePresences)
{
if (m_scenePresences.ContainsKey(agentID))
{ {
m_scenePresences.Remove(agentID); m_scenePresences.Remove(agentID);
} }
}
lock (Entities) lock (m_region)
{ {
if (Entities.ContainsKey(agentID)) m_region.Remove(agentID);
}
lock (Entities)
{ {
Entities.Remove(agentID); Entities.Remove(agentID);
} }
}
// TODO: Add the removal from physics ? avatar.Close();
// Remove client agent from profile, so new logins will work // Remove client agent from profile, so new logins will work
commsManager.UserServer.clearUserAgent(agentID); commsManager.UserServer.clearUserAgent(agentID);

View File

@ -45,8 +45,8 @@ namespace OpenSim.Region.Environment.Scenes
public void LoadAnims() public void LoadAnims()
{ {
//OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations"); //OpenSim.Framework.Console.MainLog.Instance.Verbose("Avatar.cs:LoadAnims() - Loading avatar animations");
XmlTextReader reader = new XmlTextReader("data/avataranimations.xml"); using( XmlTextReader reader = new XmlTextReader("data/avataranimations.xml") )
{
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.Load(reader); doc.Load(reader);
foreach (XmlNode nod in doc.DocumentElement.ChildNodes) foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
@ -56,8 +56,7 @@ namespace OpenSim.Region.Environment.Scenes
AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText); AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText);
} }
} }
}
reader.Close();
// OpenSim.Framework.Console.MainLog.Instance.Verbose("Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)"); // OpenSim.Framework.Console.MainLog.Instance.Verbose("Loaded " + AnimsLLUUID.Count.ToString() + " animation(s)");
@ -67,5 +66,14 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
} }
internal void Close()
{
if (m_physicsActor != null)
{
m_scene.PhysScene.RemoveAvatar( PhysicsActor );
m_physicsActor = null;
}
}
} }
} }

View File

@ -627,7 +627,7 @@ namespace OpenSim.Region.Environment.Scenes
m_controllingClient.SendCoarseLocationUpdate(CoarseLocations); m_controllingClient.SendCoarseLocationUpdate(CoarseLocations);
} }
public void CoarseLocationChange(ScenePresence avatar) public void CoarseLocationChange()
{ {
newCoarseLocations = true; newCoarseLocations = true;
} }
@ -638,7 +638,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (presence != this) if (presence != this)
{ {
presence.CoarseLocationChange(this); presence.CoarseLocationChange();
} }
}); });
} }