mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-17 21:48:58 +03:00
* Fix borg becoming emag immune if emag attempted with panel closed. * new event * removed code added in accessreader * fix emag 1984 (cherry picked from commit 23e714e523f18ffe5c4a2e1e2186142371dbf0bb)
40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using Content.Shared.Emag.Systems;
|
|
using Content.Shared.Popups;
|
|
using Content.Shared.Silicons.Laws.Components;
|
|
using Content.Shared.Wires;
|
|
|
|
namespace Content.Shared.Silicons.Laws;
|
|
|
|
/// <summary>
|
|
/// This handles getting and displaying the laws for silicons.
|
|
/// </summary>
|
|
public abstract class SharedSiliconLawSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly SharedPopupSystem _popup = default!;
|
|
|
|
/// <inheritdoc/>
|
|
public override void Initialize()
|
|
{
|
|
SubscribeLocalEvent<EmagSiliconLawComponent, GotEmaggedEvent>(OnGotEmagged);
|
|
SubscribeLocalEvent<EmagSiliconLawComponent, OnAttemptEmagEvent>(OnAttemptEmag);
|
|
}
|
|
|
|
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);
|
|
args.Handled = true;
|
|
}
|
|
|
|
}
|
|
|
|
protected virtual void OnGotEmagged(EntityUid uid, EmagSiliconLawComponent component, ref GotEmaggedEvent args)
|
|
{
|
|
component.OwnerName = Name(args.UserUid);
|
|
args.Handled = true;
|
|
}
|
|
}
|