Files
tbd-station-14/Content.Shared/Mech/Components/SharedMechComponent.cs
Nemanja 913e1ee676 Exosuit: Ripley (#12668)
* mechs

* interaction relay

* atmos handling

* fuck around with interaction events

SPAGHETTI CODE OH MY GOD

* more sprites and whatever the hell

* more mech shit

* more shit for equipment

* starting equipment (for nukie mechs and such)

* equipment cycling

* starting with some of the ui

* a fat chunk of ui prototyping

* done tinkering with ui

* a bunch of ui stuff and what have yous

* cleaning up grabber and state handling

* make the ui actually functional + watch me port a million icons

I swear i'll prune the sprites later blease

* start on construction

* construction yo mamma

* remove some unused files

* fix a silly

* make the graph sane

* make it actually constructible.

* print the boards as well, bozo

* rebalance part prices

* eject action

also i appease the russians by remembering to localize

* Punch Shit

* make mech integrity and repairs work

* Make the UI more based

STOMP STOMP STOMP STOMP

* make equipment even more based

* batteries and other such delights

* make the ui look pimpin af

* make the construction mega based

* UI but so epic

* equipment

* some sweat tweaks

* damage rebalancing

* restructure tech

* fix some shit

* mechs inherit access

* make icons actually use sprite specifiers

* TRAILING COMMAA!!!!!

* fix a mild indentation sin

* undo this change because it isn't needed

* actually fix this

* secret webeditting shhhh

* place this tech here

* comments

* foo
2022-12-10 11:05:39 -06:00

133 lines
4.1 KiB
C#

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;
/// <summary>
/// A large, pilotable machine that has equipment that is
/// powered via an internal battery.
/// </summary>
public abstract class SharedMechComponent : Component
{
/// <summary>
/// How much "health" the mech has left.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public FixedPoint2 Integrity;
/// <summary>
/// The maximum amount of damage the mech can take.
/// </summary>
[DataField("maxIntegrity")]
public FixedPoint2 MaxIntegrity = 250;
/// <summary>
/// How much energy the mech has.
/// Derived from the currently inserted battery.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public FixedPoint2 Energy = 0;
/// <summary>
/// The maximum amount of energy the mech can have.
/// Derived from the currently inserted battery.
/// </summary>
[DataField("maxEnergy")]
public FixedPoint2 MaxEnergy = 0;
/// <summary>
/// The slot the battery is stored in.
/// </summary>
[ViewVariables]
public ContainerSlot BatterySlot = default!;
[ViewVariables]
public readonly string BatterySlotId = "mech-battery-slot";
/// <summary>
/// A multiplier used to calculate how much of the damage done to a mech
/// is transfered to the pilot
/// </summary>
[DataField("mechToPilotDamageMultiplier")]
public float MechToPilotDamageMultiplier;
/// <summary>
/// Whether the mech has been destroyed and is no longer pilotable.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public bool Broken = false;
/// <summary>
/// The slot the pilot is stored in.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public ContainerSlot PilotSlot = default!;
[ViewVariables]
public readonly string PilotSlotId = "mech-pilot-slot";
/// <summary>
/// The current selected equipment of the mech.
/// If null, the mech is using just its fists.
/// </summary>
[ViewVariables]
public EntityUid? CurrentSelectedEquipment;
/// <summary>
/// The maximum amount of equipment items that can be installed in the mech
/// </summary>
[DataField("maxEquipmentAmount")]
public int MaxEquipmentAmount = 3;
/// <summary>
/// A whitelist for inserting equipment items.
/// </summary>
[DataField("equipmentWhitelist")]
public EntityWhitelist? EquipmentWhitelist;
/// <summary>
/// A container for storing the equipment entities.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
public Container EquipmentContainer = default!;
[ViewVariables]
public readonly string EquipmentContainerId = "mech-equipment-container";
#region Action Prototypes
[DataField("mechCycleAction", customTypeSerializer: typeof(PrototypeIdSerializer<InstantActionPrototype>))]
public string MechCycleAction = "MechCycleEquipment";
[DataField("mechUiAction", customTypeSerializer: typeof(PrototypeIdSerializer<InstantActionPrototype>))]
public string MechUiAction = "MechOpenUI";
[DataField("mechEjectAction", customTypeSerializer: typeof(PrototypeIdSerializer<InstantActionPrototype>))]
public string MechEjectAction = "MechEject";
#endregion
#region Visualizer States
[DataField("baseState")]
public string? BaseState;
[DataField("openState")]
public string? OpenState;
[DataField("brokenState")]
public string? BrokenState;
#endregion
}
/// <summary>
/// Contains network state for <see cref="SharedMechComponent"/>.
/// </summary>
[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;
}