diff --git a/Content.Shared/Clothing/Components/MaskComponent.cs b/Content.Shared/Clothing/Components/MaskComponent.cs index 5430417a8c..8948eaba77 100644 --- a/Content.Shared/Clothing/Components/MaskComponent.cs +++ b/Content.Shared/Clothing/Components/MaskComponent.cs @@ -22,4 +22,18 @@ public sealed partial class MaskComponent : Component [DataField, AutoNetworkedField] public string EquippedPrefix = "toggled"; + + /// + /// WD Ahead of wizden. + /// When will function normally, otherwise will not react to events + /// + [DataField("enabled"), AutoNetworkedField] + public bool IsEnabled = true; + + /// + /// WD Ahead of wizden. + /// When will disable when folded + /// + [DataField, AutoNetworkedField] + public bool DisableOnFolded; } diff --git a/Content.Shared/Clothing/EntitySystems/MaskSystem.cs b/Content.Shared/Clothing/EntitySystems/MaskSystem.cs index 2a4383279a..d3e5458eaf 100644 --- a/Content.Shared/Clothing/EntitySystems/MaskSystem.cs +++ b/Content.Shared/Clothing/EntitySystems/MaskSystem.cs @@ -35,7 +35,7 @@ public sealed class MaskSystem : EntitySystem private void OnToggleMask(Entity ent, ref ToggleMaskEvent args) { var (uid, mask) = ent; - if (mask.ToggleActionEntity == null || !_timing.IsFirstTimePredicted) + if (mask.ToggleActionEntity == null || !_timing.IsFirstTimePredicted || !mask.IsEnabled) // WD Ahead of wizden return; if (!_inventorySystem.TryGetSlotEntity(args.Performer, "mask", out var existing) || !uid.Equals(existing)) @@ -53,7 +53,7 @@ public sealed class MaskSystem : EntitySystem // set to untoggled when unequipped, so it isn't left in a 'pulled down' state private void OnGotUnequipped(EntityUid uid, MaskComponent mask, GotUnequippedEvent args) { - if (!mask.IsToggled) + if (!mask.IsToggled || !mask.IsEnabled) // WD Ahead of wizden return; mask.IsToggled = false; @@ -66,7 +66,7 @@ public sealed class MaskSystem : EntitySystem private void ToggleMaskComponents(EntityUid uid, MaskComponent mask, EntityUid wearer, string? equippedPrefix = null, bool isEquip = false) { Dirty(uid, mask); - if (mask.ToggleActionEntity is {} action) + if (mask.ToggleActionEntity is { } action) _actionSystem.SetToggled(action, mask.IsToggled); var maskEv = new ItemMaskToggledEvent(wearer, equippedPrefix, mask.IsToggled, isEquip); @@ -78,6 +78,8 @@ public sealed class MaskSystem : EntitySystem private void OnFolded(Entity ent, ref FoldedEvent args) { + if (ent.Comp.DisableOnFolded) // WD Ahead of wizden + ent.Comp.IsEnabled = !args.IsFolded; ent.Comp.IsToggled = args.IsFolded; ToggleMaskComponents(ent.Owner, ent.Comp, ent.Owner); diff --git a/Resources/Prototypes/Entities/Clothing/Head/bandanas.yml b/Resources/Prototypes/Entities/Clothing/Head/bandanas.yml index 51a56f1f1d..007cba3f22 100644 --- a/Resources/Prototypes/Entities/Clothing/Head/bandanas.yml +++ b/Resources/Prototypes/Entities/Clothing/Head/bandanas.yml @@ -7,6 +7,8 @@ folded: true - type: Mask isToggled: true + enabled: false + disableOnFolded: true - type: IngestionBlocker enabled: false - type: IdentityBlocker @@ -20,6 +22,8 @@ - state: icon_mask map: [ "unfoldedLayer" ] visible: false + - type: HideLayerClothing # needed since head bandana inherits from mask bandana + slots: [] - type: Tag tags: - Bandana diff --git a/Resources/Prototypes/Entities/Clothing/Masks/bandanas.yml b/Resources/Prototypes/Entities/Clothing/Masks/bandanas.yml index f5ad2fb6c8..a3a0348e73 100644 --- a/Resources/Prototypes/Entities/Clothing/Masks/bandanas.yml +++ b/Resources/Prototypes/Entities/Clothing/Masks/bandanas.yml @@ -12,6 +12,7 @@ unfoldedSlots: - MASK - type: Mask + disableOnFolded: true - type: IngestionBlocker - type: IdentityBlocker coverage: MOUTH