]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add nose customization to humans & dwarves (#25557)
authorSlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com>
Mon, 26 Feb 2024 23:15:04 +0000 (00:15 +0100)
committerGitHub <noreply@github.com>
Mon, 26 Feb 2024 23:15:04 +0000 (16:15 -0700)
Initial commit

16 files changed:
Content.Shared/Clothing/EntitySystems/ClothingSystem.cs
Resources/Locale/en-US/markings/noses.ftl [new file with mode: 0644]
Resources/Prototypes/Entities/Clothing/Head/base_clothinghead.yml
Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml
Resources/Prototypes/Entities/Clothing/Masks/bandanas.yml
Resources/Prototypes/Entities/Clothing/Masks/masks.yml
Resources/Prototypes/Entities/Clothing/Masks/specific.yml
Resources/Prototypes/Entities/Mobs/Customization/Markings/human_noses.yml [new file with mode: 0644]
Resources/Prototypes/Species/human.yml
Resources/Prototypes/tags.yml
Resources/Textures/Mobs/Customization/human_noses.rsi/blob.png [new file with mode: 0644]
Resources/Textures/Mobs/Customization/human_noses.rsi/droop.png [new file with mode: 0644]
Resources/Textures/Mobs/Customization/human_noses.rsi/meta.json [new file with mode: 0644]
Resources/Textures/Mobs/Customization/human_noses.rsi/nubby.png [new file with mode: 0644]
Resources/Textures/Mobs/Customization/human_noses.rsi/schnozz.png [new file with mode: 0644]
Resources/Textures/Mobs/Customization/human_noses.rsi/uppie.png [new file with mode: 0644]

index 154171fc054633c8ef17984bc7fdf43ff7fb19c1..50a1d93a6c28545504b9910a0812c30065943a15 100644 (file)
@@ -8,6 +8,7 @@ using Content.Shared.Inventory.Events;
 using Content.Shared.Item;
 using Content.Shared.Tag;
 using Robust.Shared.GameStates;
+using System.Linq;
 
 namespace Content.Shared.Clothing.EntitySystems;
 
@@ -22,6 +23,9 @@ public abstract class ClothingSystem : EntitySystem
     [ValidatePrototypeId<TagPrototype>]
     private const string HairTag = "HidesHair";
 
+    [ValidatePrototypeId<TagPrototype>]
+    private const string NoseTag = "HidesNose";
+
     public override void 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)
     {
         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)
@@ -113,8 +156,8 @@ public abstract class ClothingSystem : EntitySystem
     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)
diff --git a/Resources/Locale/en-US/markings/noses.ftl b/Resources/Locale/en-US/markings/noses.ftl
new file mode 100644 (file)
index 0000000..e49d87d
--- /dev/null
@@ -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
index 2d2d11524f5b2e4768608ccbc8028e8290d56679..d13b284ff292120cbf808539e065174644b631d7 100644 (file)
     - HidesHair
     - WhitelistChameleon
     - HelmetEVA
+    - HidesNose
   - type: IdentityBlocker
 
 - type: entity
     tags:
     - HidesHair
     - WhitelistChameleon
+    - HidesNose
   - type: IdentityBlocker
 
 - type: entity
index 358fc81c8b2a6e58ad1fc0096f85bfc042b3cdfb..25f641b1c4e1c5fc976e01a7da4f87d747ccd2d2 100644 (file)
@@ -17,6 +17,9 @@
     sprite: Clothing/Head/Hardsuits/basic.rsi
   - type: Clothing
     sprite: Clothing/Head/Hardsuits/basic.rsi
+  - type: Tag
+    tags:
+    - HidesNose
 
 #Atmospherics Hardsuit
 - type: entity
index c008a755ee7279a26609e8c162fa7c3af34752c5..2d65e67982f76ce52e942eb795d28683cb3c7f09 100644 (file)
@@ -22,6 +22,9 @@
     - state: icon
       map: ["foldedLayer"]
       visible: false
+  - type: Tag
+    tags:
+    - HidesNose
 
 - type: entity
   parent: ClothingMaskBandanaBase
index 77655e7cdb18ce5a5f5c65e90db4e562b2156168..0b388aee6b15fff3a00b0e37169699145aa21e8b 100644 (file)
@@ -16,6 +16,7 @@
     - 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
index e60c29d2129056b24bae2b9bc365c38cfb45fbc1..1e85073da9bd7c634d0de1228712612735b619a0 100644 (file)
@@ -1,4 +1,4 @@
-- type: entity
+- type: entity
   parent: ClothingMaskBase
   id: ClothingMaskGasChameleon
   name: gas mask
@@ -6,7 +6,8 @@
   suffix: Chameleon
   components:
     - type: Tag
-      tags: [] # ignore "WhitelistChameleon" tag
+      tags: # ignore "WhitelistChameleon" tag
+        - HidesNose
     - type: Sprite
       sprite: Clothing/Mask/gas.rsi
     - type: Clothing
diff --git a/Resources/Prototypes/Entities/Mobs/Customization/Markings/human_noses.yml b/Resources/Prototypes/Entities/Mobs/Customization/Markings/human_noses.yml
new file mode 100644 (file)
index 0000000..51fc2fd
--- /dev/null
@@ -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
index 979e226c81a79ed6b4914442dc3ff8813de7d34c..0cbd9cc03fd46787117c9b06376876f59348eab8 100644 (file)
@@ -20,6 +20,7 @@
     Head: MobHumanHead
     Hair: MobHumanoidAnyMarking
     FacialHair: MobHumanoidAnyMarking
+    Snout: MobHumanoidAnyMarking
     Chest: MobHumanTorso
     Eyes: MobHumanoidEyes
     LArm: MobHumanLArm
@@ -40,6 +41,9 @@
     FacialHair:
       points: 1
       required: false
+    Snout:
+      points: 1
+      required: false
     Tail: # the cat tail joke
       points: 0
       required: false
index 6e13da6a9a497f7e67b8620350d9dff767249ae8..e2d08042b568d68a30b639e527104f602643abb1 100644 (file)
 - type: Tag
   id: HidesHair # for headwear.
 
+- type: Tag
+  id: HidesNose # for non-standard noses.
+
 - type: Tag
   id: HighRiskItem
 
diff --git a/Resources/Textures/Mobs/Customization/human_noses.rsi/blob.png b/Resources/Textures/Mobs/Customization/human_noses.rsi/blob.png
new file mode 100644 (file)
index 0000000..31774b8
Binary files /dev/null and b/Resources/Textures/Mobs/Customization/human_noses.rsi/blob.png differ
diff --git a/Resources/Textures/Mobs/Customization/human_noses.rsi/droop.png b/Resources/Textures/Mobs/Customization/human_noses.rsi/droop.png
new file mode 100644 (file)
index 0000000..57bed8e
Binary files /dev/null and b/Resources/Textures/Mobs/Customization/human_noses.rsi/droop.png differ
diff --git a/Resources/Textures/Mobs/Customization/human_noses.rsi/meta.json b/Resources/Textures/Mobs/Customization/human_noses.rsi/meta.json
new file mode 100644 (file)
index 0000000..af67414
--- /dev/null
@@ -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
+    }
+  ]
+}
diff --git a/Resources/Textures/Mobs/Customization/human_noses.rsi/nubby.png b/Resources/Textures/Mobs/Customization/human_noses.rsi/nubby.png
new file mode 100644 (file)
index 0000000..ab5bdde
Binary files /dev/null and b/Resources/Textures/Mobs/Customization/human_noses.rsi/nubby.png differ
diff --git a/Resources/Textures/Mobs/Customization/human_noses.rsi/schnozz.png b/Resources/Textures/Mobs/Customization/human_noses.rsi/schnozz.png
new file mode 100644 (file)
index 0000000..618c5f5
Binary files /dev/null and b/Resources/Textures/Mobs/Customization/human_noses.rsi/schnozz.png differ
diff --git a/Resources/Textures/Mobs/Customization/human_noses.rsi/uppie.png b/Resources/Textures/Mobs/Customization/human_noses.rsi/uppie.png
new file mode 100644 (file)
index 0000000..a1be557
Binary files /dev/null and b/Resources/Textures/Mobs/Customization/human_noses.rsi/uppie.png differ