diff --git a/Content.Client/PDA/PDABoundUserInterface.cs b/Content.Client/PDA/PDABoundUserInterface.cs
index 973cce464c..b5a7e19e04 100644
--- a/Content.Client/PDA/PDABoundUserInterface.cs
+++ b/Content.Client/PDA/PDABoundUserInterface.cs
@@ -48,6 +48,11 @@ namespace Content.Client.PDA
SendMessage(new PDAShowUplinkMessage());
};
+ _menu.ActivateMusicButton.OnPressed += _ =>
+ {
+ SendMessage(new PDAShowMusicMessage());
+ };
+
_menu.AccessRingtoneButton.OnPressed += _ =>
{
SendMessage(new PDAShowRingtoneMessage());
@@ -91,6 +96,7 @@ namespace Content.Client.PDA
_menu.EjectIdButton.Visible = msg.PDAOwnerInfo.IdOwner != null || msg.PDAOwnerInfo.JobTitle != null;
_menu.EjectPenButton.Visible = msg.HasPen;
_menu.ActivateUplinkButton.Visible = msg.HasUplink;
+ _menu.ActivateMusicButton.Visible = msg.CanPlayMusic;
break;
}
diff --git a/Content.Client/PDA/PDAMenu.xaml b/Content.Client/PDA/PDAMenu.xaml
index 95ae6eba65..40c31b9b2d 100644
--- a/Content.Client/PDA/PDAMenu.xaml
+++ b/Content.Client/PDA/PDAMenu.xaml
@@ -37,6 +37,9 @@
+
diff --git a/Content.Server/Instruments/InstrumentSystem.cs b/Content.Server/Instruments/InstrumentSystem.cs
index e74d9e2832..137d633e72 100644
--- a/Content.Server/Instruments/InstrumentSystem.cs
+++ b/Content.Server/Instruments/InstrumentSystem.cs
@@ -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);
+ }
}
diff --git a/Content.Server/PDA/PDASystem.cs b/Content.Server/PDA/PDASystem.cs
index da1f96c2e0..86ab624fa3 100644
--- a/Content.Server/PDA/PDASystem.cs
+++ b/Content.Server/PDA/PDASystem.cs
@@ -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(pda.Owner)));
}
///
@@ -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;
+ }
}
}
}
diff --git a/Content.Shared/PDA/PDAMessagesUI.cs b/Content.Shared/PDA/PDAMessagesUI.cs
index 13d1b220dc..afa9750f7e 100644
--- a/Content.Shared/PDA/PDAMessagesUI.cs
+++ b/Content.Shared/PDA/PDAMessagesUI.cs
@@ -48,6 +48,14 @@ namespace Content.Shared.PDA
}
}
+ [Serializable, NetSerializable]
+ public sealed class PDAShowMusicMessage : BoundUserInterfaceMessage
+ {
+ public PDAShowMusicMessage()
+ {
+
+ }
+ }
[Serializable, NetSerializable]
public sealed class PDARequestUpdateInterfaceMessage : BoundUserInterfaceMessage
diff --git a/Content.Shared/PDA/PDAUpdateState.cs b/Content.Shared/PDA/PDAUpdateState.cs
index 49715cb2ed..be939de65f 100644
--- a/Content.Shared/PDA/PDAUpdateState.cs
+++ b/Content.Shared/PDA/PDAUpdateState.cs
@@ -13,13 +13,15 @@ namespace Content.Shared.PDA
public bool HasPen;
public PDAIdInfoText PDAOwnerInfo;
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;
HasPen = hasPen;
PDAOwnerInfo = pDAOwnerInfo;
HasUplink = hasUplink;
+ CanPlayMusic = canPlayMusic;
}
}
diff --git a/Resources/Locale/en-US/pda/pda-component.ftl b/Resources/Locale/en-US/pda/pda-component.ftl
index 8513427687..6acee4e681 100644
--- a/Resources/Locale/en-US/pda/pda-component.ftl
+++ b/Resources/Locale/en-US/pda/pda-component.ftl
@@ -21,3 +21,5 @@ comp-pda-ui-eject-pen-button = Eject Pen
comp-pda-ui-ringtone-button = Ringtone
comp-pda-ui-toggle-flashlight-button = Toggle Flashlight
+
+pda-bound-user-interface-music-button = Music Instrument
diff --git a/Resources/Prototypes/Entities/Objects/Devices/pda.yml b/Resources/Prototypes/Entities/Objects/Devices/pda.yml
index 2430d80f5f..8d1af88b59 100644
--- a/Resources/Prototypes/Entities/Objects/Devices/pda.yml
+++ b/Resources/Prototypes/Entities/Objects/Devices/pda.yml
@@ -43,6 +43,8 @@
type: UplinkBoundUserInterface
- key: enum.RingerUiKey.Key
type: RingerBoundUserInterface
+ - key: enum.InstrumentUiKey.Key
+ type: InstrumentBoundUserInterface
- type: PDA
penSlot:
startingItem: Pen
@@ -59,6 +61,8 @@
- type: Tag
tags:
- DoorBumpOpener
+ - type: Input
+ context: "human"
- type: entity
parent: BasePDA
@@ -493,13 +497,3 @@
handheld: true
bank: 1
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"