* 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 =
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) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
(float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[5].Parameter));
m_regInfo.estateSettings.objectBonusFactor = tempObjectBonusFactor;
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))
@ -250,13 +250,13 @@ namespace OpenSim.Region.Environment
}
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) Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
(float)Convert.ToDecimal(Helpers.FieldToUTF8String(packet.ParamList[1].Parameter));
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);
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);
@ -273,8 +273,8 @@ namespace OpenSim.Region.Environment
if (splitField.Length == 3)
{
Int16 corner = Convert.ToInt16(splitField[0]);
float lowValue = (float) Convert.ToDecimal(splitField[1]);
float highValue = (float) Convert.ToDecimal(splitField[2]);
float lowValue = (float)Convert.ToDecimal(splitField[1]);
float highValue = (float)Convert.ToDecimal(splitField[2]);
setEstateTextureRange(corner, lowValue, highValue);
}
@ -341,10 +341,9 @@ namespace OpenSim.Region.Environment
public void sendRegionHandshakeToAll()
{
m_scene.ForEachScenePresence( delegate( ScenePresence scenePresence )
{
sendRegionHandshake(scenePresence.ControllingClient);
});
m_scene.Broadcast(
sendRegionHandshake
);
}
public void sendRegionInfoPacket(IClientAPI remote_client)
@ -364,8 +363,8 @@ namespace OpenSim.Region.Environment
regionInfoPacket.RegionInfo.PricePerMeter = m_regInfo.estateSettings.pricePerMeter;
regionInfoPacket.RegionInfo.RedirectGridX = m_regInfo.estateSettings.redirectGridX;
regionInfoPacket.RegionInfo.RedirectGridY = m_regInfo.estateSettings.redirectGridY;
regionInfoPacket.RegionInfo.RegionFlags = (uint) m_regInfo.estateSettings.regionFlags;
regionInfoPacket.RegionInfo.SimAccess = (byte) m_regInfo.estateSettings.simAccess;
regionInfoPacket.RegionInfo.RegionFlags = (uint)m_regInfo.estateSettings.regionFlags;
regionInfoPacket.RegionInfo.SimAccess = (byte)m_regInfo.estateSettings.simAccess;
regionInfoPacket.RegionInfo.SimName = _enc.GetBytes(m_regInfo.RegionName);
regionInfoPacket.RegionInfo.SunHour = m_regInfo.estateSettings.sunHour;
regionInfoPacket.RegionInfo.TerrainLowerLimit = m_regInfo.estateSettings.terrainLowerLimit;

View File

@ -40,5 +40,10 @@ namespace OpenSim.Region.Environment.Regions
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();
Broadcast( delegate( IClientAPI client )
Broadcast(delegate(IClientAPI client)
{
for (int x = 0; x < 16; x++)
{
@ -369,7 +369,7 @@ namespace OpenSim.Region.Environment.Scenes
internal void Broadcast(Action<IClientAPI> whatToDo)
{
m_region.Broadcast( whatToDo );
m_region.Broadcast(whatToDo);
}
/// <summary>
///
@ -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);
}
}
lock (Entities)
lock (m_region)
{
if (Entities.ContainsKey(agentID))
m_region.Remove(agentID);
}
lock (Entities)
{
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);

View File

@ -45,8 +45,8 @@ namespace OpenSim.Region.Environment.Scenes
public void LoadAnims()
{
//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)
@ -56,8 +56,7 @@ namespace OpenSim.Region.Environment.Scenes
AnimsLLUUID.Add(nod.Attributes["name"].Value, nod.InnerText);
}
}
reader.Close();
}
// 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);
}
public void CoarseLocationChange(ScenePresence avatar)
public void CoarseLocationChange()
{
newCoarseLocations = true;
}
@ -638,7 +638,7 @@ namespace OpenSim.Region.Environment.Scenes
{
if (presence != this)
{
presence.CoarseLocationChange(this);
presence.CoarseLocationChange();
}
});
}