-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathCombatModeVisualsSystem.cs
More file actions
29 lines (22 loc) · 1016 Bytes
/
CombatModeVisualsSystem.cs
File metadata and controls
29 lines (22 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using Content.Shared.CombatMode;
namespace Content.Goobstation.Client.CombatMode;
public sealed partial class CombatModeVisualsSystem : EntitySystem
{
[Dependency] private SharedAppearanceSystem _appearance = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CombatModeVisualsComponent, ToggleCombatActionEvent>(OnCombatToggle);
SubscribeLocalEvent<CombatModeVisualsComponent, ComponentStartup>(OnCombatStartup);
}
private void OnCombatToggle(Entity<CombatModeVisualsComponent> ent, ref ToggleCombatActionEvent args)
=> UpdateAppearance(ent.Owner);
private void OnCombatStartup(Entity<CombatModeVisualsComponent> ent, ref ComponentStartup args)
=> UpdateAppearance(ent.Owner);
private void UpdateAppearance(EntityUid uid)
{
if (!TryComp<CombatModeComponent>(uid, out var combat))
return;
_appearance.SetData(uid, CombatModeVisuals.Combat, combat.IsInCombatMode);
}
}