Skip to content

Commit

Permalink
Add species-specific code for ToggleableLightVisuals (#35482)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sparlight authored Feb 25, 2025
1 parent f165223 commit 9f4a4b8
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Content.Client/Toggleable/ToggleableLightVisualsSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<PrototypeLayerData>? 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<Color>(uid, ToggleableLightVisuals.Color, out var color, appearance);
Expand Down
4 changes: 4 additions & 0 deletions Resources/Prototypes/Entities/Clothing/Head/eva-helmets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 21 additions & 0 deletions Resources/Prototypes/Entities/Clothing/Head/hardsuit-helmets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9f4a4b8

Please sign in to comment.