var playerPool = GetPlayerPool(ent, pool, def);
var count = GetTargetAntagCount(ent, GetTotalPlayerCount(pool), def);
+ // if there is both a spawner and players getting picked, let it fall back to a spawner.
+ var noSpawner = def.SpawnerPrototype == null;
for (var i = 0; i < count; i++)
{
var session = (ICommonSession?) null;
if (def.PickPlayer)
{
- if (!playerPool.TryPickAndTake(RobustRandom, out session))
+ if (!playerPool.TryPickAndTake(RobustRandom, out session) && noSpawner)
+ {
+ Log.Warning($"Couldn't pick a player for {ToPrettyString(ent):rule}, no longer choosing antags for this definition");
break;
+ }
- if (ent.Comp.SelectedSessions.Contains(session))
+ if (session != null && ent.Comp.SelectedSessions.Contains(session))
+ {
+ Log.Warning($"Somehow picked {session} for an antag when this rule already selected them previously");
continue;
+ }
}
MakeAntag(ent, session, def);
/// <summary>
/// Whether or not players should be picked to inhabit this antag or not.
+ /// If no players are left and <see cref="SpawnerPrototype"/> is set, it will make a ghost role.
/// </summary>
[DataField]
public bool PickPlayer = true;
- sprite: Structures/Wallmounts/signs.rsi
state: radiation
+- type: entity
+ noSpawn: true
+ parent: SpawnPointLoneNukeOperative
+ id: SpawnPointNukeopsCommander
+ components:
+ - type: GhostRole
+ name: roles-antag-nuclear-operative-commander-name
+ description: roles-antag-nuclear-operative-commander-objective
+
+- type: entity
+ noSpawn: true
+ parent: SpawnPointLoneNukeOperative
+ id: SpawnPointNukeopsMedic
+ components:
+ - type: GhostRole
+ name: roles-antag-nuclear-operative-agent-name
+ description: roles-antag-nuclear-operative-agent-objective
+
+- type: entity
+ noSpawn: true
+ parent: SpawnPointLoneNukeOperative
+ id: SpawnPointNukeopsOperative
+ components:
+ - type: GhostRole
+ name: roles-antag-nuclear-operative-name
+ description: roles-antag-nuclear-operative-objective
+
- type: entity
parent: MarkerBase
id: SpawnPointGhostDragon
definitions:
- prefRoles: [ NukeopsCommander ]
fallbackRoles: [ Nukeops, NukeopsMedic ]
- max: 1
- playerRatio: 10
+ spawnerPrototype: SpawnPointNukeopsCommander
startingGear: SyndicateCommanderGearFull
components:
- type: NukeOperative
prototype: NukeopsCommander
- prefRoles: [ NukeopsMedic ]
fallbackRoles: [ Nukeops, NukeopsCommander ]
- max: 1
- playerRatio: 10
+ spawnerPrototype: SpawnPointNukeopsMedic
startingGear: SyndicateOperativeMedicFull
components:
- type: NukeOperative
prototype: NukeopsMedic
- prefRoles: [ Nukeops ]
fallbackRoles: [ NukeopsCommander, NukeopsMedic ]
- min: 0
+ spawnerPrototype: SpawnPointNukeopsOperative
max: 3
playerRatio: 10
startingGear: SyndicateOperativeGearFull