-
Notifications
You must be signed in to change notification settings - Fork 359
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor harpy singing visuals into InstrumentVisuals
- Loading branch information
deltanedas
committed
Dec 31, 2024
1 parent
33d14d8
commit 775726b
Showing
5 changed files
with
57 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
Content.Shared/DeltaV/Harpy/Components/HarpyVisualSystem.cs
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
Content.Shared/DeltaV/Instruments/InstrumentVisualsComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Robust.Shared.GameStates; | ||
using Robust.Shared.Serialization; | ||
|
||
namespace Content.Shared.DeltaV.Instruments; | ||
|
||
/// <summary> | ||
/// Controls the bool <see cref="InstrumentVisuals"/> when the instrument UI is open. | ||
/// Use GenericVisualizerComponent to then control sprite states. | ||
/// </summary> | ||
[RegisterComponent, NetworkedComponent] | ||
public sealed partial class InstrumentVisualsComponent : Component; | ||
|
||
[Serializable, NetSerializable] | ||
public enum InstrumentVisuals : byte | ||
{ | ||
Playing, | ||
Layer | ||
} |
33 changes: 33 additions & 0 deletions
33
Content.Shared/DeltaV/Instruments/InstrumentVisualsSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using Content.Shared.Instruments; | ||
using Content.Shared.UserInterface; | ||
|
||
namespace Content.Shared.DeltaV.Instruments; | ||
|
||
public sealed class InstrumentVisualsSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly SharedAppearanceSystem _appearance = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeLocalEvent<InstrumentVisualsComponent, BoundUIClosedEvent>(OnUIClosed); | ||
SubscribeLocalEvent<InstrumentVisualsComponent, BoundUIOpenedEvent>(OnUIOpened); | ||
} | ||
|
||
private void OnUIClosed(Entity<InstrumentVisualsComponent> ent, ref BoundUIClosedEvent args) | ||
{ | ||
if (args.UiKey is not InstrumentUiKey) | ||
return; | ||
|
||
_appearance.SetData(ent, InstrumentVisuals.Playing, false); | ||
} | ||
|
||
private void OnUIOpened(Entity<InstrumentVisualsComponent> ent, ref BoundUIOpenedEvent args) | ||
{ | ||
if (args.UiKey is not InstrumentUiKey) | ||
return; | ||
|
||
_appearance.SetData(ent, InstrumentVisuals.Playing, true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters