add breakers to power batteries (#16903)
Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Emp;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Power.Events;
|
||||
using Content.Server.Power.Pow3r;
|
||||
using Content.Shared.Access.Components;
|
||||
using Content.Shared.Access.Systems;
|
||||
@@ -36,6 +37,7 @@ namespace Content.Server.Power.EntitySystems
|
||||
SubscribeLocalEvent<ApcComponent, ChargeChangedEvent>(OnBatteryChargeChanged);
|
||||
SubscribeLocalEvent<ApcComponent, ApcToggleMainBreakerMessage>(OnToggleMainBreaker);
|
||||
SubscribeLocalEvent<ApcComponent, GotEmaggedEvent>(OnEmagged);
|
||||
SubscribeLocalEvent<ApcComponent, BreakerPoppedEvent>(OnBreakerPopped);
|
||||
|
||||
SubscribeLocalEvent<ApcComponent, EmpPulseEvent>(OnEmpPulse);
|
||||
}
|
||||
@@ -111,6 +113,18 @@ namespace Content.Server.Power.EntitySystems
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
private void OnBreakerPopped(EntityUid uid, ApcComponent comp, BreakerPoppedEvent args)
|
||||
{
|
||||
// already disabled, do nothing
|
||||
if (!comp.MainBreakerEnabled)
|
||||
return;
|
||||
|
||||
ApcToggleBreaker(uid, comp);
|
||||
|
||||
// popup so its clear what happened
|
||||
_popup.PopupEntity(Loc.GetString("apc-component-breaker-popped"), uid);
|
||||
}
|
||||
|
||||
public void UpdateApcState(EntityUid uid,
|
||||
ApcComponent? apc=null,
|
||||
PowerNetworkBatteryComponent? battery = null)
|
||||
|
||||
Reference in New Issue
Block a user