Skip to content

Commit

Permalink
Fix antag selection for sponsor
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemirda committed Mar 28, 2024
1 parent 7a9d03b commit 31f955d
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions Content.Server/Antag/AntagSelectionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,16 +207,6 @@ public List<EntityUid> ChooseAntags(int count, params List<EntityUid>[] eligible
playerList.Remove(chosenPlayer);
}

// A-13 No Thief-Agents system v5 start
var allPlayers = _playerSystem.Sessions.ToList();
foreach (var player in allPlayers)
if (HasComp<ThiefCheckComponent>(player.AttachedEntity))
{
Logger.InfoS("ANTAG", "Skipping player cuz he is already a thief.");
continue;
}
// A-13 No Thief-Agents system v5 end

//If we have reached the desired number of players, skip
if (chosenPlayers.Count >= count)
continue;
Expand Down Expand Up @@ -275,7 +265,7 @@ public List<ICommonSession> ChooseAntags(int count, params List<ICommonSession>[
var allPlayers = _playerSystem.Sessions.ToList();
foreach (var player in allPlayers)
{
if (_sponsorsManager.TryGetInfo(player.UserId, out var sponsor) && sponsor.ExtraSlots == 7) // Cringe check until Tehnox update our service
if (_sponsorsManager.TryGetInfo(player.UserId, out var sponsor) && sponsor.ExtraSlots >= 7) //Checker
{
sponsorPrefList.Add(player);
}
Expand All @@ -284,12 +274,16 @@ public List<ICommonSession> ChooseAntags(int count, params List<ICommonSession>[
while (sponsorPrefList.Count > 0 && count > 0)
{
var player = RobustRandom.PickAndTake(sponsorPrefList);
eligiblePlayerLists.Remove(player);
playerList.Remove(player);
chosenPlayers.Add(player);
count -= 1;
Logger.InfoS("sponsor", "Selected a sponsor antag!");
Logger.InfoS("SPONSOR", "Selected a sponsor antag!");
}
// If we have reached the desired number of players, exit the loop
if (chosenPlayers.Count >= count)
{
break;
}
if (count == 0) return chosenPlayers;
// A-13 SponsorAntag end

//If we have reached the desired number of players, skip
Expand Down

0 comments on commit 31f955d

Please sign in to comment.