Musician PDA quick fix (#7018)
This commit is contained in:
@@ -5,6 +5,7 @@ using Content.Server.UserInterface;
|
||||
using Content.Shared.Instruments;
|
||||
using Content.Shared.Popups;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
@@ -181,4 +182,13 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
|
||||
instrument.BatchesDropped = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void ToggleInstrumentUi(EntityUid uid, IPlayerSession session, InstrumentComponent? component = null)
|
||||
{
|
||||
if (!Resolve(uid, ref component))
|
||||
return;
|
||||
|
||||
var ui = uid.GetUIOrNull(InstrumentUiKey.Key);
|
||||
ui?.Toggle(session);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Server.Instruments;
|
||||
using Content.Server.Light.Components;
|
||||
using Content.Server.Light.EntitySystems;
|
||||
using Content.Server.Light.Events;
|
||||
@@ -7,6 +8,7 @@ using Content.Server.Traitor.Uplink.Components;
|
||||
using Content.Server.PDA.Ringer;
|
||||
using Content.Server.UserInterface;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.Instruments;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.PDA;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -22,6 +24,7 @@ namespace Content.Server.PDA
|
||||
[Dependency] private readonly UplinkAccountsSystem _uplinkAccounts = default!;
|
||||
[Dependency] private readonly UnpoweredFlashlightSystem _unpoweredFlashlight = default!;
|
||||
[Dependency] private readonly RingerSystem _ringerSystem = default!;
|
||||
[Dependency] private readonly InstrumentSystem _instrumentSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -119,7 +122,9 @@ namespace Content.Server.PDA
|
||||
if (ui == null)
|
||||
return;
|
||||
|
||||
ui.SetState(new PDAUpdateState(pda.FlashlightOn, pda.PenSlot.HasItem, ownerInfo, ShouldShowUplink(pda.Owner, ui, user)));
|
||||
ui.SetState(new PDAUpdateState(pda.FlashlightOn, pda.PenSlot.HasItem, ownerInfo,
|
||||
ShouldShowUplink(pda.Owner, ui, user),
|
||||
HasComp<InstrumentComponent>(pda.Owner)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -156,6 +161,7 @@ namespace Content.Server.PDA
|
||||
if (msg.Session.AttachedEntity is not {Valid: true} playerUid)
|
||||
return;
|
||||
|
||||
// todo: move this to entity events
|
||||
switch (msg.Message)
|
||||
{
|
||||
case PDARequestUpdateInterfaceMessage _:
|
||||
@@ -190,6 +196,12 @@ namespace Content.Server.PDA
|
||||
_ringerSystem.ToggleRingerUI(ringer, msg.Session);
|
||||
break;
|
||||
}
|
||||
case PDAShowMusicMessage _:
|
||||
{
|
||||
if (TryComp(pda.Owner, out InstrumentComponent? instrument))
|
||||
_instrumentSystem.ToggleInstrumentUi(pda.Owner, msg.Session, instrument);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user