Skip to content

Commit ca47e59

Browse files
authored
Update DoorComponent to use TimeSpans and fix comments (space-wizards#40420)
Cleanup
1 parent 0dd1733 commit ca47e59

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

Content.Client/Doors/DoorSystem.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ protected override void OnComponentInit(Entity<DoorComponent> ent, ref Component
3131

3232
comp.OpeningAnimation = new Animation
3333
{
34-
Length = TimeSpan.FromSeconds(comp.OpeningAnimationTime),
34+
Length = comp.OpeningAnimationTime,
3535
AnimationTracks =
3636
{
3737
new AnimationTrackSpriteFlick
@@ -47,7 +47,7 @@ protected override void OnComponentInit(Entity<DoorComponent> ent, ref Component
4747

4848
comp.ClosingAnimation = new Animation
4949
{
50-
Length = TimeSpan.FromSeconds(comp.ClosingAnimationTime),
50+
Length = comp.ClosingAnimationTime,
5151
AnimationTracks =
5252
{
5353
new AnimationTrackSpriteFlick
@@ -63,7 +63,7 @@ protected override void OnComponentInit(Entity<DoorComponent> ent, ref Component
6363

6464
comp.EmaggingAnimation = new Animation
6565
{
66-
Length = TimeSpan.FromSeconds(comp.EmaggingAnimationTime),
66+
Length = comp.EmaggingAnimationTime,
6767
AnimationTracks =
6868
{
6969
new AnimationTrackSpriteFlick
@@ -116,14 +116,14 @@ private void UpdateAppearanceForDoorState(Entity<DoorComponent> entity, SpriteCo
116116

117117
return;
118118
case DoorState.Opening:
119-
if (entity.Comp.OpeningAnimationTime == 0.0)
119+
if (entity.Comp.OpeningAnimationTime == TimeSpan.Zero)
120120
return;
121121

122122
_animationSystem.Play(entity, (Animation)entity.Comp.OpeningAnimation, DoorComponent.AnimationKey);
123123

124124
return;
125125
case DoorState.Closing:
126-
if (entity.Comp.ClosingAnimationTime == 0.0 || entity.Comp.CurrentlyCrushing.Count != 0)
126+
if (entity.Comp.ClosingAnimationTime == TimeSpan.Zero || entity.Comp.CurrentlyCrushing.Count != 0)
127127
return;
128128

129129
_animationSystem.Play(entity, (Animation)entity.Comp.ClosingAnimation, DoorComponent.AnimationKey);

Content.Shared/Doors/Components/DoorComponent.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,22 +187,22 @@ public sealed partial class DoorComponent : Component
187187
public string EmaggingSpriteState = "sparks";
188188

189189
/// <summary>
190-
/// The sprite state used for the door when it's open.
190+
/// The length of the door's opening animation.
191191
/// </summary>
192192
[DataField]
193-
public float OpeningAnimationTime = 0.8f;
193+
public TimeSpan OpeningAnimationTime = TimeSpan.FromSeconds(0.8);
194194

195195
/// <summary>
196-
/// The sprite state used for the door when it's open.
196+
/// The length of the door's closing animation.
197197
/// </summary>
198198
[DataField]
199-
public float ClosingAnimationTime = 0.8f;
199+
public TimeSpan ClosingAnimationTime = TimeSpan.FromSeconds(0.8);
200200

201201
/// <summary>
202-
/// The sprite state used for the door when it's open.
202+
/// The length of the door's emagging animation.
203203
/// </summary>
204204
[DataField]
205-
public float EmaggingAnimationTime = 1.5f;
205+
public TimeSpan EmaggingAnimationTime = TimeSpan.FromSeconds(1.5);
206206

207207
/// <summary>
208208
/// The animation used when the door opens.

0 commit comments

Comments
 (0)