2020-08-22 22:29:20 +02:00
|
|
|
using System;
|
2022-01-15 11:32:46 -07:00
|
|
|
using Content.Server.Power.EntitySystems;
|
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;
|
2021-07-10 17:35:33 +02:00
|
|
|
using Content.Shared.Sound;
|
2022-01-15 11:32:46 -07:00
|
|
|
using Robust.Shared.Analyzers;
|
2020-06-28 09:23:26 -06:00
|
|
|
using Robust.Shared.GameObjects;
|
2021-07-04 18:11:52 +02:00
|
|
|
using Robust.Shared.Maths;
|
2021-07-10 17:35:33 +02:00
|
|
|
using Robust.Shared.Serialization.Manager.Attributes;
|
2020-08-13 14:40:27 +02:00
|
|
|
using Robust.Shared.ViewVariables;
|
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]
|
|
|
|
|
[Friend(typeof(ApcSystem))]
|
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;
|
2021-07-04 18:11:52 +02:00
|
|
|
|
2022-02-17 21:43:24 -05:00
|
|
|
public bool Emagged = false;
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
}
|