From: ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
Date: Mon, 8 Dec 2025 03:23:45 +0000 (-0800)
Subject: Revert "Trip APCs when they exceed a power limit (#41377)" (#41766)
X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=c867adb9379d439b808fdcd9402578e2b6287215;p=space-station-14.git
Revert "Trip APCs when they exceed a power limit (#41377)" (#41766)
This reverts commit a5c223c0
---
diff --git a/Content.Client/Power/APC/UI/ApcMenu.xaml b/Content.Client/Power/APC/UI/ApcMenu.xaml
index 682aea55d2..4c14dcc0ad 100644
--- a/Content.Client/Power/APC/UI/ApcMenu.xaml
+++ b/Content.Client/Power/APC/UI/ApcMenu.xaml
@@ -19,7 +19,7 @@
-
+
diff --git a/Content.Client/Power/APC/UI/ApcMenu.xaml.cs b/Content.Client/Power/APC/UI/ApcMenu.xaml.cs
index 097ee71581..14c00986ce 100644
--- a/Content.Client/Power/APC/UI/ApcMenu.xaml.cs
+++ b/Content.Client/Power/APC/UI/ApcMenu.xaml.cs
@@ -40,14 +40,7 @@ namespace Content.Client.Power.APC.UI
if (PowerLabel != null)
{
- if (castState.Tripped)
- {
- PowerLabel.Text = Loc.GetString("apc-menu-power-state-label-tripped");
- }
- else
- {
- PowerLabel.Text = Loc.GetString("apc-menu-power-state-label-text", ("power", castState.Power), ("maxLoad", castState.MaxLoad));
- }
+ PowerLabel.Text = Loc.GetString("apc-menu-power-state-label-text", ("power", castState.Power));
}
if (ExternalPowerStateLabel != null)
diff --git a/Content.IntegrationTests/Tests/Power/StationPowerTests.cs b/Content.IntegrationTests/Tests/Power/StationPowerTests.cs
index a2231ce60f..3a0af28e48 100644
--- a/Content.IntegrationTests/Tests/Power/StationPowerTests.cs
+++ b/Content.IntegrationTests/Tests/Power/StationPowerTests.cs
@@ -7,11 +7,11 @@ using Content.Server.Power.NodeGroups;
using Content.Server.Power.Pow3r;
using Content.Shared.Power.Components;
using Content.Shared.NodeContainer;
-using Robust.Server.GameObjects;
using Robust.Shared.EntitySerialization;
namespace Content.IntegrationTests.Tests.Power;
+[Explicit]
public sealed class StationPowerTests
{
///
@@ -21,21 +21,27 @@ public sealed class StationPowerTests
private static readonly string[] GameMaps =
[
+ "Fland",
+ "Meta",
+ "Packed",
+ "Omega",
"Bagel",
"Box",
- "Elkridge",
- "Fland",
+ "Core",
"Marathon",
+ "Saltern",
+ "Reach",
+ "Train",
"Oasis",
- "Packed",
+ "Gate",
+ "Amber",
+ "Loop",
"Plasma",
+ "Elkridge",
+ "Convex",
"Relic",
- "Snowball",
- "Reach",
- "Exo",
];
- [Explicit]
[Test, TestCaseSource(nameof(GameMaps))]
public async Task TestStationStartingPowerWindow(string mapProtoId)
{
@@ -94,54 +100,6 @@ public sealed class StationPowerTests
$"Needs at least {requiredStoredPower - totalStartingCharge} more stored power!");
});
- await pair.CleanReturnAsync();
- }
-
- [Test, TestCaseSource(nameof(GameMaps))]
- public async Task TestApcLoad(string mapProtoId)
- {
- await using var pair = await PoolManager.GetServerClient(new PoolSettings
- {
- Dirty = true,
- });
- var server = pair.Server;
-
- var entMan = server.EntMan;
- var protoMan = server.ProtoMan;
- var ticker = entMan.System();
- var xform = entMan.System();
-
- // Load the map
- await server.WaitAssertion(() =>
- {
- Assert.That(protoMan.TryIndex(mapProtoId, out var mapProto));
- var opts = DeserializationOptions.Default with { InitializeMaps = true };
- ticker.LoadGameMap(mapProto, out var mapId, opts);
- });
-
- // Wait long enough for power to ramp up, but before anything can trip
- await pair.RunSeconds(2);
-
- // Check that no APCs start overloaded
- var apcQuery = entMan.EntityQueryEnumerator();
- Assert.Multiple(() =>
- {
- while (apcQuery.MoveNext(out var uid, out var apc, out var battery))
- {
- // Uncomment the following line to log starting APC load to the console
- //Console.WriteLine($"ApcLoad:{mapProtoId}:{uid}:{battery.CurrentSupply}");
- if (xform.TryGetMapOrGridCoordinates(uid, out var coord))
- {
- Assert.That(apc.MaxLoad, Is.GreaterThanOrEqualTo(battery.CurrentSupply),
- $"APC {uid} on {mapProtoId} ({coord.Value.X}, {coord.Value.Y}) is overloaded {battery.CurrentSupply} / {apc.MaxLoad}");
- }
- else
- {
- Assert.That(apc.MaxLoad, Is.GreaterThanOrEqualTo(battery.CurrentSupply),
- $"APC {uid} on {mapProtoId} is overloaded {battery.CurrentSupply} / {apc.MaxLoad}");
- }
- }
- });
await pair.CleanReturnAsync();
}
diff --git a/Content.Server/Power/Components/ApcComponent.cs b/Content.Server/Power/Components/ApcComponent.cs
index 8309304d84..0bf9bc1872 100644
--- a/Content.Server/Power/Components/ApcComponent.cs
+++ b/Content.Server/Power/Components/ApcComponent.cs
@@ -5,7 +5,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
namespace Content.Server.Power.Components;
-[RegisterComponent, AutoGenerateComponentPause]
+[RegisterComponent]
public sealed partial class ApcComponent : BaseApcNetComponent
{
[DataField("onReceiveMessageSound")]
@@ -34,32 +34,6 @@ public sealed partial class ApcComponent : BaseApcNetComponent
public const float HighPowerThreshold = 0.9f;
public static TimeSpan VisualsChangeDelay = TimeSpan.FromSeconds(1);
- ///
- /// Maximum continuous load in Watts that this APC can supply to loads. Exceeding this starts a
- /// timer, which after enough overloading causes the APC to "trip" off.
- ///
- [DataField]
- public float MaxLoad = 20e3f;
-
- ///
- /// Time that the APC can be continuously overloaded before tripping off.
- ///
- [DataField]
- public TimeSpan TripTime = TimeSpan.FromSeconds(3);
-
- ///
- /// Time that overloading began.
- ///
- [DataField(customTypeSerializer: typeof(TimeOffsetSerializer)), AutoPausedField]
- public TimeSpan? TripStartTime;
-
- ///
- /// Set to true if the APC tripped off. Used to indicate problems in the UI. Reset by switching
- /// APC on.
- ///
- [DataField]
- public bool TripFlag;
-
// TODO ECS power a little better!
// End the suffering
protected override void AddSelfToNet(IApcNet apcNet)
diff --git a/Content.Server/Power/EntitySystems/ApcSystem.cs b/Content.Server/Power/EntitySystems/ApcSystem.cs
index b3b2330a3c..ed7ec0e225 100644
--- a/Content.Server/Power/EntitySystems/ApcSystem.cs
+++ b/Content.Server/Power/EntitySystems/ApcSystem.cs
@@ -43,12 +43,11 @@ public sealed class ApcSystem : EntitySystem
public override void Update(float deltaTime)
{
var query = EntityQueryEnumerator();
- var curTime = _gameTiming.CurTime;
while (query.MoveNext(out var uid, out var apc, out var battery, out var ui))
{
- if (apc.LastUiUpdate + ApcComponent.VisualsChangeDelay < curTime && _ui.IsUiOpen((uid, ui), ApcUiKey.Key))
+ if (apc.LastUiUpdate + ApcComponent.VisualsChangeDelay < _gameTiming.CurTime && _ui.IsUiOpen((uid, ui), ApcUiKey.Key))
{
- apc.LastUiUpdate = curTime;
+ apc.LastUiUpdate = _gameTiming.CurTime;
UpdateUIState(uid, apc, battery);
}
@@ -56,28 +55,6 @@ public sealed class ApcSystem : EntitySystem
{
UpdateApcState(uid, apc, battery);
}
-
- // Overload
- if (apc.MainBreakerEnabled && battery.CurrentSupply > apc.MaxLoad)
- {
- // Not already overloaded, start timer
- if (apc.TripStartTime == null)
- {
- apc.TripStartTime = curTime;
- }
- else
- {
- if (curTime - apc.TripStartTime > apc.TripTime)
- {
- apc.TripFlag = true;
- ApcToggleBreaker(uid, apc, battery); // off, we already checked MainBreakerEnabled above
- }
- }
- }
- else
- {
- apc.TripStartTime = null;
- }
}
}
@@ -129,9 +106,6 @@ public sealed class ApcSystem : EntitySystem
apc.MainBreakerEnabled = !apc.MainBreakerEnabled;
battery.CanDischarge = apc.MainBreakerEnabled;
- if (apc.MainBreakerEnabled)
- apc.TripFlag = false;
-
UpdateUIState(uid, apc);
_audio.PlayPvs(apc.OnReceiveMessageSound, uid, AudioParams.Default.WithVolume(-2f));
}
@@ -195,9 +169,7 @@ public sealed class ApcSystem : EntitySystem
var state = new ApcBoundInterfaceState(apc.MainBreakerEnabled,
(int) MathF.Ceiling(battery.CurrentSupply), apc.LastExternalState,
- charge,
- apc.MaxLoad,
- apc.TripFlag);
+ charge);
_ui.SetUiState((uid, ui), ApcUiKey.Key, state);
}
diff --git a/Content.Shared/APC/SharedApc.cs b/Content.Shared/APC/SharedApc.cs
index c8bf1cc3e8..802c06a6ab 100644
--- a/Content.Shared/APC/SharedApc.cs
+++ b/Content.Shared/APC/SharedApc.cs
@@ -181,17 +181,13 @@ namespace Content.Shared.APC
public readonly int Power;
public readonly ApcExternalPowerState ApcExternalPower;
public readonly float Charge;
- public readonly float MaxLoad;
- public readonly bool Tripped;
- public ApcBoundInterfaceState(bool mainBreaker, int power, ApcExternalPowerState apcExternalPower, float charge, float maxLoad, bool tripped)
+ public ApcBoundInterfaceState(bool mainBreaker, int power, ApcExternalPowerState apcExternalPower, float charge)
{
MainBreaker = mainBreaker;
Power = power;
ApcExternalPower = apcExternalPower;
Charge = charge;
- MaxLoad = maxLoad;
- Tripped = tripped;
}
public bool Equals(ApcBoundInterfaceState? other)
@@ -201,9 +197,7 @@ namespace Content.Shared.APC
return MainBreaker == other.MainBreaker &&
Power == other.Power &&
ApcExternalPower == other.ApcExternalPower &&
- MathHelper.CloseTo(Charge, other.Charge) &&
- MathHelper.CloseTo(MaxLoad, other.MaxLoad) &&
- Tripped == other.Tripped;
+ MathHelper.CloseTo(Charge, other.Charge);
}
public override bool Equals(object? obj)
@@ -213,7 +207,7 @@ namespace Content.Shared.APC
public override int GetHashCode()
{
- return HashCode.Combine(MainBreaker, Power, (int) ApcExternalPower, Charge, MaxLoad, Tripped);
+ return HashCode.Combine(MainBreaker, Power, (int) ApcExternalPower, Charge);
}
}
diff --git a/Resources/Locale/en-US/ui/power-apc.ftl b/Resources/Locale/en-US/ui/power-apc.ftl
index 125d77fa7c..d30a906d1c 100644
--- a/Resources/Locale/en-US/ui/power-apc.ftl
+++ b/Resources/Locale/en-US/ui/power-apc.ftl
@@ -10,8 +10,7 @@ apc-menu-charge-label = {$percent} Charged
apc-menu-power-state-good = Good
apc-menu-power-state-low = Low
apc-menu-power-state-none = None
-apc-menu-power-state-label-text = { POWERWATTS($power) } / { POWERWATTS($maxLoad) }
-apc-menu-power-state-label-tripped = OVERLOAD
+apc-menu-power-state-label-text = { POWERWATTS($power) }
# For the flavor text on the footer
diff --git a/Resources/Prototypes/Entities/Objects/Devices/Syndicate_Gadgets/singularity_beacon.yml b/Resources/Prototypes/Entities/Objects/Devices/Syndicate_Gadgets/singularity_beacon.yml
index 5c5dcd8979..28da7331d2 100644
--- a/Resources/Prototypes/Entities/Objects/Devices/Syndicate_Gadgets/singularity_beacon.yml
+++ b/Resources/Prototypes/Entities/Objects/Devices/Syndicate_Gadgets/singularity_beacon.yml
@@ -38,6 +38,6 @@
- !type:DoActsBehavior
acts: [ "Destruction" ]
- type: ApcPowerReceiver
- powerLoad: 5000
+ powerLoad: 15000
- type: StaticPrice
price: 7500