Skip to content

Commit

Permalink
Fix borgs being able to emag themselves (space-wizards#24748)
Browse files Browse the repository at this point in the history
* Fix self emagging borgs

* Add popup on self emag failure.
  • Loading branch information
Zap527 authored and joshepvodka committed Feb 18, 2024
1 parent 3c235eb commit cb85630
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Content.Shared/Silicons/Laws/SharedSiliconLawSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ public override void Initialize()

protected virtual void OnAttemptEmag(EntityUid uid, EmagSiliconLawComponent component, ref OnAttemptEmagEvent args)
{
//prevent self emagging
if (uid == args.UserUid)
{
_popup.PopupClient(Loc.GetString("law-emag-cannot-emag-self"), uid, args.UserUid);
args.Handled = true;
return;
}

if (component.RequireOpenPanel &&
TryComp<WiresPanelComponent>(uid, out var panel) &&
!panel.Open)
Expand Down
1 change: 1 addition & 0 deletions Resources/Locale/en-US/station-laws/laws.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ laws-owner-spider-clan = Spider Clan members
law-emag-custom = Only {$name} and people they designate as such are {$title}.
law-emag-secrecy = You must maintain the secrecy of any orders given by {$faction} except when doing so would conflict with any previous law.
law-emag-require-panel = The panel must be open to use the EMAG.
law-emag-cannot-emag-self = You cannot use the EMAG on yourself.
laws-ui-menu-title = Laws
laws-ui-law-header = Law {$id}
Expand Down

0 comments on commit cb85630

Please sign in to comment.