mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-02-15 04:30:57 +01:00
Content update for NetEntities (#18935)
This commit is contained in:
@@ -54,10 +54,10 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
|
||||
|
||||
public void SetMaster(EntityUid uid, EntityUid? masterUid)
|
||||
{
|
||||
if (!TryComp(uid, out InstrumentComponent? instrument))
|
||||
if (!HasComp<InstrumentComponent>(uid))
|
||||
return;
|
||||
|
||||
RaiseNetworkEvent(new InstrumentSetMasterEvent(uid, masterUid));
|
||||
RaiseNetworkEvent(new InstrumentSetMasterEvent(GetNetEntity(uid), GetNetEntity(masterUid)));
|
||||
}
|
||||
|
||||
public void SetFilteredChannel(EntityUid uid, int channel, bool value)
|
||||
@@ -68,7 +68,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
|
||||
if(value)
|
||||
instrument.Renderer?.SendMidiEvent(RobustMidiEvent.AllNotesOff((byte)channel, 0), false);
|
||||
|
||||
RaiseNetworkEvent(new InstrumentSetFilteredChannelEvent(uid, channel, value));
|
||||
RaiseNetworkEvent(new InstrumentSetFilteredChannelEvent(GetNetEntity(uid), channel, value));
|
||||
}
|
||||
|
||||
public override void SetupRenderer(EntityUid uid, bool fromStateChange, SharedInstrumentComponent? component = null)
|
||||
@@ -109,7 +109,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
|
||||
|
||||
if (!fromStateChange)
|
||||
{
|
||||
RaiseNetworkEvent(new InstrumentStartMidiEvent(uid));
|
||||
RaiseNetworkEvent(new InstrumentStartMidiEvent(GetNetEntity(uid)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
|
||||
|
||||
if (!fromStateChange && _netManager.IsConnected)
|
||||
{
|
||||
RaiseNetworkEvent(new InstrumentStopMidiEvent(uid));
|
||||
RaiseNetworkEvent(new InstrumentStopMidiEvent(GetNetEntity(uid)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
|
||||
|
||||
private void OnMidiEventRx(InstrumentMidiEventEvent midiEv)
|
||||
{
|
||||
var uid = midiEv.Uid;
|
||||
var uid = GetEntity(midiEv.Uid);
|
||||
|
||||
if (!TryComp(uid, out InstrumentComponent? instrument))
|
||||
return;
|
||||
@@ -354,12 +354,12 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
|
||||
|
||||
private void OnMidiStart(InstrumentStartMidiEvent ev)
|
||||
{
|
||||
SetupRenderer(ev.Uid, true);
|
||||
SetupRenderer(GetEntity(ev.Uid), true);
|
||||
}
|
||||
|
||||
private void OnMidiStop(InstrumentStopMidiEvent ev)
|
||||
{
|
||||
EndRenderer(ev.Uid, true);
|
||||
EndRenderer(GetEntity(ev.Uid), true);
|
||||
}
|
||||
|
||||
public override void Update(float frameTime)
|
||||
@@ -425,7 +425,7 @@ public sealed class InstrumentSystem : SharedInstrumentSystem
|
||||
if (eventCount == 0)
|
||||
continue;
|
||||
|
||||
RaiseNetworkEvent(new InstrumentMidiEventEvent(uid, events));
|
||||
RaiseNetworkEvent(new InstrumentMidiEventEvent(GetNetEntity(uid), events));
|
||||
|
||||
instrument.SentWithinASec += eventCount;
|
||||
|
||||
|
||||
@@ -32,12 +32,13 @@ public sealed partial class BandMenu : DefaultWindow
|
||||
Timer.Spawn(0, Close);
|
||||
}
|
||||
|
||||
public void Populate((EntityUid, string)[] nearby)
|
||||
public void Populate((NetEntity, string)[] nearby, IEntityManager entManager)
|
||||
{
|
||||
BandList.Clear();
|
||||
|
||||
foreach (var (uid, name) in nearby)
|
||||
foreach (var (nent, name) in nearby)
|
||||
{
|
||||
var uid = entManager.GetEntity(nent);
|
||||
var item = BandList.AddItem(name, null, true, uid);
|
||||
item.Selected = _owner.Instrument?.Master == uid;
|
||||
}
|
||||
|
||||
@@ -10,15 +10,15 @@ namespace Content.Client.Instruments.UI
|
||||
{
|
||||
public sealed class InstrumentBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[Dependency] public readonly IEntityManager Entities = default!;
|
||||
public IEntityManager Entities => EntMan;
|
||||
[Dependency] public readonly IMidiManager MidiManager = default!;
|
||||
[Dependency] public readonly IFileDialogManager FileDialogManager = default!;
|
||||
[Dependency] public readonly IPlayerManager PlayerManager = default!;
|
||||
[Dependency] public readonly ILocalizationManager Loc = default!;
|
||||
|
||||
public readonly InstrumentSystem Instruments = default!;
|
||||
public readonly ActionBlockerSystem ActionBlocker = default!;
|
||||
public readonly SharedInteractionSystem Interactions = default!;
|
||||
public readonly InstrumentSystem Instruments;
|
||||
public readonly ActionBlockerSystem ActionBlocker;
|
||||
public readonly SharedInteractionSystem Interactions;
|
||||
|
||||
[ViewVariables] private InstrumentMenu? _instrumentMenu;
|
||||
[ViewVariables] private BandMenu? _bandMenu;
|
||||
@@ -40,7 +40,7 @@ namespace Content.Client.Instruments.UI
|
||||
switch (message)
|
||||
{
|
||||
case InstrumentBandResponseBuiMessage bandRx:
|
||||
_bandMenu?.Populate(bandRx.Nearby);
|
||||
_bandMenu?.Populate(bandRx.Nearby, EntMan);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user