]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix light animations (#20263)
authorLeon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Sun, 17 Sep 2023 17:57:49 +0000 (05:57 +1200)
committerGitHub <noreply@github.com>
Sun, 17 Sep 2023 17:57:49 +0000 (03:57 +1000)
13 files changed:
Content.Client/Explosion/TriggerSystem.Proximity.cs
Content.Client/Light/Components/LightBehaviourComponent.cs
Content.Client/Light/Visualizers/PoweredLightVisualizerSystem.cs
Content.Client/Weapons/Ranged/Systems/GunSystem.cs
Resources/Prototypes/Entities/Clothing/Head/base_clothinghead.yml
Resources/Prototypes/Entities/Clothing/Head/hardhats.yml
Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml
Resources/Prototypes/Entities/Objects/Misc/fluff_lights.yml
Resources/Prototypes/Entities/Objects/Misc/torch.yml
Resources/Prototypes/Entities/Objects/Tools/flare.yml
Resources/Prototypes/Entities/Objects/Tools/flashlights.yml
Resources/Prototypes/Entities/Objects/Tools/glowstick.yml
Resources/Prototypes/Entities/Objects/Tools/lantern.yml

index 41e4f914ffe23a4dfd9e754eddb516667cea4d6a..d88bb4d449375d95291c8db587f767fc1775c65b 100644 (file)
@@ -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),
index a89ddda1089faa188d41a5c005b68da922007aae..b594411c352dab73358ec4c5d4bcd464bb03a869 100644 (file)
@@ -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<Color> ColorsToCycle { get; set; } = new();
 
index 62af358c4031efe358ec15ca9f777a97bfd871a4..bf69053d9a213486ac03c0346cfdee907b60cceb 100644 (file)
@@ -89,7 +89,7 @@ public sealed class PoweredLightVisualizerSystem : VisualizerSystem<PoweredLight
                 {
                     ComponentType = typeof(PointLightComponent),
                     InterpolationMode = AnimationInterpolationMode.Nearest,
-                    Property = nameof(PointLightComponent.Enabled),
+                    Property = nameof(PointLightComponent.AnimatedEnable),
                     KeyFrames =
                     {
                         new AnimationTrackProperty.KeyFrame(false, 0),
index 743ca562d21d35815cdeffcd329ab2aa490b334f..84284c9a506f41004078923878d23230bba4e922 100644 (file)
@@ -334,7 +334,7 @@ public sealed partial class GunSystem : SharedGunSystem
                 new AnimationTrackComponentProperty
                 {
                     ComponentType = typeof(PointLightComponent),
-                    Property = nameof(PointLightComponent.Enabled),
+                    Property = nameof(PointLightComponent.AnimatedEnable),
                     InterpolationMode = AnimationInterpolationMode.Linear,
                     KeyFrames =
                     {
index c8e5a44e0c0b0c954837032a5fadb9eb282f90c5..e38d120638b134ca6922e7f448db0ee0dbd19f27 100644 (file)
@@ -90,8 +90,6 @@
         startValue: 3.0
         endValue: 2.0
         isLooped: true
-        property: Radius
-        enabled: false
         reverseWhenFinished: true
       - !type:PulseBehaviour
         id: blinking
         minValue: 0.1
         maxValue: 2.0
         isLooped: true
-        property: Radius
-        enabled: false
   - type: PowerCellSlot
     cellSlotId: cell_slot
   - type: ItemSlots
         startValue: 3.0
         endValue: 2.0
         isLooped: true
-        property: Radius
-        enabled: false
         reverseWhenFinished: true
       - !type:PulseBehaviour
         id: blinking
         minValue: 0.1
         maxValue: 2.0
         isLooped: true
-        property: Radius
-        enabled: false
   - type: Battery
     maxCharge: 600 #lights drain 3/s but recharge of 2 makes this 1/s. Therefore 600 is 10 minutes of light.
     startingCharge: 600
   - type: BatterySelfRecharger
     autoRecharge: true
     autoRechargeRate: 2 #recharge of 2 makes total drain 1w / s so max charge is 1:1 with time. Time to fully charge should be 5 minutes. Having recharge gives light an extended flicker period which gives you some warning to return to light area.
-    
+
 - type: entity
   abstract: true
   id: ClothingHeadHatHoodWinterBase
   noSpawn: true
   components:
   - type: Sprite
-    state: icon 
+    state: icon
   - type: Clickable
   - type: Clothing
     equipSound: /Audio/Effects/rustle1.ogg
index c959b4f90b3954df6b9527f3e83cf362781dfb6c..3e291f5dff2b85b6e7d5c88c66c400af3284fa7e 100644 (file)
@@ -32,8 +32,6 @@
         startValue: 3.0
         endValue: 2.0
         isLooped: true
-        property: Radius
-        enabled: false
         reverseWhenFinished: true
       - !type:PulseBehaviour
         id: blinking
@@ -42,8 +40,6 @@
         minValue: 0.1
         maxValue: 2.0
         isLooped: true
-        property: Radius
-        enabled: false
   - type: ToggleableLightVisuals
     spriteLayer: light
     inhandVisuals:
index 25e4271b1065295a76e916b906547a3755a36f11..8139994c503e87c063608098b06fd308e634c7fb 100644 (file)
     behaviours:
     - !type:FadeBehaviour
       id: radiating
-      interpolate: Linear
       maxDuration: 2.0
       startValue: 3.0
       endValue: 2.0
       isLooped: true
-      property: Radius
-      enabled: false
       reverseWhenFinished: true
     - !type:PulseBehaviour
       id: blinking
       minValue: 0.1
       maxValue: 2.0
       isLooped: true
-      property: Radius
-      enabled: false
   - type: ToggleableLightVisuals
   - type: PointLight
     enabled: false
index 7ab417cfc4e88cfbf9e9567b7a50f552d07b9f01..77b321f9513437ebd38754d0b15ece0d27bb3b14 100644 (file)
     behaviours:
       - !type:FadeBehaviour
         id: radiating
-        interpolate: Linear
         maxDuration: 2.0
         startValue: 3.0
         endValue: 2.0
         isLooped: true
-        property: Radius
-        enabled: false
         reverseWhenFinished: true
       - !type:PulseBehaviour
         id: blinking
@@ -27,8 +24,6 @@
         minValue: 0.1
         maxValue: 2.0
         isLooped: true
-        property: Radius
-        enabled: false
   - type: PowerCellSlot
     cellSlotId: cell_slot
   - type: ItemSlots
index c014d72ee00a606251ec381466d0d4e5dcc98484..0fa918de74a275b854b79644c79d4ddf1dadfdec 100644 (file)
           isLooped: true
         - !type:FadeBehaviour # have the radius start small and get larger as it starts to burn
           id: turn_on
-          interpolate: Linear
           maxDuration: 8.0
           startValue: 1.0
           endValue: 6.0
-          property: Radius
         - !type:RandomizeBehaviour # weaker flicker as it fades out
           id: fade_out
           interpolate: Nearest
@@ -73,8 +71,6 @@
           isLooped: true
         - !type:FadeBehaviour # fade out radius as it burns out
           id: fade_out
-          interpolate: Linear
           maxDuration: 4.0
           startValue: 6.0
           endValue: 1.0
-          property: Radius
index 169cc911db2466b9cc2d65d13aeca034d1c076d3..16ae88a0680cfb0b565cfe1167a1aa50310f9e12 100644 (file)
     behaviours:
       - !type:FadeBehaviour # have the radius start small and get larger as it starts to burn
         id: turn_on
-        interpolate: Linear
         maxDuration: 45.0
         startValue: 2.5
         endValue: 10.0
-        property: Radius
       - !type:RandomizeBehaviour # weaker flicker as it fades out
         id: fade_out
         interpolate: Nearest
@@ -69,8 +67,6 @@
         isLooped: true
       - !type:FadeBehaviour # fade out radius as it burns out
         id: fade_out
-        interpolate: Linear
         maxDuration: 15.0
         startValue: 10.0
         endValue: 1.0
-        property: Radius
index f58cae975fd51a1077c1fe272f06696ed38e4736..c43ffc830ccdef2049e6c64a7f57bfd60b775829 100644 (file)
     behaviours:
       - !type:FadeBehaviour
         id: radiating
-        interpolate: Linear
         maxDuration: 2.0
         startValue: 3.0
         endValue: 2.0
         isLooped: true
-        property: Radius
-        enabled: false
         reverseWhenFinished: true
       - !type:PulseBehaviour
         id: blinking
@@ -31,8 +28,6 @@
         minValue: 0.1
         maxValue: 2.0
         isLooped: true
-        property: Radius
-        enabled: false
   - type: ToggleableLightVisuals
     spriteLayer: light
     inhandVisuals:
index 602795a8f2e38b03d397f31365ab03894a43f96b..5aea0d8a2911659c29ffa9193074b110c4735fcd 100644 (file)
@@ -60,7 +60,6 @@
           maxDuration: 10 # 300.0
           startValue: 5.0
           endValue: 1.5
-          property: Radius
 
 - type: entity
   name: red glowstick
           minDuration: 0.2
           maxDuration: 1.0
           maxValue: 0.2
-          property: Enabled
+          property: AnimatedEnable
           isLooped: true
           enabled: true
         - !type:ColorCycleBehaviour
           minValue: 2.0
           maxValue: 10.0
           isLooped: true
-          property: Radius
           enabled: true
 
 - type: entity
           minValue: 10.0
           maxValue: 25.0
           isLooped: true
-          property: Radius
           enabled: true
index e7e3a1ad029e10b106767c1542856015f8139556..4d861ffd542b82a23838fd79926e6e3d2162633d 100644 (file)
       behaviours:
         - !type:FadeBehaviour
           id: radiating
-          interpolate: Linear
           maxDuration: 2.0
           startValue: 3.0
           endValue: 2.0
           isLooped: true
-          property: Radius
-          enabled: false
           reverseWhenFinished: true
         - !type:PulseBehaviour
           id: blinking
@@ -27,8 +24,6 @@
           minValue: 0.1
           maxValue: 2.0
           isLooped: true
-          property: Radius
-          enabled: false
     - type: Sprite
       sprite: Objects/Tools/lantern.rsi
       layers: