using Content.Shared.Item;
using Content.Shared.Tag;
using Robust.Shared.GameStates;
+using System.Linq;
namespace Content.Shared.Clothing.EntitySystems;
[ValidatePrototypeId<TagPrototype>]
private const string HairTag = "HidesHair";
+ [ValidatePrototypeId<TagPrototype>]
+ private const string NoseTag = "HidesNose";
+
public override void Initialize()
{
base.Initialize();
}
}
+ private void ToggleVisualLayer(EntityUid equipee, HumanoidVisualLayers layer, string tag)
+ {
+ InventorySystem.InventorySlotEnumerator enumerator = _invSystem.GetSlotEnumerator(equipee);
+ bool shouldLayerShow = true;
+
+ while (enumerator.NextItem(out EntityUid item))
+ {
+ if (_tagSystem.HasTag(item, tag))
+ {
+ if (tag == NoseTag) //Special check needs to be made for NoseTag, due to masks being toggleable
+ {
+ if (TryComp(item, out MaskComponent? mask) && TryComp(item, out ClothingComponent? clothing))
+ {
+ if (clothing.EquippedPrefix != mask.EquippedPrefix)
+ {
+ shouldLayerShow = false;
+ break;
+ }
+ }
+ else
+ {
+ shouldLayerShow = false;
+ break;
+ }
+ }
+ else
+ {
+ shouldLayerShow = false;
+ break;
+ }
+ }
+ }
+ _humanoidSystem.SetLayerVisibility(equipee, layer, shouldLayerShow);
+ }
+
protected virtual void OnGotEquipped(EntityUid uid, ClothingComponent component, GotEquippedEvent args)
{
component.InSlot = args.Slot;
- if (args.Slot == "head" && _tagSystem.HasTag(args.Equipment, HairTag))
- _humanoidSystem.SetLayerVisibility(args.Equipee, HumanoidVisualLayers.Hair, false);
+ if ((new string[] { "head" }).Contains(args.Slot) && _tagSystem.HasTag(args.Equipment, HairTag))
+ 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);
}
protected virtual void OnGotUnequipped(EntityUid uid, ClothingComponent component, GotUnequippedEvent args)
{
component.InSlot = null;
- if (args.Slot == "head" && _tagSystem.HasTag(args.Equipment, HairTag))
- _humanoidSystem.SetLayerVisibility(args.Equipee, HumanoidVisualLayers.Hair, true);
+ if ((new string[] { "head" }).Contains(args.Slot) && _tagSystem.HasTag(args.Equipment, HairTag))
+ 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);
}
private void OnGetState(EntityUid uid, ClothingComponent component, ref ComponentGetState args)
private void OnMaskToggled(Entity<ClothingComponent> ent, ref ItemMaskToggledEvent args)
{
//TODO: sprites for 'pulled down' state. defaults to invisible due to no sprite with this prefix
- if(args.equippedPrefix != null)
- SetEquippedPrefix(ent, args.IsToggled ? args.equippedPrefix : null, ent);
+ SetEquippedPrefix(ent, args.IsToggled ? args.equippedPrefix : null, ent);
+ ToggleVisualLayer(args.Wearer, HumanoidVisualLayers.Snout, NoseTag);
}
private void OnEquipDoAfter(Entity<ClothingComponent> ent, ref ClothingEquipDoAfterEvent args)
- MonkeyWearable
- HamsterWearable
- WhitelistChameleon
+ - HidesNose
- type: entity
parent: ClothingMaskGas
tags:
- ClownMask
- WhitelistChameleon
+ - HidesNose
- type: entity
parent: ClothingMaskClownBase
- ClownMask
- HamsterWearable
- WhitelistChameleon
+ - HidesNose
- type: entity
parent: ClothingMaskClown
sprite: Clothing/Mask/joy.rsi
- type: BreathMask
- type: IdentityBlocker
+ - type: Tag
+ tags:
+ - HidesNose
- type: entity
parent: ClothingMaskBase
tags:
- HamsterWearable
- WhitelistChameleon
+ - HidesNose
- type: entity
parent: ClothingMaskPullableBase
- type: BreathMask
- type: IngestionBlocker
- type: IdentityBlocker
+ - type: Tag
+ tags:
+ - HidesNose
- type: entity
parent: ClothingMaskClownBase
sprite: Clothing/Mask/swat.rsi
- type: Tag
tags:
+ - WhitelistChameleon
- HidesHair
+ - HidesNose
- type: entity
parent: ClothingMaskGasExplorer
sprite: Clothing/Mask/ert.rsi
- type: Tag
tags:
+ - WhitelistChameleon
- HidesHair
+ - HidesNose
- type: entity
parent: ClothingMaskGasERT
tags:
- HamsterWearable
- WhitelistChameleon
+ - HidesNose
- type: IdentityBlocker
- type: entity
sprite: Clothing/Mask/fox.rsi
- type: BreathMask
- type: IdentityBlocker
+ - type: Tag
+ tags:
+ - HidesNose
- type: entity
parent: ClothingMaskBase
sprite: Clothing/Mask/bee.rsi
- type: BreathMask
- type: IdentityBlocker
+ - type: Tag
+ tags:
+ - HidesNose
- type: entity
parent: ClothingMaskBase
sprite: Clothing/Mask/bear.rsi
- type: BreathMask
- type: IdentityBlocker
+ - type: Tag
+ tags:
+ - HidesNose
- type: entity
parent: ClothingMaskBase
sprite: Clothing/Mask/raven.rsi
- type: BreathMask
- type: IdentityBlocker
+ - type: Tag
+ tags:
+ - HidesNose
- type: entity
parent: ClothingMaskBase
sprite: Clothing/Mask/jackal.rsi
- type: BreathMask
- type: IdentityBlocker
+ - type: Tag
+ tags:
+ - HidesNose
- type: entity
parent: ClothingMaskBase
sprite: Clothing/Mask/bat.rsi
- type: BreathMask
- type: IdentityBlocker
+ - type: Tag
+ tags:
+ - HidesNose
- type: entity
parent: ClothingMaskBase
--- /dev/null
+- type: marking
+ id: HumanNoseSchnozz
+ bodyPart: Snout
+ markingCategory: Snout
+ followSkinColor: true
+ forcedColoring: true
+ speciesRestriction: [Human, Dwarf]
+ sprites:
+ - sprite: Mobs/Customization/human_noses.rsi
+ state: schnozz
+
+- type: marking
+ id: HumanNoseNubby
+ bodyPart: Snout
+ markingCategory: Snout
+ followSkinColor: true
+ forcedColoring: true
+ speciesRestriction: [Human, Dwarf]
+ sprites:
+ - sprite: Mobs/Customization/human_noses.rsi
+ state: nubby
+
+- type: marking
+ id: HumanNoseDroop
+ bodyPart: Snout
+ markingCategory: Snout
+ followSkinColor: true
+ forcedColoring: true
+ speciesRestriction: [Human, Dwarf]
+ sprites:
+ - sprite: Mobs/Customization/human_noses.rsi
+ state: droop
+
+- type: marking
+ id: HumanNoseBlob
+ bodyPart: Snout
+ markingCategory: Snout
+ followSkinColor: true
+ forcedColoring: true
+ speciesRestriction: [Human, Dwarf]
+ sprites:
+ - sprite: Mobs/Customization/human_noses.rsi
+ state: blob
+
+- type: marking
+ id: HumanNoseUppie
+ bodyPart: Snout
+ markingCategory: Snout
+ followSkinColor: true
+ forcedColoring: true
+ speciesRestriction: [Human, Dwarf]
+ sprites:
+ - sprite: Mobs/Customization/human_noses.rsi
+ state: uppie