Skip to content

Commit

Permalink
Adds BeardTag (#608)
Browse files Browse the repository at this point in the history
<!--
This is a semi-strict format, you can add/remove sections as needed but
the order/format should be kept the same
Remove these comments before submitting
-->

# Description

<!--
Explain this PR in as much detail as applicable

Some example prompts to consider:
How might this affect the game? The codebase?
What might be some alternatives to this?
How/Who does this benefit/hurt [the game/codebase]?
-->

Adds `BeardTag = "HidesBeard"`

for helmets which cover entire head, masks which should hide beards and
such.

---

# Changelog

<!--
You can add an author after the `:cl:` to change the name that appears
in the changelog (ex: `:cl: Death`)
Leaving it blank will default to your GitHub display name
This includes all available types for the changelog
-->

:cl:
- add: Added `HidesBeard` tag
  • Loading branch information
BlueHNT committed Aug 10, 2024
1 parent 9869330 commit e4b925b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Content.Shared/Clothing/EntitySystems/ClothingSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ public abstract class ClothingSystem : EntitySystem
[ValidatePrototypeId<TagPrototype>]
private const string NoseTag = "HidesNose";

[ValidatePrototypeId<TagPrototype>]

private const string BeardTag = "HidesBeard";

public override void Initialize()
{
base.Initialize();
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -166,6 +174,7 @@ private void OnMaskToggled(Entity<ClothingComponent> 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<ClothingComponent> ent, ref GettingPickedUpAttemptEvent args)
Expand Down
3 changes: 3 additions & 0 deletions Resources/Prototypes/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e4b925b

Please sign in to comment.