Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Harpy Singing #85

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Content.Shared/Traits/Assorted/Components/SingerComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ public sealed partial class SingerComponent : Component
[DataField(required: true), AutoNetworkedField]
public ProtoId<SingerInstrumentPrototype> Proto = string.Empty;

[DataField(serverOnly: true)]
public EntProtoId? MidiActionId = "ActionHarpyPlayMidi";

[DataField(serverOnly: true)]
public EntityUid? MidiAction;
}
7 changes: 1 addition & 6 deletions Content.Shared/Traits/Assorted/Systems/SharedSingerSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,12 @@ private void OnStartup(Entity<SingerComponent> ent, ref ComponentStartup args)
if (!ProtoMan.TryIndex(ent.Comp.Proto, out var singer))
return;

_actionsSystem.AddAction(ent, ref ent.Comp.MidiAction, singer.MidiActionId);
_actionsSystem.AddAction(ent, ref ent.Comp.MidiAction, ent.Comp.MidiActionId);

var instrumentComp = EnsureInstrumentComp(ent);
var defaultData = singer.InstrumentList[singer.DefaultInstrument];
_instrument.SetInstrumentProgram(instrumentComp, defaultData.Item1, defaultData.Item2);
SetUpSwappableInstrument(ent, singer);

EntityManager.TryGetComponent<UserInterfaceComponent>(ent.Owner, out var comp);
var entui = new Entity<UserInterfaceComponent?>(ent.Owner, comp);
if (singer.MidiUi is { } uiKey && !_ui.IsUiOpen(entui, uiKey))
_ui.OpenUi(entui, uiKey, entui);
}

private void OnShutdown(Entity<SingerComponent> ent, ref ComponentShutdown args)
Expand Down
7 changes: 6 additions & 1 deletion Resources/Prototypes/Entities/Mobs/Species/harpy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@
- Shard
- Landmine
- Mousetrap
- type: UserInterface
interfaces:
enum.InstrumentUiKey.Key:
type: InstrumentBoundUserInterface
requireInputValidation: false

- type: entity
save: false
Expand Down Expand Up @@ -218,4 +223,4 @@
checkCanInteract: false
icon: { sprite: Interface/Actions/flight.rsi, state: flight_off }
iconOn: { sprite : Interface/Actions/flight.rsi, state: flight_on }
event: !type:ToggleFlightEvent
event: !type:ToggleFlightEvent
Loading