Experimental change to use an immutable array for iterating ScenePresences, avoiding locking and copying the list each time it is accessed
parent
96d53f11e5
commit
588361e2a2
|
@ -4434,6 +4434,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
protected virtual void RegisterLocalPacketHandlers()
|
protected virtual void RegisterLocalPacketHandlers()
|
||||||
{
|
{
|
||||||
AddLocalPacketHandler(PacketType.LogoutRequest, Logout);
|
AddLocalPacketHandler(PacketType.LogoutRequest, Logout);
|
||||||
|
AddLocalPacketHandler(PacketType.AgentUpdate, HandleAgentUpdate);
|
||||||
AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect);
|
AddLocalPacketHandler(PacketType.ViewerEffect, HandleViewerEffect);
|
||||||
AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached);
|
AddLocalPacketHandler(PacketType.AgentCachedTexture, AgentTextureCached);
|
||||||
AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate);
|
AddLocalPacketHandler(PacketType.MultipleObjectUpdate, MultipleObjUpdate);
|
||||||
|
@ -4446,6 +4447,75 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
#region Packet Handlers
|
#region Packet Handlers
|
||||||
|
|
||||||
|
private bool HandleAgentUpdate(IClientAPI sener, Packet Pack)
|
||||||
|
{
|
||||||
|
if (OnAgentUpdate != null)
|
||||||
|
{
|
||||||
|
bool update = false;
|
||||||
|
AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack;
|
||||||
|
|
||||||
|
#region Packet Session and User Check
|
||||||
|
if (agenUpdate.AgentData.SessionID != SessionId || agenUpdate.AgentData.AgentID != AgentId)
|
||||||
|
return false;
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
AgentUpdatePacket.AgentDataBlock x = agenUpdate.AgentData;
|
||||||
|
|
||||||
|
// We can only check when we have something to check
|
||||||
|
// against.
|
||||||
|
|
||||||
|
if (lastarg != null)
|
||||||
|
{
|
||||||
|
update =
|
||||||
|
(
|
||||||
|
(x.BodyRotation != lastarg.BodyRotation) ||
|
||||||
|
(x.CameraAtAxis != lastarg.CameraAtAxis) ||
|
||||||
|
(x.CameraCenter != lastarg.CameraCenter) ||
|
||||||
|
(x.CameraLeftAxis != lastarg.CameraLeftAxis) ||
|
||||||
|
(x.CameraUpAxis != lastarg.CameraUpAxis) ||
|
||||||
|
(x.ControlFlags != lastarg.ControlFlags) ||
|
||||||
|
(x.Far != lastarg.Far) ||
|
||||||
|
(x.Flags != lastarg.Flags) ||
|
||||||
|
(x.State != lastarg.State) ||
|
||||||
|
(x.HeadRotation != lastarg.HeadRotation) ||
|
||||||
|
(x.SessionID != lastarg.SessionID) ||
|
||||||
|
(x.AgentID != lastarg.AgentID)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
update = true;
|
||||||
|
|
||||||
|
// These should be ordered from most-likely to
|
||||||
|
// least likely to change. I've made an initial
|
||||||
|
// guess at that.
|
||||||
|
|
||||||
|
if (update)
|
||||||
|
{
|
||||||
|
AgentUpdateArgs arg = new AgentUpdateArgs();
|
||||||
|
arg.AgentID = x.AgentID;
|
||||||
|
arg.BodyRotation = x.BodyRotation;
|
||||||
|
arg.CameraAtAxis = x.CameraAtAxis;
|
||||||
|
arg.CameraCenter = x.CameraCenter;
|
||||||
|
arg.CameraLeftAxis = x.CameraLeftAxis;
|
||||||
|
arg.CameraUpAxis = x.CameraUpAxis;
|
||||||
|
arg.ControlFlags = x.ControlFlags;
|
||||||
|
arg.Far = x.Far;
|
||||||
|
arg.Flags = x.Flags;
|
||||||
|
arg.HeadRotation = x.HeadRotation;
|
||||||
|
arg.SessionID = x.SessionID;
|
||||||
|
arg.State = x.State;
|
||||||
|
UpdateAgent handlerAgentUpdate = OnAgentUpdate;
|
||||||
|
lastarg = arg; // save this set of arguments for nexttime
|
||||||
|
if (handlerAgentUpdate != null)
|
||||||
|
OnAgentUpdate(this, arg);
|
||||||
|
|
||||||
|
handlerAgentUpdate = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private bool HandleMoneyTransferRequest(IClientAPI sender, Packet Pack)
|
private bool HandleMoneyTransferRequest(IClientAPI sender, Packet Pack)
|
||||||
{
|
{
|
||||||
MoneyTransferRequestPacket money = (MoneyTransferRequestPacket)Pack;
|
MoneyTransferRequestPacket money = (MoneyTransferRequestPacket)Pack;
|
||||||
|
@ -5631,77 +5701,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PacketType.AgentUpdate:
|
|
||||||
if (OnAgentUpdate != null)
|
|
||||||
{
|
|
||||||
bool update = false;
|
|
||||||
AgentUpdatePacket agenUpdate = (AgentUpdatePacket)Pack;
|
|
||||||
|
|
||||||
#region Packet Session and User Check
|
|
||||||
if (m_checkPackets)
|
|
||||||
{
|
|
||||||
if (agenUpdate.AgentData.SessionID != SessionId ||
|
|
||||||
agenUpdate.AgentData.AgentID != AgentId)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
AgentUpdatePacket.AgentDataBlock x = agenUpdate.AgentData;
|
|
||||||
|
|
||||||
// We can only check when we have something to check
|
|
||||||
// against.
|
|
||||||
|
|
||||||
if (lastarg != null)
|
|
||||||
{
|
|
||||||
update =
|
|
||||||
(
|
|
||||||
(x.BodyRotation != lastarg.BodyRotation) ||
|
|
||||||
(x.CameraAtAxis != lastarg.CameraAtAxis) ||
|
|
||||||
(x.CameraCenter != lastarg.CameraCenter) ||
|
|
||||||
(x.CameraLeftAxis != lastarg.CameraLeftAxis) ||
|
|
||||||
(x.CameraUpAxis != lastarg.CameraUpAxis) ||
|
|
||||||
(x.ControlFlags != lastarg.ControlFlags) ||
|
|
||||||
(x.Far != lastarg.Far) ||
|
|
||||||
(x.Flags != lastarg.Flags) ||
|
|
||||||
(x.State != lastarg.State) ||
|
|
||||||
(x.HeadRotation != lastarg.HeadRotation) ||
|
|
||||||
(x.SessionID != lastarg.SessionID) ||
|
|
||||||
(x.AgentID != lastarg.AgentID)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
update = true;
|
|
||||||
|
|
||||||
// These should be ordered from most-likely to
|
|
||||||
// least likely to change. I've made an initial
|
|
||||||
// guess at that.
|
|
||||||
|
|
||||||
if (update)
|
|
||||||
{
|
|
||||||
AgentUpdateArgs arg = new AgentUpdateArgs();
|
|
||||||
arg.AgentID = x.AgentID;
|
|
||||||
arg.BodyRotation = x.BodyRotation;
|
|
||||||
arg.CameraAtAxis = x.CameraAtAxis;
|
|
||||||
arg.CameraCenter = x.CameraCenter;
|
|
||||||
arg.CameraLeftAxis = x.CameraLeftAxis;
|
|
||||||
arg.CameraUpAxis = x.CameraUpAxis;
|
|
||||||
arg.ControlFlags = x.ControlFlags;
|
|
||||||
arg.Far = x.Far;
|
|
||||||
arg.Flags = x.Flags;
|
|
||||||
arg.HeadRotation = x.HeadRotation;
|
|
||||||
arg.SessionID = x.SessionID;
|
|
||||||
arg.State = x.State;
|
|
||||||
UpdateAgent handlerAgentUpdate = OnAgentUpdate;
|
|
||||||
lastarg = arg; // save this set of arguments for nexttime
|
|
||||||
if (handlerAgentUpdate != null)
|
|
||||||
OnAgentUpdate(this, arg);
|
|
||||||
|
|
||||||
handlerAgentUpdate = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PacketType.AgentAnimation:
|
case PacketType.AgentAnimation:
|
||||||
AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
|
AgentAnimationPacket AgentAni = (AgentAnimationPacket)Pack;
|
||||||
|
|
||||||
|
|
|
@ -96,12 +96,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Combat.CombatModule
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool foundResult = false;
|
bool foundResult = false;
|
||||||
string resultstring = "";
|
string resultstring = String.Empty;
|
||||||
List<ScenePresence> allav = DeadAvatar.Scene.GetScenePresences();
|
ScenePresence[] allav = DeadAvatar.Scene.GetScenePresences();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (ScenePresence av in allav)
|
for (int i = 0; i < allav.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence av = allav[i];
|
||||||
|
|
||||||
if (av.LocalId == killerObjectLocalID)
|
if (av.LocalId == killerObjectLocalID)
|
||||||
{
|
{
|
||||||
av.ControllingClient.SendAlertMessage("You fragged " + DeadAvatar.Firstname + " " + DeadAvatar.Lastname);
|
av.ControllingClient.SendAlertMessage("You fragged " + DeadAvatar.Firstname + " " + DeadAvatar.Lastname);
|
||||||
|
|
|
@ -85,10 +85,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
||||||
|
|
||||||
public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
|
public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
|
||||||
{
|
{
|
||||||
List<ScenePresence> presenceList = m_scene.GetScenePresences();
|
ScenePresence[] presenceList = m_scene.GetScenePresences();
|
||||||
|
|
||||||
foreach (ScenePresence presence in presenceList)
|
for (int i = 0; i < presenceList.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence presence = presenceList[i];
|
||||||
|
|
||||||
if (presence.Firstname == firstName && presence.Lastname == lastName)
|
if (presence.Firstname == firstName && presence.Lastname == lastName)
|
||||||
{
|
{
|
||||||
presence.ControllingClient.SendAgentAlertMessage(message, modal);
|
presence.ControllingClient.SendAgentAlertMessage(message, modal);
|
||||||
|
@ -99,10 +101,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
||||||
|
|
||||||
public void SendGeneralAlert(string message)
|
public void SendGeneralAlert(string message)
|
||||||
{
|
{
|
||||||
List<ScenePresence> presenceList = m_scene.GetScenePresences();
|
ScenePresence[] presenceList = m_scene.GetScenePresences();
|
||||||
|
|
||||||
foreach (ScenePresence presence in presenceList)
|
for (int i = 0; i < presenceList.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence presence = presenceList[i];
|
||||||
|
|
||||||
if (!presence.IsChildAgent)
|
if (!presence.IsChildAgent)
|
||||||
presence.ControllingClient.SendAlertMessage(message);
|
presence.ControllingClient.SendAlertMessage(message);
|
||||||
}
|
}
|
||||||
|
@ -150,10 +154,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
|
||||||
public void SendNotificationToUsersInRegion(
|
public void SendNotificationToUsersInRegion(
|
||||||
UUID fromAvatarID, string fromAvatarName, string message)
|
UUID fromAvatarID, string fromAvatarName, string message)
|
||||||
{
|
{
|
||||||
List<ScenePresence> presenceList = m_scene.GetScenePresences();
|
ScenePresence[] presences = m_scene.GetScenePresences();
|
||||||
|
|
||||||
foreach (ScenePresence presence in presenceList)
|
for (int i = 0; i < presences.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence presence = presences[i];
|
||||||
if (!presence.IsChildAgent)
|
if (!presence.IsChildAgent)
|
||||||
presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message);
|
presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -414,9 +414,12 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||||
private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID)
|
private void handleEstateTeleportAllUsersHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID)
|
||||||
{
|
{
|
||||||
// Get a fresh list that will not change as people get teleported away
|
// Get a fresh list that will not change as people get teleported away
|
||||||
List<ScenePresence> prescences = m_scene.GetScenePresences();
|
ScenePresence[] presences = m_scene.GetScenePresences();
|
||||||
foreach (ScenePresence p in prescences)
|
|
||||||
|
for (int i = 0; i < presences.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence p = presences[i];
|
||||||
|
|
||||||
if (p.UUID != senderID)
|
if (p.UUID != senderID)
|
||||||
{
|
{
|
||||||
// make sure they are still there, we could be working down a long list
|
// make sure they are still there, we could be working down a long list
|
||||||
|
|
|
@ -253,7 +253,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
protected int m_fps = 10;
|
protected int m_fps = 10;
|
||||||
protected int m_frame = 0;
|
protected int m_frame = 0;
|
||||||
protected float m_timespan = 0.089f;
|
protected float m_timespan = 0.089f;
|
||||||
protected DateTime m_lastupdate = DateTime.Now;
|
protected DateTime m_lastupdate = DateTime.UtcNow;
|
||||||
|
|
||||||
private int m_update_physics = 1;
|
private int m_update_physics = 1;
|
||||||
private int m_update_entitymovement = 1;
|
private int m_update_entitymovement = 1;
|
||||||
|
@ -1014,7 +1014,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//#endif
|
//#endif
|
||||||
maintc = Environment.TickCount;
|
maintc = Environment.TickCount;
|
||||||
|
|
||||||
TimeSpan SinceLastFrame = DateTime.Now - m_lastupdate;
|
TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate;
|
||||||
float physicsFPS = 0;
|
float physicsFPS = 0;
|
||||||
|
|
||||||
frameMS = Environment.TickCount;
|
frameMS = Environment.TickCount;
|
||||||
|
@ -1137,7 +1137,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
m_timedilation = tmpval;
|
m_timedilation = tmpval;
|
||||||
|
|
||||||
m_lastupdate = DateTime.Now;
|
m_lastupdate = DateTime.UtcNow;
|
||||||
}
|
}
|
||||||
maintc = Environment.TickCount - maintc;
|
maintc = Environment.TickCount - maintc;
|
||||||
maintc = (int)(m_timespan * 1000) - maintc;
|
maintc = (int)(m_timespan * 1000) - maintc;
|
||||||
|
@ -3496,9 +3496,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
|
public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
|
||||||
{
|
{
|
||||||
ScenePresence presence;
|
ScenePresence presence;
|
||||||
|
m_sceneGraph.TryGetAvatar(agentID, out presence);
|
||||||
lock (m_sceneGraph.ScenePresences)
|
|
||||||
m_sceneGraph.ScenePresences.TryGetValue(agentID, out presence);
|
|
||||||
|
|
||||||
if (presence != null)
|
if (presence != null)
|
||||||
{
|
{
|
||||||
|
@ -3709,8 +3707,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Vector3 lookAt, uint teleportFlags)
|
Vector3 lookAt, uint teleportFlags)
|
||||||
{
|
{
|
||||||
ScenePresence sp;
|
ScenePresence sp;
|
||||||
lock (m_sceneGraph.ScenePresences)
|
m_sceneGraph.TryGetAvatar(remoteClient.AgentId, out sp);
|
||||||
m_sceneGraph.ScenePresences.TryGetValue(remoteClient.AgentId, out sp);
|
|
||||||
|
|
||||||
if (sp != null)
|
if (sp != null)
|
||||||
{
|
{
|
||||||
|
@ -4112,7 +4109,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// This list is a new object, so it can be iterated over without locking.
|
/// This list is a new object, so it can be iterated over without locking.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<ScenePresence> GetScenePresences()
|
public ScenePresence[] GetScenePresences()
|
||||||
{
|
{
|
||||||
return m_sceneGraph.GetScenePresences();
|
return m_sceneGraph.GetScenePresences();
|
||||||
}
|
}
|
||||||
|
@ -4159,15 +4156,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public void ForEachScenePresence(Action<ScenePresence> action)
|
public void ForEachScenePresence(Action<ScenePresence> action)
|
||||||
{
|
{
|
||||||
// We don't want to try to send messages if there are no avatars.
|
// We don't want to try to send messages if there are no avatars.
|
||||||
if (m_sceneGraph != null && m_sceneGraph.ScenePresences != null)
|
if (m_sceneGraph != null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<ScenePresence> presenceList = GetScenePresences();
|
ScenePresence[] presences = GetScenePresences();
|
||||||
foreach (ScenePresence presence in presenceList)
|
for (int i = 0; i < presences.Length; i++)
|
||||||
{
|
action(presences[i]);
|
||||||
action(presence);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,7 +66,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
protected internal Dictionary<UUID, ScenePresence> ScenePresences = new Dictionary<UUID, ScenePresence>();
|
protected Dictionary<UUID, ScenePresence> m_scenePresences = new Dictionary<UUID, ScenePresence>();
|
||||||
|
protected ScenePresence[] m_scenePresenceArray = new ScenePresence[0];
|
||||||
|
|
||||||
// SceneObjects is not currently populated or used.
|
// SceneObjects is not currently populated or used.
|
||||||
//public Dictionary<UUID, SceneObjectGroup> SceneObjects;
|
//public Dictionary<UUID, SceneObjectGroup> SceneObjects;
|
||||||
protected internal EntityManager Entities = new EntityManager();
|
protected internal EntityManager Entities = new EntityManager();
|
||||||
|
@ -126,10 +128,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
protected internal void Close()
|
protected internal void Close()
|
||||||
{
|
{
|
||||||
lock (ScenePresences)
|
lock (m_scenePresences)
|
||||||
{
|
{
|
||||||
ScenePresences.Clear();
|
m_scenePresences.Clear();
|
||||||
|
m_scenePresenceArray = new ScenePresence[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (m_dictionary_lock)
|
lock (m_dictionary_lock)
|
||||||
{
|
{
|
||||||
SceneObjectGroupsByFullID.Clear();
|
SceneObjectGroupsByFullID.Clear();
|
||||||
|
@ -157,11 +161,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
protected internal void UpdatePresences()
|
protected internal void UpdatePresences()
|
||||||
{
|
{
|
||||||
List<ScenePresence> updateScenePresences = GetScenePresences();
|
ScenePresence[] updateScenePresences = GetScenePresences();
|
||||||
foreach (ScenePresence pres in updateScenePresences)
|
for (int i = 0; i < updateScenePresences.Length; i++)
|
||||||
{
|
updateScenePresences[i].Update();
|
||||||
pres.Update();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal float UpdatePhysics(double elapsed)
|
protected internal float UpdatePhysics(double elapsed)
|
||||||
|
@ -190,15 +192,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
protected internal void UpdateScenePresenceMovement()
|
protected internal void UpdateScenePresenceMovement()
|
||||||
{
|
{
|
||||||
List<ScenePresence> moveEntities = GetScenePresences();
|
ScenePresence[] moveEntities = GetScenePresences();
|
||||||
|
for (int i = 0; i < moveEntities.Length; i++)
|
||||||
foreach (EntityBase entity in moveEntities)
|
moveEntities[i].UpdateMovement();
|
||||||
{
|
|
||||||
//cfk. This throws occaisional exceptions on a heavily used region
|
|
||||||
//and I added this null check to try to preclude the exception.
|
|
||||||
if (entity != null)
|
|
||||||
entity.UpdateMovement();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -645,9 +641,34 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
Entities[presence.UUID] = presence;
|
Entities[presence.UUID] = presence;
|
||||||
|
|
||||||
lock (ScenePresences)
|
lock (m_scenePresences)
|
||||||
{
|
{
|
||||||
ScenePresences[presence.UUID] = presence;
|
if (!m_scenePresences.ContainsKey(presence.UUID))
|
||||||
|
{
|
||||||
|
m_scenePresences.Add(presence.UUID, presence);
|
||||||
|
|
||||||
|
// Create a new array of ScenePresence references
|
||||||
|
int oldLength = m_scenePresenceArray.Length;
|
||||||
|
ScenePresence[] newArray = new ScenePresence[oldLength + 1];
|
||||||
|
Array.Copy(m_scenePresenceArray, newArray, oldLength);
|
||||||
|
newArray[oldLength] = presence;
|
||||||
|
m_scenePresenceArray = newArray;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_scenePresences[presence.UUID] = presence;
|
||||||
|
|
||||||
|
// Do a linear search through the array of ScenePresence references
|
||||||
|
// and update the modified entry
|
||||||
|
for (int i = 0; i < m_scenePresenceArray.Length; i++)
|
||||||
|
{
|
||||||
|
if (m_scenePresenceArray[i].UUID == presence.UUID)
|
||||||
|
{
|
||||||
|
m_scenePresenceArray[i] = presence;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -663,16 +684,30 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
agentID);
|
agentID);
|
||||||
}
|
}
|
||||||
|
|
||||||
lock (ScenePresences)
|
lock (m_scenePresences)
|
||||||
{
|
{
|
||||||
if (!ScenePresences.Remove(agentID))
|
if (m_scenePresences.Remove(agentID))
|
||||||
|
{
|
||||||
|
// Copy all of the elements from the previous array
|
||||||
|
// into the new array except the removed element
|
||||||
|
int oldLength = m_scenePresenceArray.Length;
|
||||||
|
ScenePresence[] newArray = new ScenePresence[oldLength - 1];
|
||||||
|
int j = 0;
|
||||||
|
for (int i = 0; i < m_scenePresenceArray.Length; i++)
|
||||||
|
{
|
||||||
|
ScenePresence presence = m_scenePresenceArray[i];
|
||||||
|
if (presence.UUID != agentID)
|
||||||
|
{
|
||||||
|
newArray[j] = presence;
|
||||||
|
++j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_scenePresenceArray = newArray;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
|
m_log.WarnFormat("[SCENE] Tried to remove non-existent scene presence with agent ID {0} from scene ScenePresences list", agentID);
|
||||||
}
|
}
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// m_log.InfoFormat("[SCENE] Removed scene presence {0} from scene presences list", agentID);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -704,20 +739,21 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void RecalculateStats()
|
public void RecalculateStats()
|
||||||
{
|
{
|
||||||
List<ScenePresence> SPList = GetScenePresences();
|
ScenePresence[] presences = GetScenePresences();
|
||||||
int rootcount = 0;
|
int rootcount = 0;
|
||||||
int childcount = 0;
|
int childcount = 0;
|
||||||
|
|
||||||
foreach (ScenePresence user in SPList)
|
for (int i = 0; i < presences.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence user = presences[i];
|
||||||
if (user.IsChildAgent)
|
if (user.IsChildAgent)
|
||||||
childcount++;
|
++childcount;
|
||||||
else
|
else
|
||||||
rootcount++;
|
++rootcount;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_numRootAgents = rootcount;
|
m_numRootAgents = rootcount;
|
||||||
m_numChildAgents = childcount;
|
m_numChildAgents = childcount;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetChildAgentCount()
|
public int GetChildAgentCount()
|
||||||
|
@ -767,12 +803,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// locking is required to iterate over it.
|
/// locking is required to iterate over it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected internal List<ScenePresence> GetScenePresences()
|
protected internal ScenePresence[] GetScenePresences()
|
||||||
{
|
{
|
||||||
lock (ScenePresences)
|
return m_scenePresenceArray;
|
||||||
{
|
|
||||||
return new List<ScenePresence>(ScenePresences.Values);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal List<ScenePresence> GetAvatars()
|
protected internal List<ScenePresence> GetAvatars()
|
||||||
|
@ -817,15 +850,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// No locking of scene presences here since we're passing back a list...
|
// No locking of scene presences here since we're passing back a list...
|
||||||
|
|
||||||
List<ScenePresence> result = new List<ScenePresence>();
|
List<ScenePresence> result = new List<ScenePresence>();
|
||||||
List<ScenePresence> ScenePresencesList = GetScenePresences();
|
ScenePresence[] scenePresences = GetScenePresences();
|
||||||
|
|
||||||
foreach (ScenePresence avatar in ScenePresencesList)
|
for (int i = 0; i < scenePresences.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence avatar = scenePresences[i];
|
||||||
if (filter(avatar))
|
if (filter(avatar))
|
||||||
{
|
|
||||||
result.Add(avatar);
|
result.Add(avatar);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -839,9 +871,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
ScenePresence sp;
|
ScenePresence sp;
|
||||||
|
|
||||||
lock (ScenePresences)
|
lock (m_scenePresences)
|
||||||
{
|
{
|
||||||
ScenePresences.TryGetValue(agentID, out sp);
|
m_scenePresences.TryGetValue(agentID, out sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return sp;
|
return sp;
|
||||||
|
@ -1000,51 +1032,27 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
protected internal bool TryGetAvatar(UUID avatarId, out ScenePresence avatar)
|
protected internal bool TryGetAvatar(UUID avatarId, out ScenePresence avatar)
|
||||||
{
|
{
|
||||||
ScenePresence presence;
|
lock (m_scenePresences)
|
||||||
|
return m_scenePresences.TryGetValue(avatarId, out avatar);
|
||||||
lock (ScenePresences)
|
|
||||||
{
|
|
||||||
if (ScenePresences.TryGetValue(avatarId, out presence))
|
|
||||||
{
|
|
||||||
avatar = presence;
|
|
||||||
return true;
|
|
||||||
|
|
||||||
//if (!presence.IsChildAgent)
|
|
||||||
//{
|
|
||||||
// avatar = presence;
|
|
||||||
// return true;
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// m_log.WarnFormat(
|
|
||||||
// "[INNER SCENE]: Requested avatar {0} could not be found in scene {1} since it is only registered as a child agent!",
|
|
||||||
// avatarId, m_parentScene.RegionInfo.RegionName);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
avatar = null;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal bool TryGetAvatarByName(string avatarName, out ScenePresence avatar)
|
protected internal bool TryGetAvatarByName(string avatarName, out ScenePresence avatar)
|
||||||
{
|
{
|
||||||
lock (ScenePresences)
|
ScenePresence[] presences = GetScenePresences();
|
||||||
{
|
|
||||||
foreach (ScenePresence presence in ScenePresences.Values)
|
for (int i = 0; i < presences.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence presence = presences[i];
|
||||||
|
|
||||||
if (!presence.IsChildAgent)
|
if (!presence.IsChildAgent)
|
||||||
{
|
{
|
||||||
string name = presence.ControllingClient.Name;
|
if (String.Compare(avatarName, presence.ControllingClient.Name, true) == 0)
|
||||||
|
|
||||||
if (String.Compare(avatarName, name, true) == 0)
|
|
||||||
{
|
{
|
||||||
avatar = presence;
|
avatar = presence;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
avatar = null;
|
avatar = null;
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -411,12 +411,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="newDebug"></param>
|
/// <param name="newDebug"></param>
|
||||||
public void SetDebugPacketLevelOnCurrentScene(int newDebug)
|
public void SetDebugPacketLevelOnCurrentScene(int newDebug)
|
||||||
{
|
{
|
||||||
ForEachCurrentScene(delegate(Scene scene)
|
ForEachCurrentScene(
|
||||||
|
delegate(Scene scene)
|
||||||
{
|
{
|
||||||
List<ScenePresence> scenePresences = scene.GetScenePresences();
|
ScenePresence[] scenePresences = scene.GetScenePresences();
|
||||||
|
|
||||||
foreach (ScenePresence scenePresence in scenePresences)
|
for (int i = 0; i < scenePresences.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence scenePresence = scenePresences[i];
|
||||||
|
|
||||||
if (!scenePresence.IsChildAgent)
|
if (!scenePresence.IsChildAgent)
|
||||||
{
|
{
|
||||||
m_log.ErrorFormat("Packet debug for {0} {1} set to {2}",
|
m_log.ErrorFormat("Packet debug for {0} {1} set to {2}",
|
||||||
|
@ -427,25 +430,27 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
scenePresence.ControllingClient.SetDebugPacketLevel(newDebug);
|
scenePresence.ControllingClient.SetDebugPacketLevel(newDebug);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ScenePresence> GetCurrentSceneAvatars()
|
public List<ScenePresence> GetCurrentSceneAvatars()
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatars = new List<ScenePresence>();
|
List<ScenePresence> avatars = new List<ScenePresence>();
|
||||||
|
|
||||||
ForEachCurrentScene(delegate(Scene scene)
|
ForEachCurrentScene(
|
||||||
|
delegate(Scene scene)
|
||||||
{
|
{
|
||||||
List<ScenePresence> scenePresences = scene.GetScenePresences();
|
ScenePresence[] scenePresences = scene.GetScenePresences();
|
||||||
|
|
||||||
foreach (ScenePresence scenePresence in scenePresences)
|
for (int i = 0; i < scenePresences.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence scenePresence = scenePresences[i];
|
||||||
if (!scenePresence.IsChildAgent)
|
if (!scenePresence.IsChildAgent)
|
||||||
{
|
|
||||||
avatars.Add(scenePresence);
|
avatars.Add(scenePresence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
|
|
||||||
return avatars;
|
return avatars;
|
||||||
}
|
}
|
||||||
|
@ -456,7 +461,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
ForEachCurrentScene(delegate(Scene scene)
|
ForEachCurrentScene(delegate(Scene scene)
|
||||||
{
|
{
|
||||||
List<ScenePresence> scenePresences = scene.GetScenePresences();
|
ScenePresence[] scenePresences = scene.GetScenePresences();
|
||||||
presences.AddRange(scenePresences);
|
presences.AddRange(scenePresences);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1182,8 +1182,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
// part.Inventory.RemoveScriptInstances();
|
// part.Inventory.RemoveScriptInstances();
|
||||||
|
|
||||||
List<ScenePresence> avatars = Scene.GetScenePresences();
|
ScenePresence[] avatars = Scene.GetScenePresences();
|
||||||
for (int i = 0; i < avatars.Count; i++)
|
for (int i = 0; i < avatars.Length; i++)
|
||||||
{
|
{
|
||||||
if (avatars[i].ParentID == LocalId)
|
if (avatars[i].ParentID == LocalId)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1077,8 +1077,8 @@ if (m_shape != null) {
|
||||||
|
|
||||||
private void SendObjectPropertiesToClient(UUID AgentID)
|
private void SendObjectPropertiesToClient(UUID AgentID)
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
|
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||||
for (int i = 0; i < avatars.Count; i++)
|
for (int i = 0; i < avatars.Length; i++)
|
||||||
{
|
{
|
||||||
// Ugly reference :(
|
// Ugly reference :(
|
||||||
if (avatars[i].UUID == AgentID)
|
if (avatars[i].UUID == AgentID)
|
||||||
|
@ -1140,8 +1140,8 @@ if (m_shape != null) {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void AddFullUpdateToAllAvatars()
|
public void AddFullUpdateToAllAvatars()
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
|
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||||
for (int i = 0; i < avatars.Count; i++)
|
for (int i = 0; i < avatars.Length; i++)
|
||||||
{
|
{
|
||||||
avatars[i].SceneViewer.QueuePartForUpdate(this);
|
avatars[i].SceneViewer.QueuePartForUpdate(this);
|
||||||
}
|
}
|
||||||
|
@ -1165,8 +1165,8 @@ if (m_shape != null) {
|
||||||
/// Terse updates
|
/// Terse updates
|
||||||
public void AddTerseUpdateToAllAvatars()
|
public void AddTerseUpdateToAllAvatars()
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
|
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||||
for (int i = 0; i < avatars.Count; i++)
|
for (int i = 0; i < avatars.Length; i++)
|
||||||
{
|
{
|
||||||
avatars[i].SceneViewer.QueuePartForUpdate(this);
|
avatars[i].SceneViewer.QueuePartForUpdate(this);
|
||||||
}
|
}
|
||||||
|
@ -1894,11 +1894,12 @@ if (m_shape != null) {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<ScenePresence> avlist = m_parentGroup.Scene.GetScenePresences();
|
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
|
||||||
if (avlist != null)
|
|
||||||
{
|
for (int i = 0; i < avlist.Length; i++)
|
||||||
foreach (ScenePresence av in avlist)
|
|
||||||
{
|
{
|
||||||
|
ScenePresence av = avlist[i];
|
||||||
|
|
||||||
if (av.LocalId == localId)
|
if (av.LocalId == localId)
|
||||||
{
|
{
|
||||||
DetectedObject detobj = new DetectedObject();
|
DetectedObject detobj = new DetectedObject();
|
||||||
|
@ -1915,7 +1916,6 @@ if (m_shape != null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (colliding.Count > 0)
|
if (colliding.Count > 0)
|
||||||
{
|
{
|
||||||
StartCollidingMessage.Colliders = colliding;
|
StartCollidingMessage.Colliders = colliding;
|
||||||
|
@ -1965,11 +1965,12 @@ if (m_shape != null) {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<ScenePresence> avlist = m_parentGroup.Scene.GetScenePresences();
|
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
|
||||||
if (avlist != null)
|
|
||||||
{
|
for (int i = 0; i < avlist.Length; i++)
|
||||||
foreach (ScenePresence av in avlist)
|
|
||||||
{
|
{
|
||||||
|
ScenePresence av = avlist[i];
|
||||||
|
|
||||||
if (av.LocalId == localId)
|
if (av.LocalId == localId)
|
||||||
{
|
{
|
||||||
DetectedObject detobj = new DetectedObject();
|
DetectedObject detobj = new DetectedObject();
|
||||||
|
@ -1984,8 +1985,6 @@ if (m_shape != null) {
|
||||||
colliding.Add(detobj);
|
colliding.Add(detobj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (colliding.Count > 0)
|
if (colliding.Count > 0)
|
||||||
|
@ -2035,11 +2034,12 @@ if (m_shape != null) {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
List<ScenePresence> avlist = m_parentGroup.Scene.GetScenePresences();
|
ScenePresence[] avlist = m_parentGroup.Scene.GetScenePresences();
|
||||||
if (avlist != null)
|
|
||||||
{
|
for (int i = 0; i < avlist.Length; i++)
|
||||||
foreach (ScenePresence av in avlist)
|
|
||||||
{
|
{
|
||||||
|
ScenePresence av = avlist[i];
|
||||||
|
|
||||||
if (av.LocalId == localId)
|
if (av.LocalId == localId)
|
||||||
{
|
{
|
||||||
DetectedObject detobj = new DetectedObject();
|
DetectedObject detobj = new DetectedObject();
|
||||||
|
@ -2056,7 +2056,6 @@ if (m_shape != null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (colliding.Count > 0)
|
if (colliding.Count > 0)
|
||||||
{
|
{
|
||||||
|
@ -2312,8 +2311,8 @@ if (m_shape != null) {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendFullUpdateToAllClients()
|
public void SendFullUpdateToAllClients()
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
|
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||||
for (int i = 0; i < avatars.Count; i++)
|
for (int i = 0; i < avatars.Length; i++)
|
||||||
{
|
{
|
||||||
// Ugly reference :(
|
// Ugly reference :(
|
||||||
m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this,
|
m_parentGroup.SendPartFullUpdate(avatars[i].ControllingClient, this,
|
||||||
|
@ -2323,8 +2322,8 @@ if (m_shape != null) {
|
||||||
|
|
||||||
public void SendFullUpdateToAllClientsExcept(UUID agentID)
|
public void SendFullUpdateToAllClientsExcept(UUID agentID)
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
|
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||||
for (int i = 0; i < avatars.Count; i++)
|
for (int i = 0; i < avatars.Length; i++)
|
||||||
{
|
{
|
||||||
// Ugly reference :(
|
// Ugly reference :(
|
||||||
if (avatars[i].UUID != agentID)
|
if (avatars[i].UUID != agentID)
|
||||||
|
@ -2467,8 +2466,8 @@ if (m_shape != null) {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendTerseUpdateToAllClients()
|
public void SendTerseUpdateToAllClients()
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatars = m_parentGroup.Scene.GetScenePresences();
|
ScenePresence[] avatars = m_parentGroup.Scene.GetScenePresences();
|
||||||
for (int i = 0; i < avatars.Count; i++)
|
for (int i = 0; i < avatars.Length; i++)
|
||||||
{
|
{
|
||||||
SendTerseUpdateToClient(avatars[i].ControllingClient);
|
SendTerseUpdateToClient(avatars[i].ControllingClient);
|
||||||
}
|
}
|
||||||
|
|
|
@ -869,14 +869,16 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
m_isChildAgent = false;
|
m_isChildAgent = false;
|
||||||
|
|
||||||
List<ScenePresence> AnimAgents = m_scene.GetScenePresences();
|
ScenePresence[] animAgents = m_scene.GetScenePresences();
|
||||||
foreach (ScenePresence p in AnimAgents)
|
for (int i = 0; i < animAgents.Length; i++)
|
||||||
{
|
{
|
||||||
if (p != this)
|
ScenePresence presence = animAgents[i];
|
||||||
p.SendAnimPackToClient(ControllingClient);
|
|
||||||
}
|
|
||||||
m_scene.EventManager.TriggerOnMakeRootAgent(this);
|
|
||||||
|
|
||||||
|
if (presence != this)
|
||||||
|
presence.SendAnimPackToClient(ControllingClient);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_scene.EventManager.TriggerOnMakeRootAgent(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -2533,9 +2535,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
m_perfMonMS = Environment.TickCount;
|
m_perfMonMS = Environment.TickCount;
|
||||||
|
|
||||||
List<ScenePresence> avatars = m_scene.GetScenePresences();
|
ScenePresence[] avatars = m_scene.GetScenePresences();
|
||||||
foreach (ScenePresence avatar in avatars)
|
|
||||||
|
for (int i = 0; i < avatars.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence avatar = avatars[i];
|
||||||
|
|
||||||
// only send if this is the root (children are only "listening posts" in a foreign region)
|
// only send if this is the root (children are only "listening posts" in a foreign region)
|
||||||
if (!IsChildAgent)
|
if (!IsChildAgent)
|
||||||
{
|
{
|
||||||
|
@ -2553,7 +2558,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_scene.StatsReporter.AddAgentUpdates(avatars.Count);
|
m_scene.StatsReporter.AddAgentUpdates(avatars.Length);
|
||||||
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
|
||||||
|
|
||||||
//SendAnimPack();
|
//SendAnimPack();
|
||||||
|
|
|
@ -7227,13 +7227,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
public LSL_Integer llGetNumberOfPrims()
|
public LSL_Integer llGetNumberOfPrims()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
List<ScenePresence> presences = World.GetScenePresences();
|
ScenePresence[] presences = World.GetScenePresences();
|
||||||
if (presences.Count == 0)
|
if (presences.Length == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int avatarCount = 0;
|
int avatarCount = 0;
|
||||||
foreach (ScenePresence presence in presences)
|
for (int i = 0; i < presences.Length; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence presence = presences[i];
|
||||||
|
|
||||||
if (!presence.IsChildAgent && presence.ParentID != 0)
|
if (!presence.IsChildAgent && presence.ParentID != 0)
|
||||||
{
|
{
|
||||||
if (m_host.ParentGroup.HasChildPrim(presence.ParentID))
|
if (m_host.ParentGroup.HasChildPrim(presence.ParentID))
|
||||||
|
|
|
@ -404,7 +404,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||||
|
|
||||||
private List<SensedEntity> doAgentSensor(SenseRepeatClass ts)
|
private List<SensedEntity> doAgentSensor(SenseRepeatClass ts)
|
||||||
{
|
{
|
||||||
List<ScenePresence> Presences;
|
List<ScenePresence> presences;
|
||||||
List<SensedEntity> sensedEntities = new List<SensedEntity>();
|
List<SensedEntity> sensedEntities = new List<SensedEntity>();
|
||||||
|
|
||||||
// If this is an avatar sense by key try to get them directly
|
// If this is an avatar sense by key try to get them directly
|
||||||
|
@ -414,16 +414,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||||
ScenePresence p = m_CmdManager.m_ScriptEngine.World.GetScenePresence(ts.keyID);
|
ScenePresence p = m_CmdManager.m_ScriptEngine.World.GetScenePresence(ts.keyID);
|
||||||
if (p == null)
|
if (p == null)
|
||||||
return sensedEntities;
|
return sensedEntities;
|
||||||
Presences = new List<ScenePresence>();
|
presences = new List<ScenePresence>();
|
||||||
Presences.Add(p);
|
presences.Add(p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Presences = m_CmdManager.m_ScriptEngine.World.GetScenePresences();
|
presences = new List<ScenePresence>(m_CmdManager.m_ScriptEngine.World.GetScenePresences());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If nobody about quit fast
|
// If nobody about quit fast
|
||||||
if (Presences.Count == 0)
|
if (presences.Count == 0)
|
||||||
return sensedEntities;
|
return sensedEntities;
|
||||||
|
|
||||||
SceneObjectPart SensePoint = ts.host;
|
SceneObjectPart SensePoint = ts.host;
|
||||||
|
@ -440,8 +440,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||||
Vector3 toRegionPos;
|
Vector3 toRegionPos;
|
||||||
double dis;
|
double dis;
|
||||||
|
|
||||||
foreach (ScenePresence presence in Presences)
|
for (int i = 0; i < presences.Count; i++)
|
||||||
{
|
{
|
||||||
|
ScenePresence presence = presences[i];
|
||||||
bool keep = true;
|
bool keep = true;
|
||||||
|
|
||||||
if (presence.IsDeleted)
|
if (presence.IsDeleted)
|
||||||
|
|
|
@ -68,11 +68,11 @@ namespace OpenSim.Region.UserStatistics
|
||||||
HTMLUtil.OL_O(ref output, "");
|
HTMLUtil.OL_O(ref output, "");
|
||||||
foreach (Scene scene in all_scenes)
|
foreach (Scene scene in all_scenes)
|
||||||
{
|
{
|
||||||
List<ScenePresence> avatarInScene = scene.GetScenePresences();
|
ScenePresence[] avatarInScene = scene.GetScenePresences();
|
||||||
|
|
||||||
HTMLUtil.LI_O(ref output, "");
|
HTMLUtil.LI_O(ref output, String.Empty);
|
||||||
output.Append(scene.RegionInfo.RegionName);
|
output.Append(scene.RegionInfo.RegionName);
|
||||||
HTMLUtil.OL_O(ref output, "");
|
HTMLUtil.OL_O(ref output, String.Empty);
|
||||||
foreach (ScenePresence av in avatarInScene)
|
foreach (ScenePresence av in avatarInScene)
|
||||||
{
|
{
|
||||||
Dictionary<string,string> queues = new Dictionary<string, string>();
|
Dictionary<string,string> queues = new Dictionary<string, string>();
|
||||||
|
@ -81,7 +81,7 @@ namespace OpenSim.Region.UserStatistics
|
||||||
IStatsCollector isClient = (IStatsCollector) av.ControllingClient;
|
IStatsCollector isClient = (IStatsCollector) av.ControllingClient;
|
||||||
queues = decodeQueueReport(isClient.Report());
|
queues = decodeQueueReport(isClient.Report());
|
||||||
}
|
}
|
||||||
HTMLUtil.LI_O(ref output, "");
|
HTMLUtil.LI_O(ref output, String.Empty);
|
||||||
output.Append(av.Name);
|
output.Append(av.Name);
|
||||||
output.Append(" ");
|
output.Append(" ");
|
||||||
output.Append((av.IsChildAgent ? "Child" : "Root"));
|
output.Append((av.IsChildAgent ? "Child" : "Root"));
|
||||||
|
@ -97,11 +97,11 @@ namespace OpenSim.Region.UserStatistics
|
||||||
}
|
}
|
||||||
Dictionary<string, int> throttles = DecodeClientThrottles(av.ControllingClient.GetThrottlesPacked(1));
|
Dictionary<string, int> throttles = DecodeClientThrottles(av.ControllingClient.GetThrottlesPacked(1));
|
||||||
|
|
||||||
HTMLUtil.UL_O(ref output, "");
|
HTMLUtil.UL_O(ref output, String.Empty);
|
||||||
|
|
||||||
foreach (string throttlename in throttles.Keys)
|
foreach (string throttlename in throttles.Keys)
|
||||||
{
|
{
|
||||||
HTMLUtil.LI_O(ref output, "");
|
HTMLUtil.LI_O(ref output, String.Empty);
|
||||||
output.Append(throttlename);
|
output.Append(throttlename);
|
||||||
output.Append(":");
|
output.Append(":");
|
||||||
output.Append(throttles[throttlename].ToString());
|
output.Append(throttles[throttlename].ToString());
|
||||||
|
|
Loading…
Reference in New Issue