Remove instruments compref (#19560)
This commit is contained in:
@@ -15,6 +15,7 @@ using Robust.Shared.Audio.Midi;
|
||||
using Robust.Shared.Collections;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
@@ -55,9 +56,26 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
|
||||
SubscribeLocalEvent<InstrumentComponent, BoundUIOpenedEvent>(OnBoundUIOpened);
|
||||
SubscribeLocalEvent<InstrumentComponent, InstrumentBandRequestBuiMessage>(OnBoundUIRequestBands);
|
||||
|
||||
SubscribeLocalEvent<InstrumentComponent, ComponentGetState>(OnStrumentGetState);
|
||||
|
||||
_conHost.RegisterCommand("addtoband", AddToBandCommand);
|
||||
}
|
||||
|
||||
private void OnStrumentGetState(EntityUid uid, InstrumentComponent component, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new InstrumentComponentState()
|
||||
{
|
||||
Playing = component.Playing,
|
||||
InstrumentProgram = component.InstrumentProgram,
|
||||
InstrumentBank = component.InstrumentBank,
|
||||
AllowPercussion = component.AllowPercussion,
|
||||
AllowProgramChange = component.AllowProgramChange,
|
||||
RespectMidiLimits = component.RespectMidiLimits,
|
||||
Master = GetNetEntity(component.Master),
|
||||
FilteredChannels = component.FilteredChannels
|
||||
};
|
||||
}
|
||||
|
||||
[AdminCommand(AdminFlags.Fun)]
|
||||
private void AddToBandCommand(IConsoleShell shell, string _, string[] args)
|
||||
{
|
||||
@@ -441,4 +459,14 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
|
||||
if (_bui.TryGetUi(uid, InstrumentUiKey.Key, out var bui))
|
||||
_bui.ToggleUi(bui, session);
|
||||
}
|
||||
|
||||
public override bool ResolveInstrument(EntityUid uid, ref SharedInstrumentComponent? component)
|
||||
{
|
||||
if (component is not null)
|
||||
return true;
|
||||
|
||||
TryComp<InstrumentComponent>(uid, out var localComp);
|
||||
component = localComp;
|
||||
return component != null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user