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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,12 @@ using Content.Shared.Examine;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.PAI;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Shared.Instruments;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Instruments;
|
||||
using Content.Server.Ghost.Roles.Components;
|
||||
using Content.Server.Mind.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -16,6 +19,7 @@ namespace Content.Server.PAI
|
||||
public class PAISystem : SharedPAISystem
|
||||
{
|
||||
[Dependency] private readonly PopupSystem _popupSystem = default!;
|
||||
[Dependency] private readonly InstrumentSystem _instrumentSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -97,6 +101,15 @@ namespace Content.Server.PAI
|
||||
private void PAITurningOff(EntityUid uid)
|
||||
{
|
||||
UpdatePAIAppearance(uid, PAIStatus.Off);
|
||||
// Close the instrument interface if it was open
|
||||
// before closing
|
||||
if (EntityManager.TryGetComponent<ServerUserInterfaceComponent>(uid, out var serverUi))
|
||||
if (EntityManager.TryGetComponent<ActorComponent>(uid, out var actor))
|
||||
if (serverUi.TryGetBoundUserInterface(InstrumentUiKey.Key,out var bui))
|
||||
bui.Close(actor.PlayerSession);
|
||||
|
||||
// Stop instrument
|
||||
if (EntityManager.TryGetComponent<InstrumentComponent>(uid, out var instrument)) _instrumentSystem.Clean(uid, instrument);
|
||||
if (EntityManager.TryGetComponent<MetaDataComponent>(uid, out var metadata))
|
||||
{
|
||||
var proto = metadata.EntityPrototype;
|
||||
|
||||
Reference in New Issue
Block a user