aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs81
1 files changed, 25 insertions, 56 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index a86a33c..4b97e39 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3269,7 +3269,7 @@ namespace OpenSim.Region.Framework.Scenes
3269 } 3269 }
3270 } 3270 }
3271 3271
3272 ScenePresence sp = m_sceneGraph.GetScenePresence(agent.AgentID); 3272 ScenePresence sp = GetScenePresence(agent.AgentID);
3273 if (sp != null) 3273 if (sp != null)
3274 { 3274 {
3275 m_log.DebugFormat( 3275 m_log.DebugFormat(
@@ -3561,8 +3561,7 @@ namespace OpenSim.Region.Framework.Scenes
3561 /// <param name="message">message to display to the user. Reason for being logged off</param> 3561 /// <param name="message">message to display to the user. Reason for being logged off</param>
3562 public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message) 3562 public void HandleLogOffUserFromGrid(UUID AvatarID, UUID RegionSecret, string message)
3563 { 3563 {
3564 ScenePresence loggingOffUser = null; 3564 ScenePresence loggingOffUser = GetScenePresence(AvatarID);
3565 loggingOffUser = GetScenePresence(AvatarID);
3566 if (loggingOffUser != null) 3565 if (loggingOffUser != null)
3567 { 3566 {
3568 UUID localRegionSecret = UUID.Zero; 3567 UUID localRegionSecret = UUID.Zero;
@@ -3598,8 +3597,8 @@ namespace OpenSim.Region.Framework.Scenes
3598 /// <param name="isFlying"></param> 3597 /// <param name="isFlying"></param>
3599 public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying) 3598 public virtual void AgentCrossing(UUID agentID, Vector3 position, bool isFlying)
3600 { 3599 {
3601 ScenePresence presence; 3600 ScenePresence presence = GetScenePresence(agentID);
3602 if(m_sceneGraph.TryGetAvatar(agentID, out presence)) 3601 if(presence != null)
3603 { 3602 {
3604 try 3603 try
3605 { 3604 {
@@ -3773,8 +3772,8 @@ namespace OpenSim.Region.Framework.Scenes
3773 public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position, 3772 public void RequestTeleportLocation(IClientAPI remoteClient, ulong regionHandle, Vector3 position,
3774 Vector3 lookAt, uint teleportFlags) 3773 Vector3 lookAt, uint teleportFlags)
3775 { 3774 {
3776 ScenePresence sp; 3775 ScenePresence sp = GetScenePresence(remoteClient.AgentId);
3777 if(m_sceneGraph.TryGetAvatar(remoteClient.AgentId, out sp)) 3776 if (sp != null)
3778 { 3777 {
3779 uint regionX = m_regInfo.RegionLocX; 3778 uint regionX = m_regInfo.RegionLocX;
3780 uint regionY = m_regInfo.RegionLocY; 3779 uint regionY = m_regInfo.RegionLocY;
@@ -3952,17 +3951,17 @@ namespace OpenSim.Region.Framework.Scenes
3952 m_log.ErrorFormat("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname", 3951 m_log.ErrorFormat("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16}{5,-16}{6,-16}", "Firstname", "Lastname",
3953 "Agent ID", "Session ID", "Circuit", "IP", "World"); 3952 "Agent ID", "Session ID", "Circuit", "IP", "World");
3954 3953
3955 foreach (ScenePresence scenePresence in GetAvatars()) 3954 ForEachScenePresence(delegate(ScenePresence sp)
3956 { 3955 {
3957 m_log.ErrorFormat("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}", 3956 m_log.ErrorFormat("{0,-16}{1,-16}{2,-25}{3,-25}{4,-16},{5,-16}{6,-16}",
3958 scenePresence.Firstname, 3957 sp.Firstname,
3959 scenePresence.Lastname, 3958 sp.Lastname,
3960 scenePresence.UUID, 3959 sp.UUID,
3961 scenePresence.ControllingClient.AgentId, 3960 sp.ControllingClient.AgentId,
3962 "Unknown", 3961 "Unknown",
3963 "Unknown", 3962 "Unknown",
3964 RegionInfo.RegionName); 3963 RegionInfo.RegionName);
3965 } 3964 });
3966 3965
3967 break; 3966 break;
3968 } 3967 }
@@ -4128,72 +4127,42 @@ namespace OpenSim.Region.Framework.Scenes
4128 m_sceneGraph.RemovePhysicalPrim(num); 4127 m_sceneGraph.RemovePhysicalPrim(num);
4129 } 4128 }
4130 4129
4131 //The idea is to have a group of method that return a list of avatars meeting some requirement 4130 public int GetRootAgentCount()
4132 // ie it could be all m_scenePresences within a certain range of the calling prim/avatar.
4133 //
4134 // GetAvatars returns a new list of all root agent presences in the scene
4135 // GetScenePresences returns a new list of all presences in the scene or a filter may be passed.
4136 // GetScenePresence returns the presence with matching UUID or first/last name.
4137 // ForEachScenePresence requests the Scene to run a delegate function against all presences.
4138
4139 /// <summary>
4140 /// Return a list of all avatars in this region.
4141 /// This list is a new object, so it can be iterated over without locking.
4142 /// </summary>
4143 /// <returns></returns>
4144 public List<ScenePresence> GetAvatars()
4145 {
4146 return m_sceneGraph.GetAvatars();
4147 }
4148
4149 /// <summary>
4150 /// Return a list of all ScenePresences in this region. This returns child agents as well as root agents.
4151 /// This list is a new object, so it can be iterated over without locking.
4152 /// </summary>
4153 /// <returns></returns>
4154 public List<ScenePresence> GetScenePresences()
4155 { 4131 {
4156 return m_sceneGraph.GetScenePresences(); 4132 return m_sceneGraph.GetRootAgentCount();
4157 } 4133 }
4158 4134
4159 /// <summary> 4135 public int GetChildAgentCount()
4160 /// Request a filtered list of ScenePresences in this region.
4161 /// This list is a new object, so it can be iterated over without locking.
4162 /// </summary>
4163 /// <param name="filter"></param>
4164 /// <returns></returns>
4165 public List<ScenePresence> GetScenePresences(FilterAvatarList filter)
4166 { 4136 {
4167 return m_sceneGraph.GetScenePresences(filter); 4137 return m_sceneGraph.GetChildAgentCount();
4168 } 4138 }
4169 4139
4170 /// <summary> 4140 /// <summary>
4171 /// Request a scene presence by UUID 4141 /// Request a scene presence by UUID. Fast, indexed lookup.
4172 /// </summary> 4142 /// </summary>
4173 /// <param name="avatarID"></param> 4143 /// <param name="agentID"></param>
4174 /// <returns></returns> 4144 /// <returns>null if the presence was not found</returns>
4175 public ScenePresence GetScenePresence(UUID avatarID) 4145 public ScenePresence GetScenePresence(UUID agentID)
4176 { 4146 {
4177 return m_sceneGraph.GetScenePresence(avatarID); 4147 return m_sceneGraph.GetScenePresence(agentID);
4178 } 4148 }
4179 4149
4180 /// <summary> 4150 /// <summary>
4181 /// Request the ScenePresence in this region by first/last name. 4151 /// Request the scene presence by name.
4182 /// Should normally only be a single match, but first is always returned
4183 /// </summary> 4152 /// </summary>
4184 /// <param name="firstName"></param> 4153 /// <param name="firstName"></param>
4185 /// <param name="lastName"></param> 4154 /// <param name="lastName"></param>
4186 /// <returns></returns> 4155 /// <returns>null if the presence was not found</returns>
4187 public ScenePresence GetScenePresence(string firstName, string lastName) 4156 public ScenePresence GetScenePresence(string firstName, string lastName)
4188 { 4157 {
4189 return m_sceneGraph.GetScenePresence(firstName, lastName); 4158 return m_sceneGraph.GetScenePresence(firstName, lastName);
4190 } 4159 }
4191 4160
4192 /// <summary> 4161 /// <summary>
4193 /// Request the ScenePresence in this region by localID. 4162 /// Request the scene presence by localID.
4194 /// </summary> 4163 /// </summary>
4195 /// <param name="localID"></param> 4164 /// <param name="localID"></param>
4196 /// <returns></returns> 4165 /// <returns>null if the presence was not found</returns>
4197 public ScenePresence GetScenePresence(uint localID) 4166 public ScenePresence GetScenePresence(uint localID)
4198 { 4167 {
4199 return m_sceneGraph.GetScenePresence(localID); 4168 return m_sceneGraph.GetScenePresence(localID);