Skip to content

Commit

Permalink
Fix antag verb incorrectly giving role to admin player instead of tar…
Browse files Browse the repository at this point in the history
…get (#27584)

Fix antag verb giving role to admin player instead of target
  • Loading branch information
Ciac32 authored May 1, 2024
1 parent 6e1f0ba commit 6484722
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Content.Server/Administration/Systems/AdminVerbSystem.Antags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,19 @@ private void AddAntagVerbs(GetVerbsEvent<Verb> args)
if (!_adminManager.HasAdminFlag(player, AdminFlags.Fun))
return;

if (!HasComp<MindContainerComponent>(args.Target))
if (!HasComp<MindContainerComponent>(args.Target) || !TryComp<ActorComponent>(args.Target, out var targetActor))
return;

var targetPlayer = targetActor.PlayerSession;

Verb traitor = new()
{
Text = Loc.GetString("admin-verb-text-make-traitor"),
Category = VerbCategory.Antag,
Icon = new SpriteSpecifier.Rsi(new ResPath("/Textures/Structures/Wallmounts/posters.rsi"), "poster5_contraband"),
Act = () =>
{
_antag.ForceMakeAntag<TraitorRuleComponent>(player, DefaultTraitorRule);
_antag.ForceMakeAntag<TraitorRuleComponent>(targetPlayer, DefaultTraitorRule);
},
Impact = LogImpact.High,
Message = Loc.GetString("admin-verb-make-traitor"),
Expand Down Expand Up @@ -83,7 +85,7 @@ private void AddAntagVerbs(GetVerbsEvent<Verb> args)
Icon = new SpriteSpecifier.Rsi(new("/Textures/Structures/Wallmounts/signs.rsi"), "radiation"),
Act = () =>
{
_antag.ForceMakeAntag<NukeopsRuleComponent>(player, DefaultNukeOpRule);
_antag.ForceMakeAntag<NukeopsRuleComponent>(targetPlayer, DefaultNukeOpRule);
},
Impact = LogImpact.High,
Message = Loc.GetString("admin-verb-make-nuclear-operative"),
Expand Down Expand Up @@ -112,7 +114,7 @@ private void AddAntagVerbs(GetVerbsEvent<Verb> args)
Icon = new SpriteSpecifier.Rsi(new("/Textures/Interface/Misc/job_icons.rsi"), "HeadRevolutionary"),
Act = () =>
{
_antag.ForceMakeAntag<RevolutionaryRuleComponent>(player, DefaultRevsRule);
_antag.ForceMakeAntag<RevolutionaryRuleComponent>(targetPlayer, DefaultRevsRule);
},
Impact = LogImpact.High,
Message = Loc.GetString("admin-verb-make-head-rev"),
Expand All @@ -126,7 +128,7 @@ private void AddAntagVerbs(GetVerbsEvent<Verb> args)
Icon = new SpriteSpecifier.Rsi(new ResPath("/Textures/Clothing/Hands/Gloves/Color/black.rsi"), "icon"),
Act = () =>
{
_antag.ForceMakeAntag<ThiefRuleComponent>(player, DefaultThiefRule);
_antag.ForceMakeAntag<ThiefRuleComponent>(targetPlayer, DefaultThiefRule);
},
Impact = LogImpact.High,
Message = Loc.GetString("admin-verb-make-thief"),
Expand Down

0 comments on commit 6484722

Please sign in to comment.