Fix borg becoming emag immune if emag attempted with panel closed. (#23729)

* Fix borg becoming emag immune if emag attempted with panel closed.

* new event

* removed code added in accessreader

* fix emag 1984
This commit is contained in:
Arendian
2024-01-10 23:01:38 +01:00
committed by GitHub
parent 7aee192d52
commit 23e714e523
2 changed files with 18 additions and 2 deletions

View File

@@ -16,18 +16,23 @@ public abstract class SharedSiliconLawSystem : EntitySystem
public override void Initialize()
{
SubscribeLocalEvent<EmagSiliconLawComponent, GotEmaggedEvent>(OnGotEmagged);
SubscribeLocalEvent<EmagSiliconLawComponent, OnAttemptEmagEvent>(OnAttemptEmag);
}
protected virtual void OnGotEmagged(EntityUid uid, EmagSiliconLawComponent component, ref GotEmaggedEvent args)
protected virtual void OnAttemptEmag(EntityUid uid, EmagSiliconLawComponent component, ref OnAttemptEmagEvent args)
{
if (component.RequireOpenPanel &&
TryComp<WiresPanelComponent>(uid, out var panel) &&
!panel.Open)
{
_popup.PopupClient(Loc.GetString("law-emag-require-panel"), uid, args.UserUid);
return;
args.Handled = true;
}
}
protected virtual void OnGotEmagged(EntityUid uid, EmagSiliconLawComponent component, ref GotEmaggedEvent args)
{
component.OwnerName = Name(args.UserUid);
args.Handled = true;
}