pAIs Play Music (#5614)
* Disable check * vehicle test * Make PAI stop instrument when turning off (player leaves/ejected) * Give pAI an instrument component with a custom soundfont * Add pAI synth program to custom ss14 soundfont * Add new PAIMidi action that pAIs use to open their instruments * Changed instrument component to allow its player to be the actor of its parent item * Oops. Readds instrumentcomponent. * ECS Changes * Changed soundfont to ringtone * Revert "Disable check" This reverts commit 86001d8b5e94ee38d0c9504cb19826327b04fb16. * Remove action parameters from ghost placeholder * Revert "vehicle test" This reverts commit 8a8ecf41083e0d5c8d4363ff02981bdab04bcd1c. * Fixes to whitespace * Even more fixes to whitespace * Removed paiSynth sample from spacestation14.sf2 * Yet another indentation touchup
This commit is contained in:
34
Content.Server/Actions/Actions/PAIMidi.cs
Normal file
34
Content.Server/Actions/Actions/PAIMidi.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Content.Server.Ghost;
|
||||
using Content.Shared.Actions.Behaviors;
|
||||
using Content.Shared.Actions.Components;
|
||||
using Content.Shared.Cooldown;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Server.GameObjects;
|
||||
using Content.Shared.Instruments;
|
||||
|
||||
namespace Content.Server.Actions.Actions
|
||||
{
|
||||
/// <summary>
|
||||
/// Pull up MIDI instrument interface for PAIs to "play themselves"
|
||||
/// </summary>
|
||||
[UsedImplicitly]
|
||||
[DataDefinition]
|
||||
public class PAIMidi : IInstantAction
|
||||
{
|
||||
|
||||
public void DoInstantAction(InstantActionEventArgs args)
|
||||
{
|
||||
if (!args.Performer.TryGetComponent<ServerUserInterfaceComponent>(out var serverUi)) return;
|
||||
if (!args.Performer.TryGetComponent<ActorComponent>(out var actor)) return;
|
||||
if (!serverUi.TryGetBoundUserInterface(InstrumentUiKey.Key,out var bui)) return;
|
||||
|
||||
bui.Toggle(actor.PlayerSession);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user