using Content.Shared.FixedPoint;
using Content.Shared.Whitelist;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
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
{
///
/// 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;
///
/// 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;
///
/// 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 = 3;
///
/// 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();
#region Action Prototypes
[DataField]
public EntProtoId MechCycleAction = "ActionMechCycleEquipment";
[DataField]
public EntProtoId MechUiAction = "ActionMechOpenUI";
[DataField]
public EntProtoId MechEjectAction = "ActionMechEject";
#endregion
#region Visualizer States
[DataField]
public string? BaseState;
[DataField]
public string? OpenState;
[DataField]
public string? BrokenState;
#endregion
[DataField] public EntityUid? MechCycleActionEntity;
[DataField] public EntityUid? MechUiActionEntity;
[DataField] public EntityUid? MechEjectActionEntity;
}