Fixed players without headrevs ticked being picked anyway (#20895)
* Fixy fix fix uwu merge pwease * admin message to inform them * oop
This commit is contained in:
@@ -116,14 +116,13 @@ public sealed class AntagSelectionSystem : GameRuleSystem<GameRuleComponent>
|
||||
var antags = Math.Clamp(allPlayers.Count / antagsPerPlayer, 1, maxAntags);
|
||||
for (var antag = 0; antag < antags; antag++)
|
||||
{
|
||||
IPlayerSession chosenPlayer;
|
||||
IPlayerSession chosenPlayer = null!;
|
||||
if (prefList.Count == 0)
|
||||
{
|
||||
if (playerList.Count == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
chosenPlayer = _random.PickAndTake(playerList);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -29,6 +29,9 @@ public sealed partial class RevolutionaryRuleComponent : Component
|
||||
[DataField]
|
||||
public Dictionary<string, EntityUid> HeadRevs = new();
|
||||
|
||||
[DataField]
|
||||
public ProtoId<AntagPrototype> HeadRevPrototypeId = "HeadRev";
|
||||
|
||||
[DataField]
|
||||
public ProtoId<AntagPrototype> RevPrototypeId = "Rev";
|
||||
|
||||
|
||||
@@ -142,9 +142,14 @@ public sealed class RevolutionaryRuleSystem : GameRuleSystem<RevolutionaryRuleCo
|
||||
var query = QueryActiveRules();
|
||||
while (query.MoveNext(out _, out var comp, out _))
|
||||
{
|
||||
_antagSelection.EligiblePlayers(comp.RevPrototypeId, comp.MaxHeadRevs, comp.PlayersPerHeadRev, comp.HeadRevStartSound,
|
||||
_antagSelection.EligiblePlayers(comp.HeadRevPrototypeId, comp.MaxHeadRevs, comp.PlayersPerHeadRev, comp.HeadRevStartSound,
|
||||
"head-rev-role-greeting", "#5e9cff", out var chosen);
|
||||
if (!chosen.Any())
|
||||
GiveHeadRev(chosen, comp.RevPrototypeId, comp);
|
||||
else
|
||||
{
|
||||
_chatManager.SendAdminAnnouncement(Loc.GetString("rev-no-heads"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ rev-description = Revolutionaries are among us.
|
||||
|
||||
rev-not-enough-ready-players = Not enough players readied up for the game. There were {$readyPlayersCount} players readied up out of {$minimumPlayers} needed. Can't start a Revolution.
|
||||
rev-no-one-ready = No players readied up! Can't start a Revolution.
|
||||
rev-no-heads = There were no Head Revolutionaries to be selected. Can't start a Revolution.
|
||||
|
||||
rev-all-heads-dead = All the heads are dead, now finish up the rest of the crew!
|
||||
|
||||
|
||||
Reference in New Issue
Block a user