using Robust.Shared.Serialization; namespace Content.Shared.APC { [Serializable, NetSerializable] public enum ApcVisuals : byte { /// /// APC locks. /// LockState, /// /// APC channels. /// ChannelState, /// /// APC lights/HUD. /// ChargeState, } [Serializable, NetSerializable] public enum ApcPanelState : sbyte { /// /// APC is closed. /// Closed = 0, /// /// APC is opened. /// Open = 1, /// /// APC is oaisdoj. /// Error = -1, } /// /// The state of the APC interface lock. /// None of this is implemented. /// [Serializable, NetSerializable] public enum ApcLockState : sbyte { /// /// Empty bitmask. /// None = 0, /// /// Bitfield indicating status of APC lock indicator. /// Lock = (1<<0), /// /// Bit state indicating that the given APC lock is unlocked. /// Unlocked = None, /// /// Bit state indicating that the given APC lock is locked. /// Locked = (1<<0), /// /// Bitmask for the full state for a given APC lock indicator. /// All = (Lock), /// /// The log 2 width in bits of the bitfields indicating the status of an APC lock indicator. /// Used for bit shifting operations (Mask for the state for indicator i is (All << (i << LogWidth))). /// LogWidth = 0, } /// /// APC power channel states. /// None of this is implemented. /// public enum ApcChannelState : sbyte { /// /// Empty bitmask. /// None = 0, /// /// Bitfield indicating whether the APC is automatically regulating the given channel. /// Control = (1<<0), /// /// Bit state indicating that the APC has been set to automatically toggle the given channel depending on available power. /// Auto = None, /// /// Bit state indicating that the APC has been set to always provide/not provide power on the given channel if possible. /// Manual = Control, /// /// Bitfield indicating whether the APC is currently providing power on the given channel. /// Power = (1<<1), /// /// Bit state indicating that the APC is currently not providing power on the given channel. /// Off = None, /// /// Bit state indicating that the APC is currently providing power on the given channel. /// On = Power, /// /// Bitmask for the full state for a given APC power channel. /// All = Power | Control, /// /// State that indicates the given channel has been automatically disabled. /// AutoOff = (Off | Auto), /// /// State that indicates the given channel has been automatically enabled. /// AutoOn = (On | Auto), /// /// State that indicates the given channel has been manually disabled. /// ManualOff = (Off | Manual), /// /// State that indicates the given channel has been manually enabled. /// ManualOn = (On | Manual), /// /// The log 2 width in bits of the bitfields indicating the status of an APC power channel. /// Used for bit shifting operations (Mask for the state for channel i is (All << (i << LogWidth))). /// LogWidth = 1, } [Serializable, NetSerializable] public enum ApcChargeState : sbyte { /// /// APC does not have enough power to charge cell (if necessary) and keep powering the area. /// Lack = 0, /// /// APC is not full but has enough power. /// Charging = 1, /// /// APC battery is full and has enough power. /// Full = 2, /// /// APC is being remotely accessed. /// Currently unimplemented, though the corresponding sprite state exists in the RSI. /// Remote = 3, /// /// The number of valid states charge states the APC can be in. /// NumStates = 4, /// /// APC is emagged (and not displaying other useful power colors at a glance) /// Emag = -1, } [Serializable, NetSerializable] public sealed class ApcBoundInterfaceState : BoundUserInterfaceState, IEquatable { public readonly bool MainBreaker; public readonly bool HasAccess; public readonly int Power; public readonly ApcExternalPowerState ApcExternalPower; public readonly float Charge; public ApcBoundInterfaceState(bool mainBreaker, bool hasAccess, int power, ApcExternalPowerState apcExternalPower, float charge) { MainBreaker = mainBreaker; HasAccess = hasAccess; Power = power; ApcExternalPower = apcExternalPower; Charge = charge; } public bool Equals(ApcBoundInterfaceState? other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return MainBreaker == other.MainBreaker && HasAccess == other.HasAccess && Power == other.Power && ApcExternalPower == other.ApcExternalPower && MathHelper.CloseTo(Charge, other.Charge); } public override bool Equals(object? obj) { return ReferenceEquals(this, obj) || obj is ApcBoundInterfaceState other && Equals(other); } public override int GetHashCode() { return HashCode.Combine(MainBreaker, HasAccess, Power, (int) ApcExternalPower, Charge); } } [Serializable, NetSerializable] public sealed class ApcToggleMainBreakerMessage : BoundUserInterfaceMessage { } public enum ApcExternalPowerState : byte { None, Low, Good, } [NetSerializable, Serializable] public enum ApcUiKey : byte { Key, } }