Fix borgs being able to emag themselves (#24748)

* Fix self emagging borgs

* Add popup on self emag failure.
This commit is contained in:
Jajsha
2024-02-11 01:23:32 -05:00
committed by GitHub
parent b2d0dd9c30
commit 402051c670
2 changed files with 9 additions and 0 deletions

View 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)