fix: APC sprites stuck in fully drained states on round start (#42852)

* Fix APC incorrect charge state caused by race condition on map startup

* fix: Defer the update from ChargeChangedEvent to next tick
This commit is contained in:
MidoriKurage
2026-02-09 20:59:43 +08:00
committed by GitHub
parent 9c89a59d96
commit a01e7dcf40

View File

@@ -87,7 +87,8 @@ public sealed class ApcSystem : EntitySystem
// Change the APC's state only when the battery state changes, or when it's first created.
private void OnBatteryChargeChanged(EntityUid uid, ApcComponent component, ref ChargeChangedEvent args)
{
UpdateApcState(uid, component);
// Defer until the next tick.
component.NeedStateUpdate = true;
}
private static void OnApcStartup(EntityUid uid, ApcComponent component, ComponentStartup args)