From 53b4da68fad8a62e118fbe10825049406e19a376 Mon Sep 17 00:00:00 2001 From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Date: Mon, 18 Sep 2023 05:57:49 +1200 Subject: [PATCH] Fix light animations (#20263) --- Content.Client/Explosion/TriggerSystem.Proximity.cs | 2 +- .../Light/Components/LightBehaviourComponent.cs | 12 ++++++------ .../Visualizers/PoweredLightVisualizerSystem.cs | 2 +- Content.Client/Weapons/Ranged/Systems/GunSystem.cs | 2 +- .../Entities/Clothing/Head/base_clothinghead.yml | 12 ++---------- .../Prototypes/Entities/Clothing/Head/hardhats.yml | 4 ---- .../Entities/Mobs/Cyborgs/base_borg_chassis.yml | 5 ----- .../Entities/Objects/Misc/fluff_lights.yml | 5 ----- Resources/Prototypes/Entities/Objects/Misc/torch.yml | 4 ---- .../Prototypes/Entities/Objects/Tools/flare.yml | 4 ---- .../Entities/Objects/Tools/flashlights.yml | 5 ----- .../Prototypes/Entities/Objects/Tools/glowstick.yml | 5 +---- .../Prototypes/Entities/Objects/Tools/lantern.yml | 5 ----- 13 files changed, 12 insertions(+), 55 deletions(-) diff --git a/Content.Client/Explosion/TriggerSystem.Proximity.cs b/Content.Client/Explosion/TriggerSystem.Proximity.cs index 41e4f914ff..d88bb4d449 100644 --- a/Content.Client/Explosion/TriggerSystem.Proximity.cs +++ b/Content.Client/Explosion/TriggerSystem.Proximity.cs @@ -30,7 +30,7 @@ public sealed partial class TriggerSystem { ComponentType = typeof(PointLightComponent), InterpolationMode = AnimationInterpolationMode.Nearest, - Property = nameof(PointLightComponent.Radius), + Property = nameof(PointLightComponent.AnimatedRadius), KeyFrames = { new AnimationTrackProperty.KeyFrame(0.1f, 0), diff --git a/Content.Client/Light/Components/LightBehaviourComponent.cs b/Content.Client/Light/Components/LightBehaviourComponent.cs index a89ddda108..b594411c35 100644 --- a/Content.Client/Light/Components/LightBehaviourComponent.cs +++ b/Content.Client/Light/Components/LightBehaviourComponent.cs @@ -24,7 +24,7 @@ namespace Content.Client.Light.Components [DataField("id")] public string ID { get; set; } = string.Empty; [DataField("property")] - public virtual string Property { get; protected set; } = "Radius"; + public virtual string Property { get; protected set; } = nameof(PointLightComponent.AnimatedRadius); [DataField("isLooped")] public bool IsLooped { get; set; } @@ -119,7 +119,7 @@ namespace Content.Client.Light.Components var playingTime = prevPlayingTime + frameTime; var interpolateValue = playingTime / MaxTime; - if (Property == "Enabled") // special case for boolean + if (Property == nameof(PointLightComponent.AnimatedEnable)) // special case for boolean { ApplyProperty(interpolateValue < 0.5f); return (-1, playingTime); @@ -181,7 +181,7 @@ namespace Content.Client.Light.Components var playingTime = prevPlayingTime + frameTime; var interpolateValue = playingTime / MaxTime; - if (Property == "Enabled") // special case for boolean + if (Property == nameof(PointLightComponent.AnimatedEnable)) // special case for boolean { ApplyProperty(interpolateValue < EndValue); return (-1, playingTime); @@ -245,7 +245,7 @@ namespace Content.Client.Light.Components public override void OnStart() { - if (Property == "Enabled") // special case for boolean, we randomize it + if (Property == nameof(PointLightComponent.AnimatedEnable)) // special case for boolean, we randomize it { ApplyProperty(_random.NextDouble() < 0.5); return; @@ -267,7 +267,7 @@ namespace Content.Client.Light.Components var playingTime = prevPlayingTime + frameTime; var interpolateValue = playingTime / MaxTime; - if (Property == "Enabled") + if (Property == nameof(PointLightComponent.AnimatedEnable)) { return (-1, playingTime); } @@ -298,7 +298,7 @@ namespace Content.Client.Light.Components public sealed partial class ColorCycleBehaviour : LightBehaviourAnimationTrack, ISerializationHooks { [DataField("property")] - public override string Property { get; protected set; } = "Color"; + public override string Property { get; protected set; } = nameof(PointLightComponent.Color); [DataField("colors")] public List ColorsToCycle { get; set; } = new(); diff --git a/Content.Client/Light/Visualizers/PoweredLightVisualizerSystem.cs b/Content.Client/Light/Visualizers/PoweredLightVisualizerSystem.cs index 62af358c40..bf69053d9a 100644 --- a/Content.Client/Light/Visualizers/PoweredLightVisualizerSystem.cs +++ b/Content.Client/Light/Visualizers/PoweredLightVisualizerSystem.cs @@ -89,7 +89,7 @@ public sealed class PoweredLightVisualizerSystem : VisualizerSystem