From 9f4a4b81ac8d47955c666e653bdefd193897b08f Mon Sep 17 00:00:00 2001 From: Sparlight Date: Tue, 25 Feb 2025 10:00:37 -0700 Subject: [PATCH] Add species-specific code for ToggleableLightVisuals (#35482) --- .../ToggleableLightVisualsSystem.cs | 12 ++++++++++- .../Entities/Clothing/Head/eva-helmets.yml | 4 ++++ .../Clothing/Head/hardsuit-helmets.yml | 21 +++++++++++++++++++ .../Entities/Clothing/OuterClothing/armor.yml | 3 +++ 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/Content.Client/Toggleable/ToggleableLightVisualsSystem.cs b/Content.Client/Toggleable/ToggleableLightVisualsSystem.cs index 3507c786b997..a3d35ffeedd7 100644 --- a/Content.Client/Toggleable/ToggleableLightVisualsSystem.cs +++ b/Content.Client/Toggleable/ToggleableLightVisualsSystem.cs @@ -2,6 +2,7 @@ using Content.Client.Items.Systems; using Content.Shared.Clothing; using Content.Shared.Hands; +using Content.Shared.Inventory; using Content.Shared.Item; using Content.Shared.Toggleable; using Robust.Client.GameObjects; @@ -62,7 +63,16 @@ private void OnGetEquipmentVisuals(EntityUid uid, ToggleableLightVisualsComponen || !enabled) return; - if (!component.ClothingVisuals.TryGetValue(args.Slot, out var layers)) + if (!TryComp(args.Equipee, out InventoryComponent? inventory)) + return; + List? layers = null; + + // attempt to get species specific data + if (inventory.SpeciesId != null) + component.ClothingVisuals.TryGetValue($"{args.Slot}-{inventory.SpeciesId}", out layers); + + // No species specific data. Try to default to generic data. + if (layers == null && !component.ClothingVisuals.TryGetValue(args.Slot, out layers)) return; var modulate = AppearanceSystem.TryGetData(uid, ToggleableLightVisuals.Color, out var color, appearance); diff --git a/Resources/Prototypes/Entities/Clothing/Head/eva-helmets.yml b/Resources/Prototypes/Entities/Clothing/Head/eva-helmets.yml index 60a0e0be2873..3aec1f83c4fb 100644 --- a/Resources/Prototypes/Entities/Clothing/Head/eva-helmets.yml +++ b/Resources/Prototypes/Entities/Clothing/Head/eva-helmets.yml @@ -79,10 +79,14 @@ clothingVisuals: head: - state: equipped-head-light + head-vox: + - state: equipped-head-light-vox - type: Clothing clothingVisuals: head: - state: equipped-head + head-vox: + - state: equipped-head-vox - type: TemperatureProtection heatingCoefficient: 0.1 coolingCoefficient: 0.1 diff --git a/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml b/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml index 68b5e356cbf9..744729fa4130 100644 --- a/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml +++ b/Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml @@ -48,12 +48,19 @@ head: - state: equipped-head-light shader: unshaded + head-vox: + - state: equipped-head-light-vox + shader: unshaded - type: Clothing clothingVisuals: head: - state: equipped-head - state: equipped-head-unshaded shader: unshaded + head-vox: + - state: equipped-head-vox + - state: equipped-head-unshaded-vox + shader: unshaded - type: PointLight color: "#adffe6" - type: PressureProtection @@ -106,12 +113,19 @@ head: - state: equipped-head-light shader: unshaded + head-vox: + - state: equipped-head-light-vox + shader: unshaded - type: Clothing clothingVisuals: head: - state: equipped-head - state: equipped-head-unshaded shader: unshaded + head-vox: + - state: equipped-head-vox + - state: equipped-head-unshaded-vox + shader: unshaded - type: PointLight radius: 6 - type: PressureProtection @@ -159,12 +173,19 @@ head: - state: equipped-head-light shader: unshaded + head-vox: + - state: equipped-head-light-vox + shader: unshaded - type: Clothing clothingVisuals: head: - state: equipped-head - state: equipped-head-unshaded shader: unshaded + head-vox: + - state: equipped-head-vox + - state: equipped-head-unshaded-vox + shader: unshaded - type: PointLight radius: 6 - type: PressureProtection diff --git a/Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml b/Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml index c28cca566952..539cec93289d 100644 --- a/Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml +++ b/Resources/Prototypes/Entities/Clothing/OuterClothing/armor.yml @@ -140,6 +140,9 @@ outerClothing: - state: equipped-OUTERCLOTHING-light shader: unshaded + outerClothing-vox: + - state: equipped-OUTERCLOTHING-light-vox + shader: unshaded - type: Appearance - type: HandheldLight addPrefix: false