]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix borgs being able to emag themselves (#24748)
authorJajsha <101492056+Zap527@users.noreply.github.com>
Sun, 11 Feb 2024 06:23:32 +0000 (01:23 -0500)
committerGitHub <noreply@github.com>
Sun, 11 Feb 2024 06:23:32 +0000 (22:23 -0800)
* Fix self emagging borgs

* Add popup on self emag failure.

Content.Shared/Silicons/Laws/SharedSiliconLawSystem.cs
Resources/Locale/en-US/station-laws/laws.ftl

index 9aa0aa9a381aebd43accb4f2a686af7a217a57a9..c0619e6e43d47d5a67cb5580c2a3aca3a3fa7bfe 100644 (file)
@@ -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<WiresPanelComponent>(uid, out var panel) &&
             !panel.Open)
index 1823d0782e5241960eaad19e5c55de04e5855ea6..f73755a359c42149a0ad0a2c88c75b818f2e34b2 100644 (file)
@@ -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}