Musician PDA quick fix (#7018)
This commit is contained in:
@@ -48,6 +48,11 @@ namespace Content.Client.PDA
|
|||||||
SendMessage(new PDAShowUplinkMessage());
|
SendMessage(new PDAShowUplinkMessage());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_menu.ActivateMusicButton.OnPressed += _ =>
|
||||||
|
{
|
||||||
|
SendMessage(new PDAShowMusicMessage());
|
||||||
|
};
|
||||||
|
|
||||||
_menu.AccessRingtoneButton.OnPressed += _ =>
|
_menu.AccessRingtoneButton.OnPressed += _ =>
|
||||||
{
|
{
|
||||||
SendMessage(new PDAShowRingtoneMessage());
|
SendMessage(new PDAShowRingtoneMessage());
|
||||||
@@ -91,6 +96,7 @@ namespace Content.Client.PDA
|
|||||||
_menu.EjectIdButton.Visible = msg.PDAOwnerInfo.IdOwner != null || msg.PDAOwnerInfo.JobTitle != null;
|
_menu.EjectIdButton.Visible = msg.PDAOwnerInfo.IdOwner != null || msg.PDAOwnerInfo.JobTitle != null;
|
||||||
_menu.EjectPenButton.Visible = msg.HasPen;
|
_menu.EjectPenButton.Visible = msg.HasPen;
|
||||||
_menu.ActivateUplinkButton.Visible = msg.HasUplink;
|
_menu.ActivateUplinkButton.Visible = msg.HasUplink;
|
||||||
|
_menu.ActivateMusicButton.Visible = msg.CanPlayMusic;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,9 @@
|
|||||||
<Button Name="ActivateUplinkButton"
|
<Button Name="ActivateUplinkButton"
|
||||||
Access="Public"
|
Access="Public"
|
||||||
Text="{Loc 'pda-bound-user-interface-uplink-tab-title'}" />
|
Text="{Loc 'pda-bound-user-interface-uplink-tab-title'}" />
|
||||||
|
<Button Name="ActivateMusicButton"
|
||||||
|
Access="Public"
|
||||||
|
Text="{Loc 'pda-bound-user-interface-music-button'}" />
|
||||||
</BoxContainer>
|
</BoxContainer>
|
||||||
</TabContainer>
|
</TabContainer>
|
||||||
</DefaultWindow>
|
</DefaultWindow>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Content.Server.UserInterface;
|
|||||||
using Content.Shared.Instruments;
|
using Content.Shared.Instruments;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Server.Player;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
@@ -181,4 +182,13 @@ public sealed partial class InstrumentSystem : SharedInstrumentSystem
|
|||||||
instrument.BatchesDropped = 0;
|
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.Components;
|
||||||
using Content.Server.Light.EntitySystems;
|
using Content.Server.Light.EntitySystems;
|
||||||
using Content.Server.Light.Events;
|
using Content.Server.Light.Events;
|
||||||
@@ -7,6 +8,7 @@ using Content.Server.Traitor.Uplink.Components;
|
|||||||
using Content.Server.PDA.Ringer;
|
using Content.Server.PDA.Ringer;
|
||||||
using Content.Server.UserInterface;
|
using Content.Server.UserInterface;
|
||||||
using Content.Shared.Containers.ItemSlots;
|
using Content.Shared.Containers.ItemSlots;
|
||||||
|
using Content.Shared.Instruments;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.PDA;
|
using Content.Shared.PDA;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
@@ -22,6 +24,7 @@ namespace Content.Server.PDA
|
|||||||
[Dependency] private readonly UplinkAccountsSystem _uplinkAccounts = default!;
|
[Dependency] private readonly UplinkAccountsSystem _uplinkAccounts = default!;
|
||||||
[Dependency] private readonly UnpoweredFlashlightSystem _unpoweredFlashlight = default!;
|
[Dependency] private readonly UnpoweredFlashlightSystem _unpoweredFlashlight = default!;
|
||||||
[Dependency] private readonly RingerSystem _ringerSystem = default!;
|
[Dependency] private readonly RingerSystem _ringerSystem = default!;
|
||||||
|
[Dependency] private readonly InstrumentSystem _instrumentSystem = default!;
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
@@ -119,7 +122,9 @@ namespace Content.Server.PDA
|
|||||||
if (ui == null)
|
if (ui == null)
|
||||||
return;
|
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>
|
/// <summary>
|
||||||
@@ -156,6 +161,7 @@ namespace Content.Server.PDA
|
|||||||
if (msg.Session.AttachedEntity is not {Valid: true} playerUid)
|
if (msg.Session.AttachedEntity is not {Valid: true} playerUid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// todo: move this to entity events
|
||||||
switch (msg.Message)
|
switch (msg.Message)
|
||||||
{
|
{
|
||||||
case PDARequestUpdateInterfaceMessage _:
|
case PDARequestUpdateInterfaceMessage _:
|
||||||
@@ -190,6 +196,12 @@ namespace Content.Server.PDA
|
|||||||
_ringerSystem.ToggleRingerUI(ringer, msg.Session);
|
_ringerSystem.ToggleRingerUI(ringer, msg.Session);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case PDAShowMusicMessage _:
|
||||||
|
{
|
||||||
|
if (TryComp(pda.Owner, out InstrumentComponent? instrument))
|
||||||
|
_instrumentSystem.ToggleInstrumentUi(pda.Owner, msg.Session, instrument);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,14 @@ namespace Content.Shared.PDA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
public sealed class PDAShowMusicMessage : BoundUserInterfaceMessage
|
||||||
|
{
|
||||||
|
public PDAShowMusicMessage()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public sealed class PDARequestUpdateInterfaceMessage : BoundUserInterfaceMessage
|
public sealed class PDARequestUpdateInterfaceMessage : BoundUserInterfaceMessage
|
||||||
|
|||||||
@@ -13,13 +13,15 @@ namespace Content.Shared.PDA
|
|||||||
public bool HasPen;
|
public bool HasPen;
|
||||||
public PDAIdInfoText PDAOwnerInfo;
|
public PDAIdInfoText PDAOwnerInfo;
|
||||||
public bool HasUplink;
|
public bool HasUplink;
|
||||||
|
public bool CanPlayMusic;
|
||||||
|
|
||||||
public PDAUpdateState(bool flashlightEnabled, bool hasPen, PDAIdInfoText pDAOwnerInfo, bool hasUplink = false)
|
public PDAUpdateState(bool flashlightEnabled, bool hasPen, PDAIdInfoText pDAOwnerInfo, bool hasUplink = false, bool canPlayMusic = false)
|
||||||
{
|
{
|
||||||
FlashlightEnabled = flashlightEnabled;
|
FlashlightEnabled = flashlightEnabled;
|
||||||
HasPen = hasPen;
|
HasPen = hasPen;
|
||||||
PDAOwnerInfo = pDAOwnerInfo;
|
PDAOwnerInfo = pDAOwnerInfo;
|
||||||
HasUplink = hasUplink;
|
HasUplink = hasUplink;
|
||||||
|
CanPlayMusic = canPlayMusic;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,3 +21,5 @@ comp-pda-ui-eject-pen-button = Eject Pen
|
|||||||
comp-pda-ui-ringtone-button = Ringtone
|
comp-pda-ui-ringtone-button = Ringtone
|
||||||
|
|
||||||
comp-pda-ui-toggle-flashlight-button = Toggle Flashlight
|
comp-pda-ui-toggle-flashlight-button = Toggle Flashlight
|
||||||
|
|
||||||
|
pda-bound-user-interface-music-button = Music Instrument
|
||||||
|
|||||||
@@ -43,6 +43,8 @@
|
|||||||
type: UplinkBoundUserInterface
|
type: UplinkBoundUserInterface
|
||||||
- key: enum.RingerUiKey.Key
|
- key: enum.RingerUiKey.Key
|
||||||
type: RingerBoundUserInterface
|
type: RingerBoundUserInterface
|
||||||
|
- key: enum.InstrumentUiKey.Key
|
||||||
|
type: InstrumentBoundUserInterface
|
||||||
- type: PDA
|
- type: PDA
|
||||||
penSlot:
|
penSlot:
|
||||||
startingItem: Pen
|
startingItem: Pen
|
||||||
@@ -59,6 +61,8 @@
|
|||||||
- type: Tag
|
- type: Tag
|
||||||
tags:
|
tags:
|
||||||
- DoorBumpOpener
|
- DoorBumpOpener
|
||||||
|
- type: Input
|
||||||
|
context: "human"
|
||||||
|
|
||||||
- type: entity
|
- type: entity
|
||||||
parent: BasePDA
|
parent: BasePDA
|
||||||
@@ -493,13 +497,3 @@
|
|||||||
handheld: true
|
handheld: true
|
||||||
bank: 1
|
bank: 1
|
||||||
program: 2
|
program: 2
|
||||||
- type: ActivatableUI
|
|
||||||
inHandsOnly: true
|
|
||||||
singleUser: true
|
|
||||||
key: enum.InstrumentUiKey.Key
|
|
||||||
- type: UserInterface
|
|
||||||
interfaces:
|
|
||||||
- key: enum.InstrumentUiKey.Key
|
|
||||||
type: InstrumentBoundUserInterface
|
|
||||||
- type: Input
|
|
||||||
context: "human"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user