Files
wwdpublic/Content.Shared/Clothing/Components/ToggleableClothingComponent.cs
Eris d6f3265e83 MODsuits (Port From Goob #1242) (#1640)
# Description

Ports MODsuits from Goobstation PR
https://github.com/Goob-Station/Goob-Station/pull/1242. The PR author
has confirmed that he is okay with me doing this.

---

# TODO

- [X] Port in sprites
- [x] Port in YMLs
- [X] Port code
- [x] Port code PATCHES
- [x] Update EE with required fixes

---

<details><summary><h1>Media</h1></summary>
<p>

## Modsuit crafting

https://github.com/user-attachments/assets/8ff03d3a-0fc1-4818-b710-bfc43f0e2a68

## Modsuit sealing

https://github.com/user-attachments/assets/6671459a-7767-499b-8678-062fc1db7134

</p>
</details>

---

# Changelog

🆑
- add: Modsuits have been ported from Goobstation!

---------

Signed-off-by: Eris <erisfiregamer1@gmail.com>
Co-authored-by: DEATHB4DEFEAT <77995199+DEATHB4DEFEAT@users.noreply.github.com>
Co-authored-by: VMSolidus <evilexecutive@gmail.com>

(cherry picked from commit cb06c41fc07275e1f15af916babb44368c0c26c2)
2025-01-29 20:09:26 +03:00

116 lines
3.8 KiB
C#

using Content.Shared.Clothing.EntitySystems;
using Content.Shared.Inventory;
using Robust.Shared.Containers;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
namespace Content.Shared.Clothing.Components;
/// <summary>
/// This component gives an item an action that will equip or un-equip some clothing e.g. hardsuits and hardsuit helmets.
/// </summary>
[Access(typeof(ToggleableClothingSystem))]
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class ToggleableClothingComponent : Component
{
public const string DefaultClothingContainerId = "toggleable-clothing";
/// <summary>
/// Action used to toggle the clothing on or off.
/// </summary>
[DataField, AutoNetworkedField]
public EntProtoId Action = "ActionToggleSuitPiece";
[DataField, AutoNetworkedField]
public EntityUid? ActionEntity;
// Goobstation - ClothingPrototype and Slot Fields saved for compatibility with old prototype
/// <summary>
/// Default clothing entity prototype to spawn into the clothing container.
/// </summary>
[DataField, AutoNetworkedField]
public EntProtoId? ClothingPrototype;
/// <summary>
/// The inventory slot that the clothing is equipped to.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField, AutoNetworkedField]
public string Slot = string.Empty;
/// <summary>
/// Dictionary of inventory slots and entity prototypes to spawn into the clothing container.
/// </summary>
[DataField, AutoNetworkedField]
public Dictionary<string, EntProtoId> ClothingPrototypes = new();
/// <summary>
/// Dictionary of clothing uids and slots
/// </summary>
[DataField, AutoNetworkedField]
public Dictionary<EntityUid, string> ClothingUids = new();
/// <summary>
/// The inventory slot flags required for this component to function.
/// </summary>
[DataField("requiredSlot"), AutoNetworkedField]
public SlotFlags RequiredFlags = SlotFlags.OUTERCLOTHING;
/// <summary>
/// The container that the clothing is stored in when not equipped.
/// </summary>
[DataField, AutoNetworkedField]
public string ContainerId = DefaultClothingContainerId;
[ViewVariables]
public Container? Container;
/// <summary>
/// Time it takes for this clothing to be toggled via the stripping menu verbs. Null prevents the verb from even showing up.
/// </summary>
[DataField, AutoNetworkedField]
public TimeSpan? StripDelay = TimeSpan.FromSeconds(3);
/// <summary>
/// Text shown in the toggle-clothing verb. Defaults to using the name of the <see cref="ActionEntity"/> action.
/// </summary>
[DataField, AutoNetworkedField]
public string? VerbText;
/// <summary>
/// If true it will block unequip of this entity until all attached clothing are removed
/// </summary>
[DataField, AutoNetworkedField]
public bool BlockUnequipWhenAttached = false;
/// <summary>
/// If true all attached will replace already equipped clothing on equip attempt
/// </summary>
[DataField, AutoNetworkedField]
public bool ReplaceCurrentClothing = false;
[DataField, AutoNetworkedField]
public string AttachTooltip = "toggleable-clothing-attach-tooltip";
[DataField, AutoNetworkedField]
public string UnattachTooltip = "toggleable-clothing-unattach-tooltip";
}
[Serializable, NetSerializable]
public enum ToggleClothingUiKey : byte
{
Key
}
[Serializable, NetSerializable]
public sealed class ToggleableClothingUiMessage : BoundUserInterfaceMessage
{
public NetEntity AttachedClothingUid;
public ToggleableClothingUiMessage(NetEntity attachedClothingUid)
{
AttachedClothingUid = attachedClothingUid;
}
}