Files
tbd-station-14/Content.Client/Toggleable/ToggleableVisualsComponent.cs
Centronias 9053c9692f Decouple Lights from Toggleable Visuals (and headphone music notes bugfix) (#35341)
* - Combine enum keys `ToggleableLightVisuals` and `ToggleVisuals` into `ToggleableVisuals`
- Rename `ToggleableLightVisualsComponent` to `ToggleableVisualsComponent` and `ToggleableLightVisualsSystem` to `ToggleableVisualsSystem`
  - (The `SpriteLayer` field on the component is now required because the old default of `light` doesn't make sense anymore)
- Make it so that `ToggleableVisualsComponent` works even when there's not a light attached to the entity
  - (Amazingly this seems to have only applied to  Headphones, but I can only imagine there are many other things people would like to do with simple toggleable visuals)
- Explicitly make `ItemTogglePointLightComponent`'s purpose to make `ToggleVisualsComponent` apply to `PointLightComponent`s on the same entity.
  - Add field `ToggleableVisualsColorModulatesLights`, which makes the `Color` appearance value of `ToggleableVisuals` modulate the color of lights on the same entity
  - Lots of prototype updates to uptake the above

* fix bad merge

* unbork robust

* blindly letting rider reformat stuff

* I guess I never cleaned up these imports at all
2025-05-30 19:53:56 -04:00

31 lines
1.1 KiB
C#

using Content.Shared.Hands.Components;
namespace Content.Client.Toggleable;
/// <summary>
/// Component that handles toggling the visuals of an entity, including layers on an entity's sprite,
/// the in-hand visuals, and the clothing/equipment visuals.
/// </summary>
/// <see cref="ToggleableVisualsSystem"/>
[RegisterComponent]
public sealed partial class ToggleableVisualsComponent : Component
{
/// <summary>
/// Sprite layer that will have its visibility toggled when this item is toggled.
/// </summary>
[DataField(required: true)]
public string? SpriteLayer;
/// <summary>
/// Layers to add to the sprite of the player that is holding this entity (while the component is toggled on).
/// </summary>
[DataField]
public Dictionary<HandLocation, List<PrototypeLayerData>> InhandVisuals = new();
/// <summary>
/// Layers to add to the sprite of the player that is wearing this entity (while the component is toggled on).
/// </summary>
[DataField]
public Dictionary<string, List<PrototypeLayerData>> ClothingVisuals = new();
}