Skip to content

Commit

Permalink
micro fix upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemirda committed Jun 7, 2024
1 parent dad4484 commit d63dce7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public sealed class AddSponsorCommand : IConsoleCommand

public string Command => "addsponsor";
public string Description => "Adds a sponsor by their user ID.";
public string Help => $"Usage: {Command} <user ID> [allowedAntag] [OOC color] [allowedMarkings]";
public string Help => $"Usage: {Command} <user ID> [allowedAntag] [OOC color]";

public void Execute(IConsoleShell shell, string argStr, string[] args)
{
Expand Down
10 changes: 8 additions & 2 deletions Content.Server/Antag/AntagSelectionSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,16 @@ public AntagSelectionPlayerPool GetPlayerPool(Entity<AntagSelectionComponent> en
{
bool allowedAntag = _sponsorsManager.GetSponsorAllowedAntag(session.UserId);

if (allowedAntag == true)
if (allowedAntag)
{
sponsorPrefList.Add(session);
Log.Info($"Added sponsor: {session}");
}
}
else
{
Log.Info($"Skipped: {session}");
}
// A-13 SponsorAntag end

var pref = (HumanoidCharacterProfile) _pref.GetPreferences(session.UserId).SelectedCharacter;
Expand All @@ -372,7 +377,8 @@ public AntagSelectionPlayerPool GetPlayerPool(Entity<AntagSelectionComponent> en
// A-13 SponsorAntag start
if (sponsorPrefList.Count > 0)
{
return new AntagSelectionPlayerPool(new() { sponsorPrefList, preferredList, fallbackList, unwantedList, invalidList });
Log.Info($"Added sponsor pool: {sponsorPrefList.Count}");
preferredList.AddRange(sponsorPrefList);
}
// A-13 SponsorAntag end

Expand Down
20 changes: 1 addition & 19 deletions Content.Server/GameTicking/Rules/TraitorRuleSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
using System.Linq;
using System.Text;
using Content.Server.GameTicking.Components;
using Robust.Server.Player; // A-13 SponsorAntag
using Content.Server.Andromeda.AndromedaSponsorService; //A-13 SponsorAntag

namespace Content.Server.GameTicking.Rules;

Expand All @@ -32,8 +30,6 @@ public sealed class TraitorRuleSystem : GameRuleSystem<TraitorRuleComponent>
[Dependency] private readonly SharedRoleSystem _roleSystem = default!;
[Dependency] private readonly SharedJobSystem _jobs = default!;
[Dependency] private readonly ObjectivesSystem _objectives = default!;
[Dependency] private readonly IPlayerManager _playerSystem = default!; //A-13 SponsorAntag
[Dependency] private readonly AndromedaSponsorManager _sponsorsManager = default!; // A-13 SponsorAntag

public const int MaxPicks = 20;

Expand All @@ -55,21 +51,7 @@ protected override void Added(EntityUid uid, TraitorRuleComponent component, Gam

private void AfterEntitySelected(Entity<TraitorRuleComponent> ent, ref AfterAntagEntitySelectedEvent args)
{
// A-13 SponsorAntag start
if (_playerSystem.TryGetSessionByEntity(args.EntityUid, out var session) && _sponsorsManager.IsSponsor(session.UserId))
{
bool allowedAntag = _sponsorsManager.GetSponsorAllowedAntag(session.UserId);

if (allowedAntag == true)
{
MakeTraitor(args.EntityUid, ent, true, true);
}
else
{
MakeTraitor(args.EntityUid, ent);
}
}
// A-13 SponsorAntag end
MakeTraitor(args.EntityUid, ent);
}

private void MakeCodewords(TraitorRuleComponent component)
Expand Down

0 comments on commit d63dce7

Please sign in to comment.