2021-07-04 18:11:52 +02:00
|
|
|
using Content.Server.Power.NodeGroups;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.APC;
|
2022-07-29 14:13:12 +12:00
|
|
|
using Robust.Shared.Audio;
|
2020-06-28 09:23:26 -06:00
|
|
|
|
2022-01-15 11:32:46 -07:00
|
|
|
namespace Content.Server.Power.Components;
|
2020-06-28 09:23:26 -06:00
|
|
|
|
2022-01-15 11:32:46 -07:00
|
|
|
[RegisterComponent]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class ApcComponent : BaseApcNetComponent
|
2022-01-15 11:32:46 -07:00
|
|
|
{
|
|
|
|
|
[DataField("onReceiveMessageSound")]
|
|
|
|
|
public SoundSpecifier OnReceiveMessageSound = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg");
|
2020-06-28 09:23:26 -06:00
|
|
|
|
2022-01-15 11:32:46 -07:00
|
|
|
[ViewVariables]
|
|
|
|
|
public ApcChargeState LastChargeState;
|
|
|
|
|
public TimeSpan LastChargeStateTime;
|
2021-02-01 10:19:43 -06:00
|
|
|
|
2022-01-15 11:32:46 -07:00
|
|
|
[ViewVariables]
|
|
|
|
|
public ApcExternalPowerState LastExternalState;
|
|
|
|
|
public TimeSpan LastUiUpdate;
|
2021-07-04 18:11:52 +02:00
|
|
|
|
2022-01-15 11:32:46 -07:00
|
|
|
[ViewVariables]
|
|
|
|
|
public bool MainBreakerEnabled = true;
|
2023-03-07 09:55:35 +08:00
|
|
|
public bool HasAccess = false;
|
2021-07-04 18:11:52 +02:00
|
|
|
|
2022-01-15 11:32:46 -07:00
|
|
|
public const float HighPowerThreshold = 0.9f;
|
|
|
|
|
public static TimeSpan VisualsChangeDelay = TimeSpan.FromSeconds(1);
|
2020-06-28 09:23:26 -06:00
|
|
|
|
2022-01-15 11:32:46 -07:00
|
|
|
// TODO ECS power a little better!
|
|
|
|
|
protected override void AddSelfToNet(IApcNet apcNet)
|
|
|
|
|
{
|
|
|
|
|
apcNet.AddApc(this);
|
|
|
|
|
}
|
2020-08-22 22:29:20 +02:00
|
|
|
|
2022-01-15 11:32:46 -07:00
|
|
|
protected override void RemoveSelfFromNet(IApcNet apcNet)
|
|
|
|
|
{
|
|
|
|
|
apcNet.RemoveApc(this);
|
2020-06-28 09:23:26 -06:00
|
|
|
}
|
|
|
|
|
}
|