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
This commit is contained in:
@@ -1,16 +1,15 @@
|
||||
using Content.Shared.Item.ItemToggle.Components;
|
||||
using Content.Shared.Light.Components;
|
||||
using Content.Shared.Toggleable;
|
||||
using ItemTogglePointLightComponent = Content.Shared.Light.Components.ItemTogglePointLightComponent;
|
||||
|
||||
namespace Content.Shared.Light.EntitySystems;
|
||||
|
||||
/// <summary>
|
||||
/// Handles ItemToggle for PointLight
|
||||
/// Implements the behavior of <see cref="ItemTogglePointLightComponent"/>, causing <see cref="ItemToggledEvent"/>s to
|
||||
/// enable and disable lights on the entity.
|
||||
/// </summary>
|
||||
public sealed class ItemTogglePointLightSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
|
||||
[Dependency] private readonly SharedPointLightSystem _light = default!;
|
||||
[Dependency] private readonly SharedHandheldLightSystem _handheldLight = default!;
|
||||
|
||||
@@ -25,7 +24,6 @@ public sealed class ItemTogglePointLightSystem : EntitySystem
|
||||
if (!_light.TryGetLight(ent.Owner, out var light))
|
||||
return;
|
||||
|
||||
_appearance.SetData(ent, ToggleableLightVisuals.Enabled, args.Activated);
|
||||
_light.SetEnabled(ent.Owner, args.Activated, comp: light);
|
||||
if (TryComp<HandheldLightComponent>(ent.Owner, out var handheldLight))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user