Fix Ninja EMP themselves. (#40968)
* push * Skibidi toiler --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
8837851b00
commit
24216b1bc8
@@ -12,12 +12,12 @@ public abstract class SharedBatterySystem : EntitySystem
|
|||||||
SubscribeLocalEvent<BatteryComponent, EmpPulseEvent>(OnEmpPulse);
|
SubscribeLocalEvent<BatteryComponent, EmpPulseEvent>(OnEmpPulse);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEmpPulse(EntityUid uid, BatteryComponent component, ref EmpPulseEvent args)
|
private void OnEmpPulse(Entity<BatteryComponent> entity, ref EmpPulseEvent args)
|
||||||
{
|
{
|
||||||
args.Affected = true;
|
args.Affected = true;
|
||||||
UseCharge(uid, args.EnergyConsumption, component);
|
UseCharge(entity, args.EnergyConsumption, entity.Comp);
|
||||||
// Apply a cooldown to the entity's self recharge if needed to avoid it immediately self recharging after an EMP.
|
// Apply a cooldown to the entity's self recharge if needed to avoid it immediately self recharging after an EMP.
|
||||||
TrySetChargeCooldown(uid);
|
TrySetChargeCooldown(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual float UseCharge(EntityUid uid, float value, BatteryComponent? battery = null)
|
public virtual float UseCharge(EntityUid uid, float value, BatteryComponent? battery = null)
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ public abstract class SharedPowerCellSystem : EntitySystem
|
|||||||
RaiseLocalEvent(uid, new PowerCellChangedEvent(true), false);
|
RaiseLocalEvent(uid, new PowerCellChangedEvent(true), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCellEmpAttempt(EntityUid uid, PowerCellComponent component, EmpAttemptEvent args)
|
private void OnCellEmpAttempt(Entity<PowerCellComponent> entity, ref EmpAttemptEvent args)
|
||||||
{
|
{
|
||||||
var parent = Transform(uid).ParentUid;
|
var parent = Transform(entity).ParentUid;
|
||||||
// relay the attempt event to the slot so it can cancel it
|
// relay the attempt event to the slot so it can cancel it
|
||||||
if (HasComp<PowerCellSlotComponent>(parent))
|
if (HasComp<PowerCellSlotComponent>(parent))
|
||||||
RaiseLocalEvent(parent, ref args);
|
RaiseLocalEvent(parent, ref args);
|
||||||
|
|||||||
Reference in New Issue
Block a user