Clean up APCs (#19841)
While here, fix an issue where APCs don't update the UI state after a load change.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Content.Server.Power.NodeGroups;
|
||||
using Content.Shared.APC;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
||||
|
||||
namespace Content.Server.Power.Components;
|
||||
|
||||
@@ -10,16 +11,26 @@ public sealed partial class ApcComponent : BaseApcNetComponent
|
||||
[DataField("onReceiveMessageSound")]
|
||||
public SoundSpecifier OnReceiveMessageSound = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg");
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("lastChargeState")]
|
||||
public ApcChargeState LastChargeState;
|
||||
[DataField("lastChargeStateTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
|
||||
public TimeSpan LastChargeStateTime;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("lastExternalState")]
|
||||
public ApcExternalPowerState LastExternalState;
|
||||
|
||||
/// <summary>
|
||||
/// Time the ui was last updated automatically.
|
||||
/// Done after every <see cref="VisualsChangeDelay"/> to show the latest load.
|
||||
/// If charge state changes it will be instantly updated.
|
||||
/// </summary>
|
||||
[DataField("lastUiUpdate", customTypeSerializer: typeof(TimeOffsetSerializer))]
|
||||
public TimeSpan LastUiUpdate;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("enabled")]
|
||||
public bool MainBreakerEnabled = true;
|
||||
// TODO: remove this since it probably breaks when 2 people use it
|
||||
[DataField("hasAccess")]
|
||||
public bool HasAccess = false;
|
||||
|
||||
public const float HighPowerThreshold = 0.9f;
|
||||
|
||||
Reference in New Issue
Block a user