Inline GetComponentOrNull
This commit is contained in:
@@ -3,6 +3,7 @@ using Content.Shared.Instruments;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.Instruments;
|
||||
@@ -23,8 +24,8 @@ public sealed class InstrumentComponent : SharedInstrumentComponent
|
||||
public int MidiEventCount = 0;
|
||||
|
||||
public IPlayerSession? InstrumentPlayer =>
|
||||
Owner.GetComponentOrNull<ActivatableUIComponent>()?.CurrentSingleUser
|
||||
?? Owner.GetComponentOrNull<ActorComponent>()?.PlayerSession;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ActivatableUIComponent>(Owner.Uid)?.CurrentSingleUser
|
||||
?? IoCManager.Resolve<IEntityManager>().GetComponentOrNull<ActorComponent>(Owner.Uid)?.PlayerSession;
|
||||
|
||||
[ViewVariables] public BoundUserInterface? UserInterface => Owner.GetUIOrNull(InstrumentUiKey.Key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user