Fix light animations (#20263)
This commit is contained in:
@@ -30,7 +30,7 @@ public sealed partial class TriggerSystem
|
|||||||
{
|
{
|
||||||
ComponentType = typeof(PointLightComponent),
|
ComponentType = typeof(PointLightComponent),
|
||||||
InterpolationMode = AnimationInterpolationMode.Nearest,
|
InterpolationMode = AnimationInterpolationMode.Nearest,
|
||||||
Property = nameof(PointLightComponent.Radius),
|
Property = nameof(PointLightComponent.AnimatedRadius),
|
||||||
KeyFrames =
|
KeyFrames =
|
||||||
{
|
{
|
||||||
new AnimationTrackProperty.KeyFrame(0.1f, 0),
|
new AnimationTrackProperty.KeyFrame(0.1f, 0),
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Content.Client.Light.Components
|
|||||||
[DataField("id")] public string ID { get; set; } = string.Empty;
|
[DataField("id")] public string ID { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DataField("property")]
|
[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; }
|
[DataField("isLooped")] public bool IsLooped { get; set; }
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ namespace Content.Client.Light.Components
|
|||||||
var playingTime = prevPlayingTime + frameTime;
|
var playingTime = prevPlayingTime + frameTime;
|
||||||
var interpolateValue = playingTime / MaxTime;
|
var interpolateValue = playingTime / MaxTime;
|
||||||
|
|
||||||
if (Property == "Enabled") // special case for boolean
|
if (Property == nameof(PointLightComponent.AnimatedEnable)) // special case for boolean
|
||||||
{
|
{
|
||||||
ApplyProperty(interpolateValue < 0.5f);
|
ApplyProperty(interpolateValue < 0.5f);
|
||||||
return (-1, playingTime);
|
return (-1, playingTime);
|
||||||
@@ -181,7 +181,7 @@ namespace Content.Client.Light.Components
|
|||||||
var playingTime = prevPlayingTime + frameTime;
|
var playingTime = prevPlayingTime + frameTime;
|
||||||
var interpolateValue = playingTime / MaxTime;
|
var interpolateValue = playingTime / MaxTime;
|
||||||
|
|
||||||
if (Property == "Enabled") // special case for boolean
|
if (Property == nameof(PointLightComponent.AnimatedEnable)) // special case for boolean
|
||||||
{
|
{
|
||||||
ApplyProperty(interpolateValue < EndValue);
|
ApplyProperty(interpolateValue < EndValue);
|
||||||
return (-1, playingTime);
|
return (-1, playingTime);
|
||||||
@@ -245,7 +245,7 @@ namespace Content.Client.Light.Components
|
|||||||
|
|
||||||
public override void OnStart()
|
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);
|
ApplyProperty(_random.NextDouble() < 0.5);
|
||||||
return;
|
return;
|
||||||
@@ -267,7 +267,7 @@ namespace Content.Client.Light.Components
|
|||||||
var playingTime = prevPlayingTime + frameTime;
|
var playingTime = prevPlayingTime + frameTime;
|
||||||
var interpolateValue = playingTime / MaxTime;
|
var interpolateValue = playingTime / MaxTime;
|
||||||
|
|
||||||
if (Property == "Enabled")
|
if (Property == nameof(PointLightComponent.AnimatedEnable))
|
||||||
{
|
{
|
||||||
return (-1, playingTime);
|
return (-1, playingTime);
|
||||||
}
|
}
|
||||||
@@ -298,7 +298,7 @@ namespace Content.Client.Light.Components
|
|||||||
public sealed partial class ColorCycleBehaviour : LightBehaviourAnimationTrack, ISerializationHooks
|
public sealed partial class ColorCycleBehaviour : LightBehaviourAnimationTrack, ISerializationHooks
|
||||||
{
|
{
|
||||||
[DataField("property")]
|
[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();
|
[DataField("colors")] public List<Color> ColorsToCycle { get; set; } = new();
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ public sealed class PoweredLightVisualizerSystem : VisualizerSystem<PoweredLight
|
|||||||
{
|
{
|
||||||
ComponentType = typeof(PointLightComponent),
|
ComponentType = typeof(PointLightComponent),
|
||||||
InterpolationMode = AnimationInterpolationMode.Nearest,
|
InterpolationMode = AnimationInterpolationMode.Nearest,
|
||||||
Property = nameof(PointLightComponent.Enabled),
|
Property = nameof(PointLightComponent.AnimatedEnable),
|
||||||
KeyFrames =
|
KeyFrames =
|
||||||
{
|
{
|
||||||
new AnimationTrackProperty.KeyFrame(false, 0),
|
new AnimationTrackProperty.KeyFrame(false, 0),
|
||||||
|
|||||||
@@ -334,7 +334,7 @@ public sealed partial class GunSystem : SharedGunSystem
|
|||||||
new AnimationTrackComponentProperty
|
new AnimationTrackComponentProperty
|
||||||
{
|
{
|
||||||
ComponentType = typeof(PointLightComponent),
|
ComponentType = typeof(PointLightComponent),
|
||||||
Property = nameof(PointLightComponent.Enabled),
|
Property = nameof(PointLightComponent.AnimatedEnable),
|
||||||
InterpolationMode = AnimationInterpolationMode.Linear,
|
InterpolationMode = AnimationInterpolationMode.Linear,
|
||||||
KeyFrames =
|
KeyFrames =
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -90,8 +90,6 @@
|
|||||||
startValue: 3.0
|
startValue: 3.0
|
||||||
endValue: 2.0
|
endValue: 2.0
|
||||||
isLooped: true
|
isLooped: true
|
||||||
property: Radius
|
|
||||||
enabled: false
|
|
||||||
reverseWhenFinished: true
|
reverseWhenFinished: true
|
||||||
- !type:PulseBehaviour
|
- !type:PulseBehaviour
|
||||||
id: blinking
|
id: blinking
|
||||||
@@ -100,8 +98,6 @@
|
|||||||
minValue: 0.1
|
minValue: 0.1
|
||||||
maxValue: 2.0
|
maxValue: 2.0
|
||||||
isLooped: true
|
isLooped: true
|
||||||
property: Radius
|
|
||||||
enabled: false
|
|
||||||
- type: PowerCellSlot
|
- type: PowerCellSlot
|
||||||
cellSlotId: cell_slot
|
cellSlotId: cell_slot
|
||||||
- type: ItemSlots
|
- type: ItemSlots
|
||||||
@@ -209,8 +205,6 @@
|
|||||||
startValue: 3.0
|
startValue: 3.0
|
||||||
endValue: 2.0
|
endValue: 2.0
|
||||||
isLooped: true
|
isLooped: true
|
||||||
property: Radius
|
|
||||||
enabled: false
|
|
||||||
reverseWhenFinished: true
|
reverseWhenFinished: true
|
||||||
- !type:PulseBehaviour
|
- !type:PulseBehaviour
|
||||||
id: blinking
|
id: blinking
|
||||||
@@ -219,15 +213,13 @@
|
|||||||
minValue: 0.1
|
minValue: 0.1
|
||||||
maxValue: 2.0
|
maxValue: 2.0
|
||||||
isLooped: true
|
isLooped: true
|
||||||
property: Radius
|
|
||||||
enabled: false
|
|
||||||
- type: Battery
|
- type: Battery
|
||||||
maxCharge: 600 #lights drain 3/s but recharge of 2 makes this 1/s. Therefore 600 is 10 minutes of light.
|
maxCharge: 600 #lights drain 3/s but recharge of 2 makes this 1/s. Therefore 600 is 10 minutes of light.
|
||||||
startingCharge: 600
|
startingCharge: 600
|
||||||
- type: BatterySelfRecharger
|
- type: BatterySelfRecharger
|
||||||
autoRecharge: true
|
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.
|
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
|
- type: entity
|
||||||
abstract: true
|
abstract: true
|
||||||
id: ClothingHeadHatHoodWinterBase
|
id: ClothingHeadHatHoodWinterBase
|
||||||
@@ -236,7 +228,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
state: icon
|
state: icon
|
||||||
- type: Clickable
|
- type: Clickable
|
||||||
- type: Clothing
|
- type: Clothing
|
||||||
equipSound: /Audio/Effects/rustle1.ogg
|
equipSound: /Audio/Effects/rustle1.ogg
|
||||||
|
|||||||
@@ -32,8 +32,6 @@
|
|||||||
startValue: 3.0
|
startValue: 3.0
|
||||||
endValue: 2.0
|
endValue: 2.0
|
||||||
isLooped: true
|
isLooped: true
|
||||||
property: Radius
|
|
||||||
enabled: false
|
|
||||||
reverseWhenFinished: true
|
reverseWhenFinished: true
|
||||||
- !type:PulseBehaviour
|
- !type:PulseBehaviour
|
||||||
id: blinking
|
id: blinking
|
||||||
@@ -42,8 +40,6 @@
|
|||||||
minValue: 0.1
|
minValue: 0.1
|
||||||
maxValue: 2.0
|
maxValue: 2.0
|
||||||
isLooped: true
|
isLooped: true
|
||||||
property: Radius
|
|
||||||
enabled: false
|
|
||||||
- type: ToggleableLightVisuals
|
- type: ToggleableLightVisuals
|
||||||
spriteLayer: light
|
spriteLayer: light
|
||||||
inhandVisuals:
|
inhandVisuals:
|
||||||
|
|||||||
@@ -166,13 +166,10 @@
|
|||||||
behaviours:
|
behaviours:
|
||||||
- !type:FadeBehaviour
|
- !type:FadeBehaviour
|
||||||
id: radiating
|
id: radiating
|
||||||
interpolate: Linear
|
|
||||||
maxDuration: 2.0
|
maxDuration: 2.0
|
||||||
startValue: 3.0
|
startValue: 3.0
|
||||||
endValue: 2.0
|
endValue: 2.0
|
||||||
isLooped: true
|
isLooped: true
|
||||||
property: Radius
|
|
||||||
enabled: false
|
|
||||||
reverseWhenFinished: true
|
reverseWhenFinished: true
|
||||||
- !type:PulseBehaviour
|
- !type:PulseBehaviour
|
||||||
id: blinking
|
id: blinking
|
||||||
@@ -181,8 +178,6 @@
|
|||||||
minValue: 0.1
|
minValue: 0.1
|
||||||
maxValue: 2.0
|
maxValue: 2.0
|
||||||
isLooped: true
|
isLooped: true
|
||||||
property: Radius
|
|
||||||
enabled: false
|
|
||||||
- type: ToggleableLightVisuals
|
- type: ToggleableLightVisuals
|
||||||
- type: PointLight
|
- type: PointLight
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|||||||
@@ -12,13 +12,10 @@
|
|||||||
behaviours:
|
behaviours:
|
||||||
- !type:FadeBehaviour
|
- !type:FadeBehaviour
|
||||||
id: radiating
|
id: radiating
|
||||||
interpolate: Linear
|
|
||||||
maxDuration: 2.0
|
maxDuration: 2.0
|
||||||
startValue: 3.0
|
startValue: 3.0
|
||||||
endValue: 2.0
|
endValue: 2.0
|
||||||
isLooped: true
|
isLooped: true
|
||||||
property: Radius
|
|
||||||
enabled: false
|
|
||||||
reverseWhenFinished: true
|
reverseWhenFinished: true
|
||||||
- !type:PulseBehaviour
|
- !type:PulseBehaviour
|
||||||
id: blinking
|
id: blinking
|
||||||
@@ -27,8 +24,6 @@
|
|||||||
minValue: 0.1
|
minValue: 0.1
|
||||||
maxValue: 2.0
|
maxValue: 2.0
|
||||||
isLooped: true
|
isLooped: true
|
||||||
property: Radius
|
|
||||||
enabled: false
|
|
||||||
- type: PowerCellSlot
|
- type: PowerCellSlot
|
||||||
cellSlotId: cell_slot
|
cellSlotId: cell_slot
|
||||||
- type: ItemSlots
|
- type: ItemSlots
|
||||||
|
|||||||
@@ -57,11 +57,9 @@
|
|||||||
isLooped: true
|
isLooped: true
|
||||||
- !type:FadeBehaviour # have the radius start small and get larger as it starts to burn
|
- !type:FadeBehaviour # have the radius start small and get larger as it starts to burn
|
||||||
id: turn_on
|
id: turn_on
|
||||||
interpolate: Linear
|
|
||||||
maxDuration: 8.0
|
maxDuration: 8.0
|
||||||
startValue: 1.0
|
startValue: 1.0
|
||||||
endValue: 6.0
|
endValue: 6.0
|
||||||
property: Radius
|
|
||||||
- !type:RandomizeBehaviour # weaker flicker as it fades out
|
- !type:RandomizeBehaviour # weaker flicker as it fades out
|
||||||
id: fade_out
|
id: fade_out
|
||||||
interpolate: Nearest
|
interpolate: Nearest
|
||||||
@@ -73,8 +71,6 @@
|
|||||||
isLooped: true
|
isLooped: true
|
||||||
- !type:FadeBehaviour # fade out radius as it burns out
|
- !type:FadeBehaviour # fade out radius as it burns out
|
||||||
id: fade_out
|
id: fade_out
|
||||||
interpolate: Linear
|
|
||||||
maxDuration: 4.0
|
maxDuration: 4.0
|
||||||
startValue: 6.0
|
startValue: 6.0
|
||||||
endValue: 1.0
|
endValue: 1.0
|
||||||
property: Radius
|
|
||||||
|
|||||||
@@ -53,11 +53,9 @@
|
|||||||
behaviours:
|
behaviours:
|
||||||
- !type:FadeBehaviour # have the radius start small and get larger as it starts to burn
|
- !type:FadeBehaviour # have the radius start small and get larger as it starts to burn
|
||||||
id: turn_on
|
id: turn_on
|
||||||
interpolate: Linear
|
|
||||||
maxDuration: 45.0
|
maxDuration: 45.0
|
||||||
startValue: 2.5
|
startValue: 2.5
|
||||||
endValue: 10.0
|
endValue: 10.0
|
||||||
property: Radius
|
|
||||||
- !type:RandomizeBehaviour # weaker flicker as it fades out
|
- !type:RandomizeBehaviour # weaker flicker as it fades out
|
||||||
id: fade_out
|
id: fade_out
|
||||||
interpolate: Nearest
|
interpolate: Nearest
|
||||||
@@ -69,8 +67,6 @@
|
|||||||
isLooped: true
|
isLooped: true
|
||||||
- !type:FadeBehaviour # fade out radius as it burns out
|
- !type:FadeBehaviour # fade out radius as it burns out
|
||||||
id: fade_out
|
id: fade_out
|
||||||
interpolate: Linear
|
|
||||||
maxDuration: 15.0
|
maxDuration: 15.0
|
||||||
startValue: 10.0
|
startValue: 10.0
|
||||||
endValue: 1.0
|
endValue: 1.0
|
||||||
property: Radius
|
|
||||||
|
|||||||
@@ -16,13 +16,10 @@
|
|||||||
behaviours:
|
behaviours:
|
||||||
- !type:FadeBehaviour
|
- !type:FadeBehaviour
|
||||||
id: radiating
|
id: radiating
|
||||||
interpolate: Linear
|
|
||||||
maxDuration: 2.0
|
maxDuration: 2.0
|
||||||
startValue: 3.0
|
startValue: 3.0
|
||||||
endValue: 2.0
|
endValue: 2.0
|
||||||
isLooped: true
|
isLooped: true
|
||||||
property: Radius
|
|
||||||
enabled: false
|
|
||||||
reverseWhenFinished: true
|
reverseWhenFinished: true
|
||||||
- !type:PulseBehaviour
|
- !type:PulseBehaviour
|
||||||
id: blinking
|
id: blinking
|
||||||
@@ -31,8 +28,6 @@
|
|||||||
minValue: 0.1
|
minValue: 0.1
|
||||||
maxValue: 2.0
|
maxValue: 2.0
|
||||||
isLooped: true
|
isLooped: true
|
||||||
property: Radius
|
|
||||||
enabled: false
|
|
||||||
- type: ToggleableLightVisuals
|
- type: ToggleableLightVisuals
|
||||||
spriteLayer: light
|
spriteLayer: light
|
||||||
inhandVisuals:
|
inhandVisuals:
|
||||||
|
|||||||
@@ -60,7 +60,6 @@
|
|||||||
maxDuration: 10 # 300.0
|
maxDuration: 10 # 300.0
|
||||||
startValue: 5.0
|
startValue: 5.0
|
||||||
endValue: 1.5
|
endValue: 1.5
|
||||||
property: Radius
|
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
name: red glowstick
|
name: red glowstick
|
||||||
@@ -199,7 +198,7 @@
|
|||||||
minDuration: 0.2
|
minDuration: 0.2
|
||||||
maxDuration: 1.0
|
maxDuration: 1.0
|
||||||
maxValue: 0.2
|
maxValue: 0.2
|
||||||
property: Enabled
|
property: AnimatedEnable
|
||||||
isLooped: true
|
isLooped: true
|
||||||
enabled: true
|
enabled: true
|
||||||
- !type:ColorCycleBehaviour
|
- !type:ColorCycleBehaviour
|
||||||
@@ -272,7 +271,6 @@
|
|||||||
minValue: 2.0
|
minValue: 2.0
|
||||||
maxValue: 10.0
|
maxValue: 10.0
|
||||||
isLooped: true
|
isLooped: true
|
||||||
property: Radius
|
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
@@ -304,5 +302,4 @@
|
|||||||
minValue: 10.0
|
minValue: 10.0
|
||||||
maxValue: 25.0
|
maxValue: 25.0
|
||||||
isLooped: true
|
isLooped: true
|
||||||
property: Radius
|
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|||||||
@@ -12,13 +12,10 @@
|
|||||||
behaviours:
|
behaviours:
|
||||||
- !type:FadeBehaviour
|
- !type:FadeBehaviour
|
||||||
id: radiating
|
id: radiating
|
||||||
interpolate: Linear
|
|
||||||
maxDuration: 2.0
|
maxDuration: 2.0
|
||||||
startValue: 3.0
|
startValue: 3.0
|
||||||
endValue: 2.0
|
endValue: 2.0
|
||||||
isLooped: true
|
isLooped: true
|
||||||
property: Radius
|
|
||||||
enabled: false
|
|
||||||
reverseWhenFinished: true
|
reverseWhenFinished: true
|
||||||
- !type:PulseBehaviour
|
- !type:PulseBehaviour
|
||||||
id: blinking
|
id: blinking
|
||||||
@@ -27,8 +24,6 @@
|
|||||||
minValue: 0.1
|
minValue: 0.1
|
||||||
maxValue: 2.0
|
maxValue: 2.0
|
||||||
isLooped: true
|
isLooped: true
|
||||||
property: Radius
|
|
||||||
enabled: false
|
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Objects/Tools/lantern.rsi
|
sprite: Objects/Tools/lantern.rsi
|
||||||
layers:
|
layers:
|
||||||
|
|||||||
Reference in New Issue
Block a user