Musician PDA quick fix (#7018)

This commit is contained in:
Alex Evgrashin
2022-03-07 14:41:50 +03:00
committed by GitHub
parent c4ecb1678a
commit 5f632e20ad
8 changed files with 49 additions and 12 deletions

View File

@@ -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;
}
}
}
}