From e4b925b0ea1a1689260de814dadd114ca9c7aeaf Mon Sep 17 00:00:00 2001 From: BlueHNT <79374236+BlueHNT@users.noreply.github.com> Date: Sat, 10 Aug 2024 23:36:48 +0200 Subject: [PATCH] Adds BeardTag (#608) # Description Adds `BeardTag = "HidesBeard"` for helmets which cover entire head, masks which should hide beards and such. --- # Changelog :cl: - add: Added `HidesBeard` tag --- .../Clothing/EntitySystems/ClothingSystem.cs | 11 ++++++++++- Resources/Prototypes/tags.yml | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs b/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs index 087e2ecedab..b407b867f74 100644 --- a/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs +++ b/Content.Shared/Clothing/EntitySystems/ClothingSystem.cs @@ -28,6 +28,10 @@ public abstract class ClothingSystem : EntitySystem [ValidatePrototypeId] private const string NoseTag = "HidesNose"; + [ValidatePrototypeId] + + private const string BeardTag = "HidesBeard"; + public override void Initialize() { base.Initialize(); @@ -106,7 +110,7 @@ private void ToggleVisualLayer(EntityUid equipee, HumanoidVisualLayers layer, st { if (_tagSystem.HasTag(item, tag)) { - if (tag == NoseTag) //Special check needs to be made for NoseTag, due to masks being toggleable + if (tag == NoseTag || tag == BeardTag) // Special check for NoseTag or BeardTag, due to masks being toggleable { if (TryComp(item, out MaskComponent? mask) && TryComp(item, out ClothingComponent? clothing)) { @@ -139,6 +143,8 @@ protected virtual void OnGotEquipped(EntityUid uid, ClothingComponent component, ToggleVisualLayer(args.Equipee, HumanoidVisualLayers.Hair, HairTag); if ((new string[] { "mask", "head" }).Contains(args.Slot) && _tagSystem.HasTag(args.Equipment, NoseTag)) ToggleVisualLayer(args.Equipee, HumanoidVisualLayers.Snout, NoseTag); + if ((new string[] { "mask", "head" }).Contains(args.Slot) && _tagSystem.HasTag(args.Equipment, BeardTag)) + ToggleVisualLayer(args.Equipee, HumanoidVisualLayers.FacialHair, BeardTag); } protected virtual void OnGotUnequipped(EntityUid uid, ClothingComponent component, GotUnequippedEvent args) @@ -148,6 +154,8 @@ protected virtual void OnGotUnequipped(EntityUid uid, ClothingComponent componen ToggleVisualLayer(args.Equipee, HumanoidVisualLayers.Hair, HairTag); if ((new string[] { "mask", "head" }).Contains(args.Slot) && _tagSystem.HasTag(args.Equipment, NoseTag)) ToggleVisualLayer(args.Equipee, HumanoidVisualLayers.Snout, NoseTag); + if ((new string[] { "mask", "head" }).Contains(args.Slot) && _tagSystem.HasTag(args.Equipment, BeardTag)) + ToggleVisualLayer(args.Equipee, HumanoidVisualLayers.FacialHair, BeardTag); } private void OnGetState(EntityUid uid, ClothingComponent component, ref ComponentGetState args) @@ -166,6 +174,7 @@ private void OnMaskToggled(Entity ent, ref ItemMaskToggledEve //TODO: sprites for 'pulled down' state. defaults to invisible due to no sprite with this prefix SetEquippedPrefix(ent, args.IsToggled ? args.equippedPrefix : null, ent); ToggleVisualLayer(args.Wearer, HumanoidVisualLayers.Snout, NoseTag); + ToggleVisualLayer(args.Wearer, HumanoidVisualLayers.FacialHair, BeardTag); } private void OnPickedUp(Entity ent, ref GettingPickedUpAttemptEvent args) diff --git a/Resources/Prototypes/tags.yml b/Resources/Prototypes/tags.yml index 786f641ddd1..928da630f6f 100644 --- a/Resources/Prototypes/tags.yml +++ b/Resources/Prototypes/tags.yml @@ -704,6 +704,9 @@ - type: Tag id: HidesNose # for non-standard noses. +- type: Tag + id: HidesBeard # for full coverage helmet / masks where beard shouldn't show + - type: Tag id: HighRiskItem