From 402051c670a66d08726e0ec16f8fa5735bb0f60f Mon Sep 17 00:00:00 2001 From: Jajsha <101492056+Zap527@users.noreply.github.com> Date: Sun, 11 Feb 2024 01:23:32 -0500 Subject: [PATCH] Fix borgs being able to emag themselves (#24748) * Fix self emagging borgs * Add popup on self emag failure. --- Content.Shared/Silicons/Laws/SharedSiliconLawSystem.cs | 8 ++++++++ Resources/Locale/en-US/station-laws/laws.ftl | 1 + 2 files changed, 9 insertions(+) diff --git a/Content.Shared/Silicons/Laws/SharedSiliconLawSystem.cs b/Content.Shared/Silicons/Laws/SharedSiliconLawSystem.cs index 9aa0aa9a38..c0619e6e43 100644 --- a/Content.Shared/Silicons/Laws/SharedSiliconLawSystem.cs +++ b/Content.Shared/Silicons/Laws/SharedSiliconLawSystem.cs @@ -21,6 +21,14 @@ public abstract class SharedSiliconLawSystem : EntitySystem 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(uid, out var panel) && !panel.Open) diff --git a/Resources/Locale/en-US/station-laws/laws.ftl b/Resources/Locale/en-US/station-laws/laws.ftl index 1823d0782e..f73755a359 100644 --- a/Resources/Locale/en-US/station-laws/laws.ftl +++ b/Resources/Locale/en-US/station-laws/laws.ftl @@ -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} -- 2.52.0