2022-04-23 15:31:45 +12:00
|
|
|
using Content.Shared.Clothing.EntitySystems;
|
|
|
|
|
using Content.Shared.Inventory;
|
|
|
|
|
using Robust.Shared.Containers;
|
2023-12-06 17:59:31 +11:00
|
|
|
using Robust.Shared.GameStates;
|
2022-04-23 15:31:45 +12:00
|
|
|
using Robust.Shared.Prototypes;
|
|
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared.Clothing.Components;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2023-12-06 17:59:31 +11:00
|
|
|
/// This component gives an item an action that will equip or un-equip some clothing e.g. hardsuits and hardsuit helmets.
|
2022-04-23 15:31:45 +12:00
|
|
|
/// </summary>
|
2022-06-07 15:26:28 +02:00
|
|
|
[Access(typeof(ToggleableClothingSystem))]
|
2023-12-06 17:59:31 +11:00
|
|
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class ToggleableClothingComponent : Component
|
2022-04-23 15:31:45 +12:00
|
|
|
{
|
|
|
|
|
public const string DefaultClothingContainerId = "toggleable-clothing";
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Action used to toggle the clothing on or off.
|
|
|
|
|
/// </summary>
|
2023-12-06 17:59:31 +11:00
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public EntProtoId Action = "ActionToggleSuitPiece";
|
2023-09-08 18:16:05 -07:00
|
|
|
|
2023-12-06 17:59:31 +11:00
|
|
|
[DataField, AutoNetworkedField]
|
2023-09-08 18:16:05 -07:00
|
|
|
public EntityUid? ActionEntity;
|
2022-04-23 15:31:45 +12:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Default clothing entity prototype to spawn into the clothing container.
|
|
|
|
|
/// </summary>
|
2023-12-06 17:59:31 +11:00
|
|
|
[DataField(required: true), AutoNetworkedField]
|
|
|
|
|
public EntProtoId ClothingPrototype = default!;
|
2022-04-23 15:31:45 +12:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The inventory slot that the clothing is equipped to.
|
|
|
|
|
/// </summary>
|
2023-09-01 14:12:59 +03:00
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
2023-12-06 17:59:31 +11:00
|
|
|
[DataField, AutoNetworkedField]
|
2022-04-23 15:31:45 +12:00
|
|
|
public string Slot = "head";
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The inventory slot flags required for this component to function.
|
|
|
|
|
/// </summary>
|
2023-12-06 17:59:31 +11:00
|
|
|
[DataField("requiredSlot"), AutoNetworkedField]
|
2022-04-23 15:31:45 +12:00
|
|
|
public SlotFlags RequiredFlags = SlotFlags.OUTERCLOTHING;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The container that the clothing is stored in when not equipped.
|
|
|
|
|
/// </summary>
|
2023-12-06 17:59:31 +11:00
|
|
|
[DataField, AutoNetworkedField]
|
2022-04-23 15:31:45 +12:00
|
|
|
public string ContainerId = DefaultClothingContainerId;
|
|
|
|
|
|
2022-04-30 16:54:35 +12:00
|
|
|
[ViewVariables]
|
2022-04-23 15:31:45 +12:00
|
|
|
public ContainerSlot? Container;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The Id of the piece of clothing that belongs to this component. Required for map-saving if the clothing is
|
|
|
|
|
/// currently not inside of the container.
|
|
|
|
|
/// </summary>
|
2023-12-06 17:59:31 +11:00
|
|
|
[DataField, AutoNetworkedField]
|
2022-04-23 15:31:45 +12:00
|
|
|
public EntityUid? ClothingUid;
|
2023-03-06 06:12:08 +13:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Time it takes for this clothing to be toggled via the stripping menu verbs. Null prevents the verb from even showing up.
|
|
|
|
|
/// </summary>
|
2023-12-06 17:59:31 +11:00
|
|
|
[DataField, AutoNetworkedField]
|
2023-03-06 06:12:08 +13:00
|
|
|
public TimeSpan? StripDelay = TimeSpan.FromSeconds(3);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2023-09-08 18:16:05 -07:00
|
|
|
/// Text shown in the toggle-clothing verb. Defaults to using the name of the <see cref="ActionEntity"/> action.
|
2023-03-06 06:12:08 +13:00
|
|
|
/// </summary>
|
2023-12-06 17:59:31 +11:00
|
|
|
[DataField, AutoNetworkedField]
|
2023-03-06 06:12:08 +13:00
|
|
|
public string? VerbText;
|
2022-04-23 15:31:45 +12:00
|
|
|
}
|