@@ -1,4 +1,5 @@
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.Emp;
|
||||
using Content.Shared.PowerCell.Components;
|
||||
using Content.Shared.Rejuvenate;
|
||||
using Robust.Shared.Containers;
|
||||
@@ -22,6 +23,8 @@ public abstract class SharedPowerCellSystem : EntitySystem
|
||||
SubscribeLocalEvent<PowerCellSlotComponent, EntInsertedIntoContainerMessage>(OnCellInserted);
|
||||
SubscribeLocalEvent<PowerCellSlotComponent, EntRemovedFromContainerMessage>(OnCellRemoved);
|
||||
SubscribeLocalEvent<PowerCellSlotComponent, ContainerIsInsertingAttemptEvent>(OnCellInsertAttempt);
|
||||
|
||||
SubscribeLocalEvent<PowerCellComponent, EmpAttemptEvent>(OnCellEmpAttempt);
|
||||
}
|
||||
|
||||
private void OnMapInit(Entity<PowerCellDrawComponent> ent, ref MapInitEvent args)
|
||||
@@ -71,6 +74,14 @@ public abstract class SharedPowerCellSystem : EntitySystem
|
||||
RaiseLocalEvent(uid, new PowerCellChangedEvent(true), false);
|
||||
}
|
||||
|
||||
private void OnCellEmpAttempt(EntityUid uid, PowerCellComponent component, EmpAttemptEvent args)
|
||||
{
|
||||
var parent = Transform(uid).ParentUid;
|
||||
// relay the attempt event to the slot so it can cancel it
|
||||
if (HasComp<PowerCellSlotComponent>(parent))
|
||||
RaiseLocalEvent(parent, ref args);
|
||||
}
|
||||
|
||||
public void SetDrawEnabled(Entity<PowerCellDrawComponent?> ent, bool enabled)
|
||||
{
|
||||
if (!Resolve(ent, ref ent.Comp, false) || ent.Comp.Enabled == enabled)
|
||||
|
||||
Reference in New Issue
Block a user