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;
}
int num = m_sceneGraph.GetNumberOfScenePresences();
if (num >= RegionInfo.RegionSettings.AgentLimit)
{
if (!Permissions.IsAdministrator(cAgentData.AgentID))
return false;
}
ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID);
if (childAgentUpdate != null)
@ -4966,6 +4975,17 @@ namespace OpenSim.Region.Framework.Scenes
// child agent creation, thereby emulating the SL behavior.
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;
return true;
}

View File

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