* 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

@ -216,14 +216,14 @@ namespace OpenSim.Region.Environment
int tempMaxAgents = int tempMaxAgents =
Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter))); Convert.ToInt16(Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[4].Parameter)));
m_regInfo.estateSettings.maxAgents = (byte) tempMaxAgents; m_regInfo.estateSettings.maxAgents = (byte)tempMaxAgents;
float tempObjectBonusFactor = float tempObjectBonusFactor =
(float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor; m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor;
int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter)); int tempMatureLevel = Convert.ToInt16(Helpers.FieldToUTF8String(packet.ParamList[6].Parameter));
m_regInfo.estateSettings.simAccess = (Simulator.SimAccess) tempMatureLevel; m_regInfo.estateSettings.simAccess = (Simulator.SimAccess)tempMatureLevel;
if (convertParamStringToBool(packet.ParamList[7].Parameter)) if (convertParamStringToBool(packet.ParamList[7].Parameter))
@ -250,13 +250,13 @@ namespace OpenSim.Region.Environment
} }
else else
{ {
float WaterHeight = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter)); float WaterHeight = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[0].Parameter));
float TerrainRaiseLimit = float TerrainRaiseLimit =
(float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter)); (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
float TerrainLowerLimit = float TerrainLowerLimit =
(float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter)); (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[2].Parameter));
bool UseFixedSun = convertParamStringToBool(packet.ParamList[4].Parameter); bool UseFixedSun = convertParamStringToBool(packet.ParamList[4].Parameter);
float SunHour = (float) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter)); float SunHour = (float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour); setRegionSettings(WaterHeight, TerrainRaiseLimit, TerrainLowerLimit, UseFixedSun, SunHour);
@ -273,8 +273,8 @@ namespace OpenSim.Region.Environment
if (splitField.Length == 3) if (splitField.Length == 3)
{ {
Int16 corner = Convert.ToInt16(splitField[0]); Int16 corner = Convert.ToInt16(splitField[0]);
float lowValue = (float) Convert.ToDecimal(splitField[1]); float lowValue = (float)Convert.ToDecimal(splitField[1]);
float highValue = (float) Convert.ToDecimal(splitField[2]); float highValue = (float)Convert.ToDecimal(splitField[2]);
setEstateTextureRange(corner, lowValue, highValue); setEstateTextureRange(corner, lowValue, highValue);
} }
@ -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)
@ -364,8 +363,8 @@ namespace OpenSim.Region.Environment
regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.estateSettings.pricePerMeter; regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.estateSettings.pricePerMeter;
regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.estateSettings.redirectGridX; regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.estateSettings.redirectGridX;
regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY; regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY;
regionInfoPacket.RegionInfo.RegionFlags = (uint) m_regInfo.estateSettings.regionFlags; regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.estateSettings.regionFlags;
regionInfoPacket.RegionInfo.SimAccess = (byte) m_regInfo.estateSettings.simAccess; regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.estateSettings.simAccess;
regionInfoPacket.RegionInfo.SimName = _enc.GetBytes(m_regInfo.RegionName); regionInfoPacket.RegionInfo.SimName = _enc.GetBytes(m_regInfo.RegionName);
regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour; regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour;
regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit; regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit;

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

@ -307,7 +307,7 @@ namespace OpenSim.Region.Environment.Scenes
float[] terData = Terrain.GetHeights1D(); float[] terData = Terrain.GetHeights1D();
Broadcast( delegate( IClientAPI client ) Broadcast(delegate(IClientAPI client)
{ {
for (int x = 0; x < 16; x++) for (int x = 0; x < 16; x++)
{ {
@ -321,7 +321,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
}); });
Terrain.ResetTaint(); Terrain.ResetTaint();
} }
@ -369,7 +369,7 @@ namespace OpenSim.Region.Environment.Scenes
internal void Broadcast(Action<IClientAPI> whatToDo) internal void Broadcast(Action<IClientAPI> whatToDo)
{ {
m_region.Broadcast( whatToDo ); m_region.Broadcast(whatToDo);
} }
/// <summary> /// <summary>
/// ///
@ -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 (m_region)
{
m_region.Remove(agentID);
}
lock (Entities) 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 // Remove client agent from profile, so new logins will work
commsManager.UserServer.clearUserAgent(agentID); commsManager.UserServer.clearUserAgent(agentID);

View File

@ -45,20 +45,19 @@ 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();
doc.Load(reader);
foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
{ {
if (nod.Attributes["name"] != null) XmlDocument doc = new XmlDocument();
doc.Load(reader);
foreach (XmlNode nod in doc.DocumentElement.ChildNodes)
{ {
AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText); if (nod.Attributes["name"] != null)
{
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)");
foreach (KeyValuePair<string, LLUUID> kp in Animations.AnimsLLUUID) foreach (KeyValuePair<string, LLUUID> kp in Animations.AnimsLLUUID)
@ -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();
} }
}); });
} }