@@ -21,6 +21,8 @@ public sealed class GhostRecruitmentSystem : EntitySystem
|
|||||||
{
|
{
|
||||||
[Dependency] private readonly EuiManager _eui = default!;
|
[Dependency] private readonly EuiManager _eui = default!;
|
||||||
[Dependency] private readonly MindSystem _mind = default!;
|
[Dependency] private readonly MindSystem _mind = default!;
|
||||||
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
|
|
||||||
private readonly Dictionary<ICommonSession, GhostRecruitmentEuiAccept> _openUis = new();
|
private readonly Dictionary<ICommonSession, GhostRecruitmentEuiAccept> _openUis = new();
|
||||||
|
|
||||||
@@ -57,10 +59,12 @@ public sealed class GhostRecruitmentSystem : EntitySystem
|
|||||||
var spawners = GetEventSpawners(recruitmentName).ToList();
|
var spawners = GetEventSpawners(recruitmentName).ToList();
|
||||||
|
|
||||||
// We prioritize the queue, for example, the commander first, and then the engineer
|
// We prioritize the queue, for example, the commander first, and then the engineer
|
||||||
spawners = spawners.OrderBy(o => o.Item2.Priority).ToList();
|
spawners = spawners.OrderBy(o => o.Item2.Priority).ThenBy(_ => _random.Next()).ToList();
|
||||||
|
|
||||||
var count = 0;
|
var count = 0;
|
||||||
|
|
||||||
|
var maxCount = Math.Max(3, _playerManager.PlayerCount / 6);
|
||||||
|
|
||||||
var query = EntityQueryEnumerator<GhostRecruitedComponent>();
|
var query = EntityQueryEnumerator<GhostRecruitedComponent>();
|
||||||
|
|
||||||
while (query.MoveNext(out var uid,out var ghostRecruitedComponent))
|
while (query.MoveNext(out var uid,out var ghostRecruitedComponent))
|
||||||
@@ -72,7 +76,7 @@ public sealed class GhostRecruitmentSystem : EntitySystem
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// if there are too many recruited, then just skip
|
// if there are too many recruited, then just skip
|
||||||
if(count >= spawners.Count)
|
if(count >= spawners.Count || count >= maxCount)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var (spawnerUid, spawnerComponent) = spawners[count];
|
var (spawnerUid, spawnerComponent) = spawners[count];
|
||||||
|
|||||||
@@ -98,6 +98,7 @@
|
|||||||
- type: GhostRecruitmentSpawnPoint
|
- type: GhostRecruitmentSpawnPoint
|
||||||
prototype: RandomHumanoidSpawnerERTSecurity
|
prototype: RandomHumanoidSpawnerERTSecurity
|
||||||
recruitmentName: ERTRecruitment
|
recruitmentName: ERTRecruitment
|
||||||
|
priority: 2
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
layers:
|
layers:
|
||||||
- state: green
|
- state: green
|
||||||
@@ -111,6 +112,7 @@
|
|||||||
- type: GhostRecruitmentSpawnPoint
|
- type: GhostRecruitmentSpawnPoint
|
||||||
prototype: RandomHumanoidSpawnerERTSecurityEVA
|
prototype: RandomHumanoidSpawnerERTSecurityEVA
|
||||||
recruitmentName: ERTRecruitment
|
recruitmentName: ERTRecruitment
|
||||||
|
priority: 2
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
layers:
|
layers:
|
||||||
- state: green
|
- state: green
|
||||||
|
|||||||
Reference in New Issue
Block a user