Rev 1971 : The Lbsa71 vintage commit

* Refactored to prepare for some serious restructuring
afrisby
lbsa71 2007-09-20 13:04:51 +00:00
parent 14d5a2e9b7
commit 7335e5710b
10 changed files with 79 additions and 84 deletions

View File

@ -34,7 +34,6 @@ using OpenSim.Framework.Console;
using OpenSim.Framework.Interfaces;
using OpenSim.Framework.Types;
using OpenSim.Region.Environment.Scenes;
using Avatar = OpenSim.Region.Environment.Scenes.ScenePresence;
namespace OpenSim.Region.Environment
@ -332,7 +331,7 @@ namespace OpenSim.Region.Environment
public void sendRegionInfoPacketToAll()
{
List<Avatar> avatars = m_scene.RequestAvatarList();
List<ScenePresence> avatars = m_scene.GetAvatars();
for (int i = 0; i < avatars.Count; i++)
{
@ -342,12 +341,10 @@ namespace OpenSim.Region.Environment
public void sendRegionHandshakeToAll()
{
List<Avatar> avatars = m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
m_scene.ForEachScenePresence( delegate( ScenePresence scenePresence )
{
sendRegionHandshake(avatars[i].ControllingClient);
}
sendRegionHandshake(scenePresence.ControllingClient);
});
}
public void sendRegionInfoPacket(IClientAPI remote_client)

View File

@ -195,7 +195,7 @@ namespace OpenSim.Region.Environment.LandManagement
public void sendLandUpdateToAvatarsOverMe()
{
List<ScenePresence> avatars = m_scene.RequestAvatarList();
List<ScenePresence> avatars = m_scene.GetAvatars();
for (int i = 0; i < avatars.Count; i++)
{
Land over =

View File

@ -537,7 +537,7 @@ namespace OpenSim.Region.Environment.LandManagement
public void handleSignificantClientMovement(IClientAPI remote_client)
{
ScenePresence clientAvatar = m_scene.RequestAvatar(remote_client.AgentId);
ScenePresence clientAvatar = m_scene.GetScenePresence(remote_client.AgentId);
if (clientAvatar != null)
{
Land over = getLandObject(clientAvatar.AbsolutePosition.X, clientAvatar.AbsolutePosition.Y);

View File

@ -137,7 +137,7 @@ namespace OpenSim.Region.Environment.Modules
LLUUID fromAgentID)
{
ScenePresence avatar = null;
avatar = m_scene.RequestAvatar(fromAgentID);
avatar = m_scene.GetScenePresence(fromAgentID);
if (avatar != null)
{
fromPos = avatar.AbsolutePosition;
@ -159,7 +159,7 @@ namespace OpenSim.Region.Environment.Modules
int dis = -1000;
//err ??? the following code seems to be request a scenePresence when it already has a ref to it
avatar = m_scene.RequestAvatar(presence.ControllingClient.AgentId);
avatar = m_scene.GetScenePresence(presence.ControllingClient.AgentId);
if (avatar != null)
{
dis = (int) avatar.AbsolutePosition.GetDistanceTo(fromPos);

View File

@ -136,7 +136,7 @@ namespace OpenSim.Region.Environment.Scenes
Entities.Add(copy.UUID, copy);
copy.ScheduleGroupForFullUpdate();
/* List<ScenePresence> avatars = this.RequestAvatarList();
/* List<ScenePresence> avatars = this.GetScenePresences();
for (int i = 0; i < avatars.Count; i++)
{
// copy.SendAllChildPrimsToClient(avatars[i].ControllingClient);
@ -506,11 +506,10 @@ namespace OpenSim.Region.Environment.Scenes
public void StartAnimation(IClientAPI client, LLUUID animID, int seq)
{
List<ScenePresence> avatars = RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
avatars[i].ControllingClient.SendAnimation(animID, seq, client.AgentId);
}
ForEachScenePresence(delegate(ScenePresence presence)
{
presence.ControllingClient.SendAnimation(animID, seq, client.AgentId);
});
}
public virtual void ProcessObjectGrab(uint localID, LLVector3 offsetPos, IClientAPI remoteClient)

View File

@ -346,15 +346,12 @@ namespace OpenSim.Region.Environment.Scenes
m_timeUpdateCount++;
if (m_timeUpdateCount > 600)
{
List<ScenePresence> Avatars = RequestAvatarList();
foreach (ScenePresence avatar in Avatars)
List<ScenePresence> avatars = GetAvatars();
foreach (ScenePresence avatar in avatars)
{
if (!avatar.childAgent)
{
//Console.WriteLine("sending time update " + timePhase + " from region " + m_regionHandle + " to avatar " + avatar.Firstname);
avatar.ControllingClient.SendViewerTime(m_timePhase);
}
avatar.ControllingClient.SendViewerTime(m_timePhase);
}
m_timeUpdateCount = 0;
m_timePhase++;
if (m_timePhase > 94)
@ -831,7 +828,7 @@ namespace OpenSim.Region.Environment.Scenes
{
m_eventManager.TriggerOnRemovePresence(agentID);
ScenePresence avatar = RequestAvatar(agentID);
ScenePresence avatar = GetScenePresence(agentID);
ForEachScenePresence(
delegate(ScenePresence presence)
@ -877,14 +874,19 @@ namespace OpenSim.Region.Environment.Scenes
/// Request a List of all Avatars in this World
/// </summary>
/// <returns></returns>
public List<ScenePresence> RequestAvatarList()
public List<ScenePresence> GetScenePresences()
{
List<ScenePresence> result = new List<ScenePresence>();
List<ScenePresence> result = new List<ScenePresence>(Avatars.Values);
foreach (ScenePresence avatar in Avatars.Values)
{
result.Add(avatar);
}
return result;
}
public List<ScenePresence> GetAvatars()
{
List<ScenePresence> result = GetScenePresences(delegate(ScenePresence scenePresence)
{
return !scenePresence.childAgent;
});
return result;
}
@ -893,7 +895,7 @@ namespace OpenSim.Region.Environment.Scenes
/// Request a filtered list of Avatars in this World
/// </summary>
/// <returns></returns>
public List<ScenePresence> RequestAvatarList(FilterAvatarList filter)
public List<ScenePresence> GetScenePresences(FilterAvatarList filter)
{
List<ScenePresence> result = new List<ScenePresence>();
@ -913,7 +915,7 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
/// <param name="avatarID"></param>
/// <returns></returns>
public ScenePresence RequestAvatar(LLUUID avatarID)
public ScenePresence GetScenePresence(LLUUID avatarID)
{
if (Avatars.ContainsKey(avatarID))
{
@ -954,11 +956,10 @@ namespace OpenSim.Region.Environment.Scenes
public void SendKillObject(uint localID)
{
List<ScenePresence> avatars = RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
avatars[i].ControllingClient.SendKillObject(m_regionHandle, localID);
}
ForEachScenePresence(delegate(ScenePresence presence)
{
presence.ControllingClient.SendKillObject(m_regionHandle, localID);
});
}
public void SendAllSceneObjectsToClient(ScenePresence presence)
@ -1419,7 +1420,7 @@ namespace OpenSim.Region.Environment.Scenes
public override void Close()
{
m_heartbeatTimer.Close();
m_heartbeatTimer.Close();
base.Close();
}

View File

@ -1055,9 +1055,9 @@ namespace OpenSim.Region.Environment.Scenes
///
/// </summary>
/// <returns></returns>
public List<ScenePresence> RequestSceneAvatars()
public List<ScenePresence> GetScenePresences()
{
return m_scene.RequestAvatarList();
return m_scene.GetScenePresences();
}
#region Events
@ -1233,7 +1233,7 @@ namespace OpenSim.Region.Environment.Scenes
DetachFromBackup(this);
foreach (SceneObjectPart part in m_parts.Values)
{
List<ScenePresence> avatars = RequestSceneAvatars();
List<ScenePresence> avatars = GetScenePresences();
for (int i = 0; i < avatars.Count; i++)
{
avatars[i].ControllingClient.SendKillObject(m_regionHandle, part.LocalID);

View File

@ -678,7 +678,7 @@ namespace OpenSim.Region.Environment.Scenes
public void AddFullUpdateToAllAvatars()
{
List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
List<ScenePresence> avatars = m_parentGroup.GetScenePresences();
for (int i = 0; i < avatars.Count; i++)
{
avatars[i].AddFullPart(this);
@ -697,7 +697,7 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
public void SendFullUpdateToAllClients()
{
List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
List<ScenePresence> avatars = m_parentGroup.GetScenePresences();
for (int i = 0; i < avatars.Count; i++)
{
m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this);
@ -742,7 +742,7 @@ namespace OpenSim.Region.Environment.Scenes
/// Terse updates
public void AddTerseUpdateToAllAvatars()
{
List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
List<ScenePresence> avatars = m_parentGroup.GetScenePresences();
for (int i = 0; i < avatars.Count; i++)
{
avatars[i].AddTersePart(this);
@ -761,7 +761,7 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
public void SendTerseUpdateToAllClients()
{
List<ScenePresence> avatars = m_parentGroup.RequestSceneAvatars();
List<ScenePresence> avatars = m_parentGroup.GetScenePresences();
for (int i = 0; i < avatars.Count; i++)
{
m_parentGroup.SendPartTerseUpdate(avatars[i].ControllingClient, this);

View File

@ -301,7 +301,7 @@ namespace OpenSim.Region.Environment.Scenes
public void Teleport(LLVector3 pos)
{
AbsolutePosition = pos;
SendTerseUpdateToALLClients();
SendTerseUpdateToAllClients();
}
/// <summary>
@ -473,7 +473,7 @@ namespace OpenSim.Region.Environment.Scenes
/// check for user movement 'forces' (ie commands to move)
if (newForce)
{
SendTerseUpdateToALLClients();
SendTerseUpdateToAllClients();
_updateCount = 0;
}
@ -483,7 +483,7 @@ namespace OpenSim.Region.Environment.Scenes
_updateCount++;
if (_updateCount > 3)
{
SendTerseUpdateToALLClients();
SendTerseUpdateToAllClients();
_updateCount = 0;
}
}
@ -491,7 +491,7 @@ namespace OpenSim.Region.Environment.Scenes
/// check for physics-related movement
else if (lastPhysPos.GetDistanceTo(AbsolutePosition) > 0.02)
{
SendTerseUpdateToALLClients();
SendTerseUpdateToAllClients();
_updateCount = 0;
lastPhysPos = AbsolutePosition;
}
@ -524,27 +524,27 @@ namespace OpenSim.Region.Environment.Scenes
/// <summary>
///
/// </summary>
public void SendTerseUpdateToALLClients()
public void SendTerseUpdateToAllClients()
{
List<ScenePresence> avatars = m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
SendTerseUpdateToClient(avatars[i].ControllingClient);
}
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
{
SendTerseUpdateToClient(presence.ControllingClient);
});
}
public void SendCoarseLocations()
{
List<LLVector3> CoarseLocations = new List<LLVector3>();
List<ScenePresence> avatars = m_scene.RequestAvatarList();
List<ScenePresence> avatars = m_scene.GetAvatars();
for (int i = 0; i < avatars.Count; i++)
{
if (avatars[i] != this && (!avatars[i].childAgent))
if (avatars[i] != this )
{
CoarseLocations.Add(avatars[i].AbsolutePosition);
}
}
ControllingClient.SendCoarseLocationUpdate(CoarseLocations);
}
@ -555,14 +555,13 @@ namespace OpenSim.Region.Environment.Scenes
private void NotifyMyCoarseLocationChange()
{
List<ScenePresence> avatars = m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
if (avatars[i] != this)
{
avatars[i].CoarseLocationChange(this);
}
}
m_scene.ForEachScenePresence(delegate(ScenePresence presence)
{
if (presence != this)
{
presence.CoarseLocationChange(this);
}
});
}
@ -576,10 +575,10 @@ namespace OpenSim.Region.Environment.Scenes
LocalId, AbsolutePosition, m_textureEntry.ToBytes());
}
public void SendFullUpdateToALLClients()
public void SendFullUpdateToAllClients()
{
List<ScenePresence> avatars = m_scene.RequestAvatarList();
foreach (ScenePresence avatar in m_scene.RequestAvatarList())
List<ScenePresence> avatars = m_scene.GetScenePresences();
foreach (ScenePresence avatar in avatars)
{
SendFullUpdateToOtherClient(avatar);
if (avatar.LocalId != LocalId)
@ -606,7 +605,7 @@ namespace OpenSim.Region.Environment.Scenes
newAvatar = false;
}
SendFullUpdateToALLClients();
SendFullUpdateToAllClients();
SendArrearanceToAllOtherAgents();
}
@ -618,7 +617,7 @@ namespace OpenSim.Region.Environment.Scenes
{
ControllingClient.SendWearables(Wearables);
//this.SendFullUpdateToALLClients();
//this.SendFullUpdateToAllClients();
//this.SendArrearanceToAllOtherAgents();
m_scene.SendAllSceneObjectsToClient(this);
@ -640,11 +639,10 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary>
public void SendArrearanceToAllOtherAgents()
{
List<ScenePresence> avatars = m_scene.RequestAvatarList();
foreach (ScenePresence avatar in m_scene.RequestAvatarList())
{
SendAppearanceToOtherAgent(avatar);
}
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
{
SendAppearanceToOtherAgent(scenePresence);
});
}
/// <summary>
@ -666,11 +664,12 @@ namespace OpenSim.Region.Environment.Scenes
{
current_anim = animID;
anim_seq = seq;
List<ScenePresence> avatars = m_scene.RequestAvatarList();
for (int i = 0; i < avatars.Count; i++)
{
avatars[i].ControllingClient.SendAnimation(animID, seq, ControllingClient.AgentId);
}
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
{
scenePresence.ControllingClient.SendAnimation(animID, seq,
ControllingClient.AgentId);
});
}
/// <summary>

View File

@ -97,11 +97,10 @@ namespace SimpleApp
scene.AddNewClient(m_character, false);
}
List<ScenePresence> avatars = scene.RequestAvatarList();
List<ScenePresence> avatars = scene.GetAvatars();
foreach (ScenePresence avatar in avatars)
{
avatar.AbsolutePosition = new LLVector3((float)OpenSim.Framework.Utilities.Util.RandomClass.Next(100,200), (float)OpenSim.Framework.Utilities.Util.RandomClass.Next(30, 200), 2);
avatar.AbsolutePosition = new LLVector3((float)OpenSim.Framework.Utilities.Util.RandomClass.Next(100,200), (float)OpenSim.Framework.Utilities.Util.RandomClass.Next(30, 200), 2);
}