Add nose customization to humans & dwarves (#25557)

Initial commit
This commit is contained in:
SlamBamActionman
2024-02-27 00:15:04 +01:00
committed by GitHub
parent a0b0579d2e
commit 3af2928a25
16 changed files with 199 additions and 8 deletions

View File

@@ -8,6 +8,7 @@ using Content.Shared.Inventory.Events;
using Content.Shared.Item; using Content.Shared.Item;
using Content.Shared.Tag; using Content.Shared.Tag;
using Robust.Shared.GameStates; using Robust.Shared.GameStates;
using System.Linq;
namespace Content.Shared.Clothing.EntitySystems; namespace Content.Shared.Clothing.EntitySystems;
@@ -22,6 +23,9 @@ public abstract class ClothingSystem : EntitySystem
[ValidatePrototypeId<TagPrototype>] [ValidatePrototypeId<TagPrototype>]
private const string HairTag = "HidesHair"; private const string HairTag = "HidesHair";
[ValidatePrototypeId<TagPrototype>]
private const string NoseTag = "HidesNose";
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
@@ -85,18 +89,57 @@ public abstract class ClothingSystem : EntitySystem
} }
} }
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) protected virtual void OnGotEquipped(EntityUid uid, ClothingComponent component, GotEquippedEvent args)
{ {
component.InSlot = args.Slot; component.InSlot = args.Slot;
if (args.Slot == "head" && _tagSystem.HasTag(args.Equipment, HairTag)) if ((new string[] { "head" }).Contains(args.Slot) && _tagSystem.HasTag(args.Equipment, HairTag))
_humanoidSystem.SetLayerVisibility(args.Equipee, HumanoidVisualLayers.Hair, false); 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) protected virtual void OnGotUnequipped(EntityUid uid, ClothingComponent component, GotUnequippedEvent args)
{ {
component.InSlot = null; component.InSlot = null;
if (args.Slot == "head" && _tagSystem.HasTag(args.Equipment, HairTag)) if ((new string[] { "head" }).Contains(args.Slot) && _tagSystem.HasTag(args.Equipment, HairTag))
_humanoidSystem.SetLayerVisibility(args.Equipee, HumanoidVisualLayers.Hair, true); 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 OnGetState(EntityUid uid, ClothingComponent component, ref ComponentGetState args)
@@ -113,8 +156,8 @@ public abstract class ClothingSystem : EntitySystem
private void OnMaskToggled(Entity<ClothingComponent> ent, ref ItemMaskToggledEvent 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 //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) private void OnEquipDoAfter(Entity<ClothingComponent> ent, ref ClothingEquipDoAfterEvent args)

View File

@@ -0,0 +1,14 @@
marking-HumanNoseSchnozz = Schnozz
marking-HumanNoseSchnozz-schnozz = Nose
marking-HumanNoseNubby = Nubby Nose
marking-HumanNoseNubby-nubby = Nose
marking-HumanNoseDroop = Droopy Nose
marking-HumanNoseDroop-droop = Nose
marking-HumanNoseBlob = Blobby Nose
marking-HumanNoseBlob-blob = Nose
marking-HumanNoseUppie = Uppie Nose
marking-HumanNoseUppie-uppie = Nose

View File

@@ -136,6 +136,7 @@
- HidesHair - HidesHair
- WhitelistChameleon - WhitelistChameleon
- HelmetEVA - HelmetEVA
- HidesNose
- type: IdentityBlocker - type: IdentityBlocker
- type: entity - type: entity
@@ -174,6 +175,7 @@
tags: tags:
- HidesHair - HidesHair
- WhitelistChameleon - WhitelistChameleon
- HidesNose
- type: IdentityBlocker - type: IdentityBlocker
- type: entity - type: entity

View File

@@ -17,6 +17,9 @@
sprite: Clothing/Head/Hardsuits/basic.rsi sprite: Clothing/Head/Hardsuits/basic.rsi
- type: Clothing - type: Clothing
sprite: Clothing/Head/Hardsuits/basic.rsi sprite: Clothing/Head/Hardsuits/basic.rsi
- type: Tag
tags:
- HidesNose
#Atmospherics Hardsuit #Atmospherics Hardsuit
- type: entity - type: entity

View File

@@ -22,6 +22,9 @@
- state: icon - state: icon
map: ["foldedLayer"] map: ["foldedLayer"]
visible: false visible: false
- type: Tag
tags:
- HidesNose
- type: entity - type: entity
parent: ClothingMaskBandanaBase parent: ClothingMaskBandanaBase

View File

@@ -16,6 +16,7 @@
- MonkeyWearable - MonkeyWearable
- HamsterWearable - HamsterWearable
- WhitelistChameleon - WhitelistChameleon
- HidesNose
- type: entity - type: entity
parent: ClothingMaskGas parent: ClothingMaskGas
@@ -195,6 +196,7 @@
tags: tags:
- ClownMask - ClownMask
- WhitelistChameleon - WhitelistChameleon
- HidesNose
- type: entity - type: entity
parent: ClothingMaskClownBase parent: ClothingMaskClownBase
@@ -205,6 +207,7 @@
- ClownMask - ClownMask
- HamsterWearable - HamsterWearable
- WhitelistChameleon - WhitelistChameleon
- HidesNose
- type: entity - type: entity
parent: ClothingMaskClown parent: ClothingMaskClown
@@ -231,6 +234,9 @@
sprite: Clothing/Mask/joy.rsi sprite: Clothing/Mask/joy.rsi
- type: BreathMask - type: BreathMask
- type: IdentityBlocker - type: IdentityBlocker
- type: Tag
tags:
- HidesNose
- type: entity - type: entity
parent: ClothingMaskBase parent: ClothingMaskBase
@@ -248,6 +254,7 @@
tags: tags:
- HamsterWearable - HamsterWearable
- WhitelistChameleon - WhitelistChameleon
- HidesNose
- type: entity - type: entity
parent: ClothingMaskPullableBase parent: ClothingMaskPullableBase
@@ -298,6 +305,9 @@
- type: BreathMask - type: BreathMask
- type: IngestionBlocker - type: IngestionBlocker
- type: IdentityBlocker - type: IdentityBlocker
- type: Tag
tags:
- HidesNose
- type: entity - type: entity
parent: ClothingMaskClownBase parent: ClothingMaskClownBase
@@ -326,7 +336,9 @@
sprite: Clothing/Mask/swat.rsi sprite: Clothing/Mask/swat.rsi
- type: Tag - type: Tag
tags: tags:
- WhitelistChameleon
- HidesHair - HidesHair
- HidesNose
- type: entity - type: entity
parent: ClothingMaskGasExplorer parent: ClothingMaskGasExplorer
@@ -351,7 +363,9 @@
sprite: Clothing/Mask/ert.rsi sprite: Clothing/Mask/ert.rsi
- type: Tag - type: Tag
tags: tags:
- WhitelistChameleon
- HidesHair - HidesHair
- HidesNose
- type: entity - type: entity
parent: ClothingMaskGasERT parent: ClothingMaskGasERT
@@ -386,6 +400,7 @@
tags: tags:
- HamsterWearable - HamsterWearable
- WhitelistChameleon - WhitelistChameleon
- HidesNose
- type: IdentityBlocker - type: IdentityBlocker
- type: entity - type: entity
@@ -400,6 +415,9 @@
sprite: Clothing/Mask/fox.rsi sprite: Clothing/Mask/fox.rsi
- type: BreathMask - type: BreathMask
- type: IdentityBlocker - type: IdentityBlocker
- type: Tag
tags:
- HidesNose
- type: entity - type: entity
parent: ClothingMaskBase parent: ClothingMaskBase
@@ -413,6 +431,9 @@
sprite: Clothing/Mask/bee.rsi sprite: Clothing/Mask/bee.rsi
- type: BreathMask - type: BreathMask
- type: IdentityBlocker - type: IdentityBlocker
- type: Tag
tags:
- HidesNose
- type: entity - type: entity
parent: ClothingMaskBase parent: ClothingMaskBase
@@ -426,6 +447,9 @@
sprite: Clothing/Mask/bear.rsi sprite: Clothing/Mask/bear.rsi
- type: BreathMask - type: BreathMask
- type: IdentityBlocker - type: IdentityBlocker
- type: Tag
tags:
- HidesNose
- type: entity - type: entity
parent: ClothingMaskBase parent: ClothingMaskBase
@@ -439,6 +463,9 @@
sprite: Clothing/Mask/raven.rsi sprite: Clothing/Mask/raven.rsi
- type: BreathMask - type: BreathMask
- type: IdentityBlocker - type: IdentityBlocker
- type: Tag
tags:
- HidesNose
- type: entity - type: entity
parent: ClothingMaskBase parent: ClothingMaskBase
@@ -452,6 +479,9 @@
sprite: Clothing/Mask/jackal.rsi sprite: Clothing/Mask/jackal.rsi
- type: BreathMask - type: BreathMask
- type: IdentityBlocker - type: IdentityBlocker
- type: Tag
tags:
- HidesNose
- type: entity - type: entity
parent: ClothingMaskBase parent: ClothingMaskBase
@@ -465,6 +495,9 @@
sprite: Clothing/Mask/bat.rsi sprite: Clothing/Mask/bat.rsi
- type: BreathMask - type: BreathMask
- type: IdentityBlocker - type: IdentityBlocker
- type: Tag
tags:
- HidesNose
- type: entity - type: entity
parent: ClothingMaskBase parent: ClothingMaskBase

View File

@@ -1,4 +1,4 @@
- type: entity - type: entity
parent: ClothingMaskBase parent: ClothingMaskBase
id: ClothingMaskGasChameleon id: ClothingMaskGasChameleon
name: gas mask name: gas mask
@@ -6,7 +6,8 @@
suffix: Chameleon suffix: Chameleon
components: components:
- type: Tag - type: Tag
tags: [] # ignore "WhitelistChameleon" tag tags: # ignore "WhitelistChameleon" tag
- HidesNose
- type: Sprite - type: Sprite
sprite: Clothing/Mask/gas.rsi sprite: Clothing/Mask/gas.rsi
- type: Clothing - type: Clothing

View File

@@ -0,0 +1,54 @@
- 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

View File

@@ -20,6 +20,7 @@
Head: MobHumanHead Head: MobHumanHead
Hair: MobHumanoidAnyMarking Hair: MobHumanoidAnyMarking
FacialHair: MobHumanoidAnyMarking FacialHair: MobHumanoidAnyMarking
Snout: MobHumanoidAnyMarking
Chest: MobHumanTorso Chest: MobHumanTorso
Eyes: MobHumanoidEyes Eyes: MobHumanoidEyes
LArm: MobHumanLArm LArm: MobHumanLArm
@@ -40,6 +41,9 @@
FacialHair: FacialHair:
points: 1 points: 1
required: false required: false
Snout:
points: 1
required: false
Tail: # the cat tail joke Tail: # the cat tail joke
points: 0 points: 0
required: false required: false

View File

@@ -653,6 +653,9 @@
- type: Tag - type: Tag
id: HidesHair # for headwear. id: HidesHair # for headwear.
- type: Tag
id: HidesNose # for non-standard noses.
- type: Tag - type: Tag
id: HighRiskItem id: HighRiskItem

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,31 @@
{
"version":1,
"size": {
"x":32,
"y":32
},
"copyright":"Created by SlamBamActionman",
"license":"CC-BY-SA-3.0",
"states": [
{
"name":"schnozz",
"directions":4
},
{
"name":"blob",
"directions":4
},
{
"name":"droop",
"directions":4
},
{
"name":"uppie",
"directions":4
},
{
"name":"nubby",
"directions":4
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB