mirror of
https://github.com/opensim/opensim.git
synced 2026-08-08 02:05:34 +08:00
add a optional limit on number of npcs per scene default = 40
This commit is contained in:
@@ -51,6 +51,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
private readonly Dictionary<UUID, NPCAvatar> m_avatars = new Dictionary<UUID, NPCAvatar>();
|
||||
private NPCOptionsFlags m_NPCOptionFlags;
|
||||
|
||||
private int m_MaxNumberNPCperScene = 40;
|
||||
|
||||
public NPCOptionsFlags NPCOptionFlags {get {return m_NPCOptionFlags;}}
|
||||
|
||||
public bool Enabled { get; private set; }
|
||||
@@ -74,6 +76,8 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
|
||||
if(config.GetBoolean("NoNPCGroup", true))
|
||||
m_NPCOptionFlags |= NPCOptionsFlags.NoNPCGroup;
|
||||
|
||||
m_MaxNumberNPCperScene = config.GetInt("MaxNumberNPCsPerScene", m_MaxNumberNPCperScene);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,6 +165,12 @@ namespace OpenSim.Region.OptionalModules.World.NPC
|
||||
Vector3 position, UUID agentID, UUID owner, string groupTitle, UUID groupID, bool senseAsAgent, Scene scene,
|
||||
AvatarAppearance appearance)
|
||||
{
|
||||
if(m_MaxNumberNPCperScene > 0)
|
||||
{
|
||||
if(scene.GetRootNPCCount() >= m_MaxNumberNPCperScene)
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
NPCAvatar npcAvatar = null;
|
||||
string born = DateTime.UtcNow.ToString();
|
||||
|
||||
|
||||
@@ -1208,6 +1208,11 @@
|
||||
;# {Enabled} {} {Enable Non Player Character (NPC) facilities} {true false} false
|
||||
; Enabled = false
|
||||
|
||||
;; max number of NPCs per scene default: 40
|
||||
;; set to a negative value to allow any number
|
||||
;; note that a NPC is almost as heavy as a normal avatar, so you should limit them
|
||||
;; MaxNumberNPCsPerScene = 40
|
||||
|
||||
;; several options to control NPCs creation
|
||||
|
||||
;# {AllowNotOwned} {} {allow NPCs to be created not Owned} {true false} true
|
||||
|
||||
@@ -2142,6 +2142,12 @@
|
||||
[NPC]
|
||||
;; Enable Non Player Character (NPC) facilities
|
||||
Enabled = false
|
||||
|
||||
;; max number of NPCs per scene default: 40
|
||||
;; set to a negative value to allow any number
|
||||
;; note that a NPC is almost as heavy as a normal avatar, so you should limit them
|
||||
;; MaxNumberNPCsPerScene = 40
|
||||
|
||||
;; several options to control NPCs creation
|
||||
|
||||
;; allow NPCs to be created not Owned {true false} default: true
|
||||
|
||||
Reference in New Issue
Block a user