Revert "add breakers to power batteries" (#17632)

This commit is contained in:
metalgearsloth
2023-07-08 12:47:38 +10:00
committed by GitHub
parent 434474f828
commit 2d1ac6e01d
6 changed files with 0 additions and 70 deletions

View File

@@ -1,14 +0,0 @@
using Content.Server.Power.EntitySystems;
namespace Content.Server.Power.Components;
[RegisterComponent]
[Access(typeof(BreakerSystem))]
public sealed class BreakerComponent : Component
{
/// <summary>
/// Once power supplied exceeds this limit the breaker will pop.
/// </summary>
[DataField("limit", required: true), ViewVariables(VVAccess.ReadWrite)]
public float Limit;
}

View File

@@ -1,7 +1,6 @@
using Content.Server.Emp; using Content.Server.Emp;
using Content.Server.Popups; using Content.Server.Popups;
using Content.Server.Power.Components; using Content.Server.Power.Components;
using Content.Server.Power.Events;
using Content.Server.Power.Pow3r; using Content.Server.Power.Pow3r;
using Content.Shared.Access.Components; using Content.Shared.Access.Components;
using Content.Shared.Access.Systems; using Content.Shared.Access.Systems;
@@ -37,7 +36,6 @@ namespace Content.Server.Power.EntitySystems
SubscribeLocalEvent<ApcComponent, ChargeChangedEvent>(OnBatteryChargeChanged); SubscribeLocalEvent<ApcComponent, ChargeChangedEvent>(OnBatteryChargeChanged);
SubscribeLocalEvent<ApcComponent, ApcToggleMainBreakerMessage>(OnToggleMainBreaker); SubscribeLocalEvent<ApcComponent, ApcToggleMainBreakerMessage>(OnToggleMainBreaker);
SubscribeLocalEvent<ApcComponent, GotEmaggedEvent>(OnEmagged); SubscribeLocalEvent<ApcComponent, GotEmaggedEvent>(OnEmagged);
SubscribeLocalEvent<ApcComponent, BreakerPoppedEvent>(OnBreakerPopped);
SubscribeLocalEvent<ApcComponent, EmpPulseEvent>(OnEmpPulse); SubscribeLocalEvent<ApcComponent, EmpPulseEvent>(OnEmpPulse);
} }
@@ -113,18 +111,6 @@ namespace Content.Server.Power.EntitySystems
args.Handled = true; 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, public void UpdateApcState(EntityUid uid,
ApcComponent? apc=null, ApcComponent? apc=null,
PowerNetworkBatteryComponent? battery = null) PowerNetworkBatteryComponent? battery = null)

View File

@@ -1,30 +0,0 @@
using Content.Server.Administration.Logs;
using Content.Server.Power.Components;
using Content.Server.Power.Events;
using Content.Shared.Database;
namespace Content.Server.Power.EntitySystems;
/// <summary>
/// Handles raising BreakerPopEvent when a power provider exceeds its maximum power.
/// </summary>
public sealed class BreakerSystem : EntitySystem
{
[Dependency] private readonly IAdminLogManager _adminLogger = default!;
/// <inheritdoc/>
public override void Update(float frameTime)
{
base.Update(frameTime);
var query = EntityQueryEnumerator<BreakerComponent, PowerNetworkBatteryComponent>();
while (query.MoveNext(out var uid, out var breaker, out var battery))
{
if (battery.CurrentSupply > breaker.Limit)
{
_adminLogger.Add(LogType.Action, LogImpact.Low, $"Breaker of {ToPrettyString(uid):battery)} popped from supplying {battery.CurrentSupply} with a breaker limit of {breaker.Limit}");
RaiseLocalEvent(uid, new BreakerPoppedEvent());
}
}
}
}

View File

@@ -1,8 +0,0 @@
namespace Content.Server.Power.Events;
/// <summary>
/// Invoked on a target power provider when its power exceeds BreakerComponent MaxPower, popping the breaker or blowing the fuse.
/// </summary>
public sealed class BreakerPoppedEvent : EntityEventArgs
{
}

View File

@@ -2,4 +2,3 @@ apc-component-insufficient-access = Insufficient access!
apc-component-on-examine-panel-open = The [color=lightgray]APC electronics panel[/color] is [color=red]open[/color]. apc-component-on-examine-panel-open = The [color=lightgray]APC electronics panel[/color] is [color=red]open[/color].
apc-component-on-examine-panel-closed = The [color=lightgray]APC electronics panel[/color] is [color=darkgreen]closed[/color]. apc-component-on-examine-panel-closed = The [color=lightgray]APC electronics panel[/color] is [color=darkgreen]closed[/color].
apc-component-on-toggle-cancel = It does nothing! apc-component-on-toggle-cancel = It does nothing!
apc-component-breaker-popped = The APC's breaker popped!

View File

@@ -69,9 +69,6 @@
voltage: Medium voltage: Medium
- type: PowerProvider - type: PowerProvider
voltage: Apc voltage: Apc
- type: Breaker
# 100A at 240V - 24kW
limit: 24000
- type: Apc - type: Apc
voltage: Apc voltage: Apc
- type: ExtensionCableProvider - type: ExtensionCableProvider