Implement agent limits

bulletsim
Melanie 2011-04-21 23:03:38 +01:00
parent 212326eeb0
commit 13d6e05d5a
2 changed files with 25 additions and 0 deletions

View File

@ -3665,6 +3665,15 @@ namespace OpenSim.Region.Framework.Scenes
return false; return false;
} }
int num = m_sceneGraph.GetNumberOfScenePresences();
if (num >= RegionInfo.RegionSettings.AgentLimit)
{
if (!Permissions.IsAdministrator(cAgentData.AgentID))
return false;
}
ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID);
if (childAgentUpdate != null) if (childAgentUpdate != null)
@ -4966,6 +4975,17 @@ namespace OpenSim.Region.Framework.Scenes
// child agent creation, thereby emulating the SL behavior. // child agent creation, thereby emulating the SL behavior.
public bool QueryAccess(UUID agentID, Vector3 position, out string reason) public bool QueryAccess(UUID agentID, Vector3 position, out string reason)
{ {
int num = m_sceneGraph.GetNumberOfScenePresences();
if (num >= RegionInfo.RegionSettings.AgentLimit)
{
if (!Permissions.IsAdministrator(agentID))
{
reason = "The region is full";
return false;
}
}
reason = String.Empty; reason = String.Empty;
return true; return true;
} }

View File

@ -800,6 +800,11 @@ namespace OpenSim.Region.Framework.Scenes
return m_scenePresenceArray; return m_scenePresenceArray;
} }
public int GetNumberOfScenePresences()
{
return m_scenePresenceArray.Count;
}
/// <summary> /// <summary>
/// Request a scene presence by UUID. Fast, indexed lookup. /// Request a scene presence by UUID. Fast, indexed lookup.
/// </summary> /// </summary>