using Content.Shared.Actions.ActionTypes;
using Content.Shared.FixedPoint;
using Content.Shared.Whitelist;
using Robust.Shared.Containers;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Mech.Components;
///
/// A large, pilotable machine that has equipment that is
/// powered via an internal battery.
///
public abstract class SharedMechComponent : Component
{
///
/// How much "health" the mech has left.
///
[ViewVariables(VVAccess.ReadWrite)]
public FixedPoint2 Integrity;
///
/// The maximum amount of damage the mech can take.
///
[DataField("maxIntegrity")]
public FixedPoint2 MaxIntegrity = 250;
///
/// How much energy the mech has.
/// Derived from the currently inserted battery.
///
[ViewVariables(VVAccess.ReadWrite)]
public FixedPoint2 Energy = 0;
///
/// The maximum amount of energy the mech can have.
/// Derived from the currently inserted battery.
///
[DataField("maxEnergy")]
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("mechToPilotDamageMultiplier")]
public float MechToPilotDamageMultiplier;
///
/// Whether the mech has been destroyed and is no longer pilotable.
///
[ViewVariables(VVAccess.ReadWrite)]
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]
public EntityUid? CurrentSelectedEquipment;
///
/// The maximum amount of equipment items that can be installed in the mech
///
[DataField("maxEquipmentAmount")]
public int MaxEquipmentAmount = 3;
///
/// A whitelist for inserting equipment items.
///
[DataField("equipmentWhitelist")]
public EntityWhitelist? EquipmentWhitelist;
///
/// A container for storing the equipment entities.
///
[ViewVariables(VVAccess.ReadWrite)]
public Container EquipmentContainer = default!;
[ViewVariables]
public readonly string EquipmentContainerId = "mech-equipment-container";
#region Action Prototypes
[DataField("mechCycleAction", customTypeSerializer: typeof(PrototypeIdSerializer))]
public string MechCycleAction = "MechCycleEquipment";
[DataField("mechUiAction", customTypeSerializer: typeof(PrototypeIdSerializer))]
public string MechUiAction = "MechOpenUI";
[DataField("mechEjectAction", customTypeSerializer: typeof(PrototypeIdSerializer))]
public string MechEjectAction = "MechEject";
#endregion
#region Visualizer States
[DataField("baseState")]
public string? BaseState;
[DataField("openState")]
public string? OpenState;
[DataField("brokenState")]
public string? BrokenState;
#endregion
}
///
/// Contains network state for .
///
[Serializable, NetSerializable]
public sealed class MechComponentState : ComponentState
{
public FixedPoint2 Integrity;
public FixedPoint2 MaxIntegrity;
public FixedPoint2 Energy;
public FixedPoint2 MaxEnergy;
public EntityUid? CurrentSelectedEquipment;
public bool Broken;
}