Skip to content

Commit d4454ea

Browse files
authored
Merge branch 'DeltaV-Station:master' into Pebble-Faxes
2 parents f99494d + d8f38bc commit d4454ea

917 files changed

Lines changed: 6565 additions & 3652 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Content.Client/Doors/DoorSystem.cs

Lines changed: 68 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,36 @@ public override void Initialize()
1818
{
1919
base.Initialize();
2020
SubscribeLocalEvent<DoorComponent, AppearanceChangeEvent>(OnAppearanceChange);
21+
// ES START
22+
// handle open/close state change on client after animation end, not when server says door is open
23+
SubscribeLocalEvent<DoorComponent, AnimationCompletedEvent>(OnAnimationCompleted);
2124
}
2225

26+
private void OnAnimationCompleted(Entity<DoorComponent> entity, ref AnimationCompletedEvent args)
27+
{
28+
if (!TryComp<SpriteComponent>(entity, out var sprite) || args.Key != DoorComponent.OpenCloseKey)
29+
return;
30+
31+
switch (entity.Comp.State)
32+
{
33+
case DoorState.Open:
34+
foreach (var (layer, layerState) in entity.Comp.OpenSpriteStates)
35+
{
36+
_sprite.LayerSetRsiState((entity.Owner, sprite), layer, layerState);
37+
}
38+
39+
break;
40+
case DoorState.Closed:
41+
foreach (var (layer, layerState) in entity.Comp.ClosedSpriteStates)
42+
{
43+
_sprite.LayerSetRsiState((entity.Owner, sprite), layer, layerState);
44+
}
45+
46+
break;
47+
}
48+
}
49+
// ES END
50+
2351
protected override void OnComponentInit(Entity<DoorComponent> ent, ref ComponentInit args)
2452
{
2553
var comp = ent.Comp;
@@ -87,10 +115,13 @@ private void OnAppearanceChange(Entity<DoorComponent> entity, ref AppearanceChan
87115
state = DoorState.Closed;
88116

89117
if (AppearanceSystem.TryGetData<string>(entity, PaintableVisuals.Prototype, out var prototype, args.Component))
90-
UpdateSpriteLayers((entity.Owner, args.Sprite), prototype);
118+
UpdateSpriteLayers((entity.Owner, args.Sprite), prototype);
91119

92-
if (_animationSystem.HasRunningAnimation(entity, DoorComponent.AnimationKey))
93-
_animationSystem.Stop(entity.Owner, DoorComponent.AnimationKey);
120+
// ES START
121+
// dont stop all animations for no reason
122+
//if (_animationSystem.HasRunningAnimation(entity, DoorComponent.AnimationKey))
123+
// _animationSystem.Stop(entity.Owner, DoorComponent.AnimationKey);
124+
// ES END
94125

95126
// We are checking beforehand since some doors may not have an emagging visual layer, and we don't want LayerSetVisible to throw an error.
96127
if (_sprite.TryGetLayer(entity.Owner, DoorVisualLayers.BaseEmagging, out var _, false))
@@ -106,13 +137,25 @@ private void UpdateAppearanceForDoorState(Entity<DoorComponent> entity, SpriteCo
106137
switch (state)
107138
{
108139
case DoorState.Open:
140+
// ES START
141+
// If we are already animating the close just let that do its job
142+
if (_animationSystem.HasRunningAnimation(entity, DoorComponent.OpenCloseKey))
143+
return;
144+
// ES END
145+
109146
foreach (var (layer, layerState) in entity.Comp.OpenSpriteStates)
110147
{
111148
_sprite.LayerSetRsiState((entity.Owner, sprite), layer, layerState);
112149
}
113150

114151
return;
115152
case DoorState.Closed:
153+
// ES START
154+
// If we are already animating the close just let that do its job
155+
if (_animationSystem.HasRunningAnimation(entity, DoorComponent.OpenCloseKey))
156+
return;
157+
// ES END
158+
116159
foreach (var (layer, layerState) in entity.Comp.ClosedSpriteStates)
117160
{
118161
_sprite.LayerSetRsiState((entity.Owner, sprite), layer, layerState);
@@ -123,24 +166,41 @@ private void UpdateAppearanceForDoorState(Entity<DoorComponent> entity, SpriteCo
123166
if (entity.Comp.OpeningAnimationTime == TimeSpan.Zero)
124167
return;
125168

126-
_animationSystem.Play(entity, (Animation)entity.Comp.OpeningAnimation, DoorComponent.AnimationKey);
169+
// ES START
170+
// since we dont stop them earlier we check here
171+
if (_animationSystem.HasRunningAnimation(entity, DoorComponent.OpenCloseKey))
172+
return;
173+
// ES END
174+
175+
_animationSystem.Play(entity, (Animation)entity.Comp.OpeningAnimation, DoorComponent.OpenCloseKey);
127176

128177
return;
129178
case DoorState.Closing:
130179
if (entity.Comp.ClosingAnimationTime == TimeSpan.Zero || entity.Comp.CurrentlyCrushing.Count != 0)
131180
return;
132181

133-
_animationSystem.Play(entity, (Animation)entity.Comp.ClosingAnimation, DoorComponent.AnimationKey);
182+
// ES START
183+
// since we dont stop them earlier we check here
184+
if (_animationSystem.HasRunningAnimation(entity, DoorComponent.OpenCloseKey))
185+
return;
186+
// ES END
187+
188+
_animationSystem.Play(entity, (Animation)entity.Comp.ClosingAnimation, DoorComponent.OpenCloseKey);
134189

135190
return;
136191
case DoorState.Denying:
137-
_animationSystem.Play(entity, (Animation)entity.Comp.DenyingAnimation, DoorComponent.AnimationKey);
192+
// ES START
193+
// AnimationKey -> DenyKey
194+
_animationSystem.Play(entity, (Animation)entity.Comp.DenyingAnimation, DoorComponent.DenyKey);
195+
// ES END
138196

139197
return;
140198
case DoorState.Emagging:
141-
// We are checking beforehand since some doors may not have an emagging visual layer.
199+
// ES START
200+
// AnimationKey -> DenyKey
142201
if (_sprite.TryGetLayer(entity.Owner, DoorVisualLayers.BaseEmagging, out var _, false))
143-
_animationSystem.Play(entity, (Animation)entity.Comp.EmaggingAnimation, DoorComponent.AnimationKey);
202+
_animationSystem.Play(entity, (Animation)entity.Comp.EmaggingAnimation, DoorComponent.EmagKey);
203+
// ES END
144204

145205
return;
146206
}

Content.Client/Stunnable/StunSystem.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
using System.Numerics;
2+
using Content.Shared._DV.CCVars; // DeltaV - Enable Stars via CVar.
23
using Content.Shared.CombatMode;
34
using Content.Shared.Interaction;
45
using Content.Shared.Stunnable;
56
using Robust.Client.Animations;
67
using Robust.Client.GameObjects;
78
using Robust.Shared.Animations;
9+
using Robust.Shared.Configuration; // DeltaV - Enable Stars via CVar.
810
using Robust.Shared.Input;
911
using Robust.Shared.Input.Binding;
1012
using Robust.Shared.Random;
@@ -13,6 +15,7 @@ namespace Content.Client.Stunnable;
1315

1416
public sealed class StunSystem : SharedStunSystem
1517
{
18+
[Dependency] private readonly IConfigurationManager _cfg = default!; // DeltaV - Enable Stars via CVar.
1619
[Dependency] private readonly SharedCombatModeSystem _combat = default!;
1720
[Dependency] private readonly IRobustRandom _random = default!;
1821
[Dependency] private readonly SpriteSystem _spriteSystem = default!;
@@ -78,6 +81,9 @@ private void UpdateAppearance(Entity<SpriteComponent?> entity, string state)
7881

7982
var visible = Appearance.TryGetData<bool>(entity, StunVisuals.SeeingStars, out var stars) && stars;
8083

84+
if (visible && !_cfg.GetCVar(DCCVars.ShowStunVisuals)) // DeltaV - Enable Stars via CVar.
85+
visible = false;
86+
8187
_spriteSystem.LayerSetVisible((entity, entity.Comp), index, visible);
8288
_spriteSystem.LayerSetRsiState((entity, entity.Comp), index, state);
8389
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using Content.Shared._DV.Access.Systems;
2+
3+
namespace Content.Client._DV.Access.Systems;
4+
5+
/// <summary>
6+
/// Client side handling of the subdermal ID system.
7+
/// </summary>
8+
public sealed class SubdermalIdCardSystem : SharedSubdermalIdCardSystem;

Content.Client/_DV/Options/UI/Tabs/DeltaTab.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
StyleClasses="LabelKeyText"/>
1010
<CheckBox Name="DisableFiltersCheckBox" Text="{Loc 'ui-options-no-filters'}" />
1111
<CheckBox Name="DisableGlimmerEffectCheckBox" Text="{Loc 'ui-options-disable-glimmer-effect'}" />
12+
<CheckBox Name="EnableStunVisualsCheckBox" Text="{Loc 'ui-options-enable-stun-visuals'}" />
1213
<Label Text="{Loc 'ui-options-delta-tips'}"
1314
StyleClasses="LabelKeyText"/>
1415
<CheckBox Name="DisableTipsCheckBox" Text="{Loc 'ui-options-delta-disable-tips'}" />

Content.Client/_DV/Options/UI/Tabs/DeltaTab.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public DeltaTab()
1818

1919
Control.AddOptionCheckBox(DCCVars.NoVisionFilters, DisableFiltersCheckBox);
2020
Control.AddOptionCheckBox(DCCVars.DisableGlimmerShader, DisableGlimmerEffectCheckBox);
21+
Control.AddOptionCheckBox(DCCVars.ShowStunVisuals, EnableStunVisualsCheckBox);
2122
Control.AddOptionCheckBox(DCCVars.DisableTips, DisableTipsCheckBox);
2223

2324
ResetTipsButton.OnPressed += _ => OnResetTipsPressed();
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using Content.Shared._ES.Core.Timer.Components;
2+
3+
namespace Content.Client._ES.Lighting.Components;
4+
5+
/// <summary>
6+
/// Handles a point light that fades out while synced to a <see cref="ESTimedDespawnComponent"/>
7+
/// </summary>
8+
[RegisterComponent]
9+
[Access(typeof(ESTimedDespawnLightFadeSystem))]
10+
public sealed partial class ESTimedDespawnLightFadeComponent : Component
11+
{
12+
[DataField]
13+
public TimeSpan FadeTime = TimeSpan.FromSeconds(1);
14+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using Content.Client._ES.Lighting.Components;
2+
using Content.Shared._ES.Core.Timer.Components;
3+
using Robust.Client.Animations;
4+
using Robust.Client.GameObjects;
5+
using Robust.Shared.Animations;
6+
using Robust.Shared.Timing;
7+
8+
namespace Content.Client._ES.Lighting;
9+
10+
public sealed class ESTimedDespawnLightFadeSystem : VisualizerSystem<ESTimedDespawnLightFadeComponent>
11+
{
12+
[Dependency] private readonly IGameTiming _timing = default!;
13+
[Dependency] private readonly AnimationPlayerSystem _animationPlayer = default!;
14+
15+
private const string FadeTrack = "light-fade";
16+
17+
protected override void OnAppearanceChange(EntityUid uid, ESTimedDespawnLightFadeComponent component, ref AppearanceChangeEvent args)
18+
{
19+
base.OnAppearanceChange(uid, component, ref args);
20+
21+
if (_animationPlayer.HasRunningAnimation(uid, FadeTrack))
22+
return;
23+
24+
if (!AppearanceSystem.TryGetData<TimeSpan>(uid, ESTimedDespawnVisuals.DespawnTime, out var time, args.Component) ||
25+
!TryComp<PointLightComponent>(uid, out var light))
26+
return;
27+
28+
var duration = time - _timing.CurTime;
29+
30+
var animation = new Animation
31+
{
32+
Length = duration,
33+
AnimationTracks =
34+
{
35+
new AnimationTrackComponentProperty
36+
{
37+
Property = nameof(PointLightComponent.Energy),
38+
ComponentType = typeof(PointLightComponent),
39+
InterpolationMode = AnimationInterpolationMode.Linear,
40+
KeyFrames =
41+
{
42+
new AnimationTrackProperty.KeyFrame(light.Energy, 0f),
43+
new AnimationTrackProperty.KeyFrame(light.Energy, (float) (duration - component.FadeTime).TotalSeconds),
44+
new AnimationTrackProperty.KeyFrame(0f, (float) component.FadeTime.TotalSeconds, Easings.OutSine),
45+
}
46+
}
47+
}
48+
};
49+
50+
_animationPlayer.Play(uid, animation, FadeTrack);
51+
}
52+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using Content.Shared._ES.Core.Timer.Components;
2+
3+
namespace Content.Client._ES.Sprite.Components;
4+
5+
/// <summary>
6+
/// Handles a sprite that fades out while synced to a <see cref="ESTimedDespawnComponent"/>
7+
/// </summary>
8+
[RegisterComponent]
9+
[Access(typeof(ESTimedDespawnSpriteFadeSystem))]
10+
public sealed partial class ESTimedDespawnSpriteFadeComponent : Component
11+
{
12+
[DataField]
13+
public TimeSpan FadeTime = TimeSpan.FromSeconds(1);
14+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
using Content.Client._ES.Sprite.Components;
2+
using Content.Shared._ES.Core.Timer.Components;
3+
using Robust.Client.Animations;
4+
using Robust.Client.GameObjects;
5+
using Robust.Shared.Animations;
6+
using Robust.Shared.Timing;
7+
8+
namespace Content.Client._ES.Sprite;
9+
10+
/// <summary>
11+
/// This handles <see cref="ESTimedDespawnSpriteFadeComponent"/>
12+
/// </summary>
13+
public sealed class ESTimedDespawnSpriteFadeSystem : VisualizerSystem<ESTimedDespawnSpriteFadeComponent>
14+
{
15+
[Dependency] private readonly IGameTiming _timing = default!;
16+
[Dependency] private readonly AnimationPlayerSystem _animationPlayer = default!;
17+
18+
private const string FadeTrack = "es-sprite-fade";
19+
20+
protected override void OnAppearanceChange(EntityUid uid, ESTimedDespawnSpriteFadeComponent component, ref AppearanceChangeEvent args)
21+
{
22+
base.OnAppearanceChange(uid, component, ref args);
23+
24+
if (args.Sprite is not { } sprite)
25+
return;
26+
27+
if (_animationPlayer.HasRunningAnimation(uid, FadeTrack))
28+
return;
29+
30+
if (!AppearanceSystem.TryGetData<TimeSpan>(uid, ESTimedDespawnVisuals.DespawnTime, out var time, args.Component))
31+
return;
32+
33+
var duration = time - _timing.CurTime;
34+
35+
var animation = new Animation
36+
{
37+
Length = duration,
38+
AnimationTracks =
39+
{
40+
new AnimationTrackComponentProperty
41+
{
42+
Property = nameof(SpriteComponent.Color),
43+
ComponentType = typeof(SpriteComponent),
44+
InterpolationMode = AnimationInterpolationMode.Linear,
45+
KeyFrames =
46+
{
47+
new AnimationTrackProperty.KeyFrame(sprite.Color, 0f),
48+
new AnimationTrackProperty.KeyFrame(sprite.Color, MathF.Max((float) (duration - component.FadeTime).TotalSeconds, 0f)),
49+
new AnimationTrackProperty.KeyFrame(sprite.Color.WithAlpha(0f), (float) component.FadeTime.TotalSeconds, Easings.OutSine),
50+
},
51+
},
52+
},
53+
};
54+
55+
_animationPlayer.Play(uid, animation, FadeTrack);
56+
}
57+
}

0 commit comments

Comments
 (0)