Add PDA Ringtones (#5842)

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
TheDarkElites
2022-02-08 04:39:23 -05:00
committed by GitHub
parent b499ef61b0
commit 8c47d6103f
29 changed files with 590 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ using Content.Server.Light.Events;
using Content.Server.Traitor.Uplink;
using Content.Server.Traitor.Uplink.Account;
using Content.Server.Traitor.Uplink.Components;
using Content.Server.PDA.Ringer;
using Content.Server.UserInterface;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Interaction;
@@ -20,6 +21,7 @@ namespace Content.Server.PDA
[Dependency] private readonly UplinkSystem _uplinkSystem = default!;
[Dependency] private readonly UplinkAccountsSystem _uplinkAccounts = default!;
[Dependency] private readonly UnpoweredFlashlightSystem _unpoweredFlashlight = default!;
[Dependency] private readonly RingerSystem _ringerSystem = default!;
public override void Initialize()
{
@@ -38,6 +40,13 @@ namespace Content.Server.PDA
ui.OnReceiveMessage += (msg) => OnUIMessage(pda, msg);
}
private void OnUse(EntityUid uid, PDAComponent pda, UseInHandEvent args)
{
if (args.Handled)
return;
args.Handled = OpenUI(pda, args.User);
}
private void OnActivateInWorld(EntityUid uid, PDAComponent pda, ActivateInWorldEvent args)
{
if (args.Handled)
@@ -175,6 +184,12 @@ namespace Content.Server.PDA
_uplinkSystem.ToggleUplinkUI(uplink, msg.Session);
break;
}
case PDAShowRingtoneMessage _:
{
if (EntityManager.TryGetComponent(pda.Owner, out RingerComponent? ringer))
_ringerSystem.ToggleRingerUI(ringer, msg.Session);
break;
}
}
}
}