Files
tbd-station-14/Content.Shared/Clothing/Components/MaskComponent.cs
paige404 2e7f01b99e Fix broken layer hiding on clothes with multiple equipment slots (#34080)
* Fix broken layer hiding on clothes with multiple equipment slots

* Refactor ToggleVisualLayers, HideLayerClothingComponent, and ClothingComponent to allow more
precise layer hide behavior and more CPU efficient layer toggling.

* Adjust HumanoidAppearaceSystem to track which slots are hiding a given layer (e.g. gas mask and welding mask)
Add documentation
Change gas masks to use the new HideLayerClothingComponent structure as an example of its usage

* Fix the delayed snout bug

* Misc cleanup

* Make `bool permanent` implicit from SlotFlags

any non-permanent visibility toggle with `SlotFlags.None` isn't supported with how its set up. And similarly, the slot flags argument does nothing if permanent = true. So IMO it makes more sense to infer it from a nullable arg.

* Split into separate system

Too much pasta

* Remove (hopefully unnecessary) refresh

* Fisk mask networking

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

* Keep old behaviour, use clearer names?

I'm just guessing at what this was meant to do

* english

* Separate slot name & flag

* dirty = true

* fix comment

* Improved SetLayerVisibility with dirtying logic suggested by @ElectroJr

* Only set mask toggled if DisableOnFold is true

* FoldableClothingSystem fixes

* fix bandana state

* Better comment

---------

Co-authored-by: ElectroJr <leonsfriedrich@gmail.com>
2025-03-21 00:30:47 +11:00

48 lines
1.5 KiB
C#

using Content.Shared.Clothing.EntitySystems;
using Robust.Shared.GameStates;
using Robust.Shared.Prototypes;
namespace Content.Shared.Clothing.Components;
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
[Access(typeof(MaskSystem))]
public sealed partial class MaskComponent : Component
{
/// <summary>
/// Action for toggling a mask (e.g., pulling the mask down or putting it back up)
/// </summary>
[DataField, AutoNetworkedField]
public EntProtoId ToggleAction = "ActionToggleMask";
/// <summary>
/// Action for toggling a mask (e.g., pulling the mask down or putting it back up)
/// </summary>
[DataField, AutoNetworkedField]
public EntityUid? ToggleActionEntity;
/// <summary>
/// Whether the mask is currently toggled (e.g., pulled down).
/// This generally disables some of the mask's functionality.
/// </summary>
[DataField, AutoNetworkedField]
public bool IsToggled;
/// <summary>
/// Equipped prefix to use after the mask was pulled down.
/// </summary>
[DataField, AutoNetworkedField]
public string EquippedPrefix = "up";
/// <summary>
/// When <see langword="false"/>, the mask will not be toggleable.
/// </summary>
[DataField("enabled"), AutoNetworkedField]
public bool IsToggleable = true;
/// <summary>
/// When <see langword="true"/> will disable <see cref="IsToggleable"/> when folded
/// </summary>
[DataField, AutoNetworkedField]
public bool DisableOnFolded;
}