Skip to content
Merged

Chirp #1056

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
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;
}
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
3 changes: 3 additions & 0 deletions Resources/Prototypes/Entities/Mobs/Species/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,9 @@
type: HumanoidMarkingModifierBoundUserInterface
enum.StrippingUiKey.Key:
type: StrippableBoundUserInterface
enum.InstrumentUiKey.Key:
type: InstrumentBoundUserInterface
requireInputValidation: false
- type: Puller
- type: Speech
speechSounds: Alto
Expand Down