using Content.Shared.FixedPoint; using Content.Shared.Whitelist; using Robust.Shared.Audio; using Robust.Shared.Containers; using Robust.Shared.GameStates; using Robust.Shared.Serialization; using Robust.Shared.Prototypes; namespace Content.Shared.Mech.Components; /// /// A large, pilotable machine that has equipment that is /// powered via an internal battery. /// [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] public sealed partial class MechComponent : Component { /// /// Whether or not an emag disables it. /// [DataField("breakOnEmag")] [AutoNetworkedField] public bool BreakOnEmag = true; /// /// How much "health" the mech has left. /// [ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] public FixedPoint2 Integrity; /// /// The maximum amount of damage the mech can take. /// [DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)] public FixedPoint2 MaxIntegrity = 250; /// /// How much energy the mech has. /// Derived from the currently inserted battery. /// [ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] public FixedPoint2 Energy = 0; /// /// The maximum amount of energy the mech can have. /// Derived from the currently inserted battery. /// [DataField, AutoNetworkedField, ViewVariables(VVAccess.ReadWrite)] public FixedPoint2 MaxEnergy = 0; /// /// The slot the battery is stored in. /// [ViewVariables] public ContainerSlot BatterySlot = default!; [ViewVariables] public readonly string BatterySlotId = "mech-battery-slot"; /// /// A multiplier used to calculate how much of the damage done to a mech /// is transfered to the pilot /// [DataField, ViewVariables(VVAccess.ReadWrite)] public float MechToPilotDamageMultiplier; /// /// Whether the mech has been destroyed and is no longer pilotable. /// [ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] public bool Broken = false; /// /// Whether the mech has toggled lights. /// [ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] public bool Lights = false; /// /// The slot the pilot is stored in. /// [ViewVariables(VVAccess.ReadWrite)] public ContainerSlot PilotSlot = default!; [ViewVariables] public readonly string PilotSlotId = "mech-pilot-slot"; /// /// The current selected equipment of the mech. /// If null, the mech is using just its fists. /// [ViewVariables, AutoNetworkedField] public EntityUid? CurrentSelectedEquipment; /// /// The maximum amount of equipment items that can be installed in the mech /// [DataField("maxEquipmentAmount"), ViewVariables(VVAccess.ReadWrite)] public int MaxEquipmentAmount = 3; /// /// A whitelist for inserting equipment items. /// [DataField] public EntityWhitelist? EquipmentWhitelist; [DataField] public EntityWhitelist? PilotWhitelist; [DataField] public EntityWhitelist? PilotBlacklist; /// /// A container for storing the equipment entities. /// [ViewVariables(VVAccess.ReadWrite)] public Container EquipmentContainer = default!; [ViewVariables] public readonly string EquipmentContainerId = "mech-equipment-container"; /// /// How long it takes to enter the mech. /// [DataField, ViewVariables(VVAccess.ReadWrite)] public float EntryDelay = 3; /// /// How long it takes to pull *another person* /// outside of the mech. You can exit instantly yourself. /// [DataField, ViewVariables(VVAccess.ReadWrite)] public float ExitDelay = 6; /// /// How long it takes to pull out the battery. /// [DataField, ViewVariables(VVAccess.ReadWrite)] public float BatteryRemovalDelay = 2; /// /// Whether or not the mech is airtight. /// /// /// This needs to be redone /// when mech internals are added /// [DataField, ViewVariables(VVAccess.ReadWrite)] public bool Airtight; /// /// The equipment that the mech initially has when it spawns. /// Good for things like nukie mechs that start with guns. /// [DataField] public List StartingEquipment = new(); [ViewVariables(VVAccess.ReadWrite), AutoNetworkedField] public MechHealthState HealthState = MechHealthState.Normal; #region Messages [DataField] public string MessageHello = "mech-message-hello"; [DataField] public string MessageGoodbye = "mech-message-goodbye"; [DataField] public string MessageEnableLight = "mech-message-enable-light"; [DataField] public string MessageDisableLight = "mech-message-disable-light"; [DataField] public string MessageAlert50 = "mech-message-alert_50"; [DataField] public string MessageAlert25 = "mech-message-alert-25"; [DataField] public string MessageAlert5 = "mech-message-alert-5"; [DataField] public string MessageInsertEquipment = "mech-message-insert-equipment"; [DataField] public string MessageRemoveEquipment = "mech-message-remove-equipment"; [DataField] public string MessageCycleEquipment = "mech-message-cycle-equipment"; #endregion #region Action Prototypes [DataField] public EntProtoId MechCycleAction = "ActionMechCycleEquipment"; [DataField] public EntProtoId MechUiAction = "ActionMechOpenUI"; [DataField] public EntProtoId MechEjectAction = "ActionMechEject"; [DataField] public EntProtoId MechLightsAction = "ActionMechLights"; #endregion #region Visualizer States [DataField, AutoNetworkedField] public string? BaseState; [DataField, AutoNetworkedField] public string? OpenState; [DataField, AutoNetworkedField] public string? BrokenState; #endregion [DataField] public EntityUid? MechCycleActionEntity; [DataField] public EntityUid? MechUiActionEntity; [DataField] public EntityUid? MechEjectActionEntity; [DataField] public EntityUid? MechLightsActionEntity; } public enum MechHealthState { Normal, Healthy, Damaged, Critical }