Play sound and request window on cloning (#8323)
ECS TBD. Fish did a pr but it was doing a lot at once.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Content.Client.Eui;
|
||||
using Content.Shared.Cloning;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Graphics;
|
||||
|
||||
namespace Content.Client.Cloning.UI
|
||||
{
|
||||
@@ -28,6 +29,7 @@ namespace Content.Client.Cloning.UI
|
||||
|
||||
public override void Opened()
|
||||
{
|
||||
IoCManager.Resolve<IClyde>().RequestWindowAttention();
|
||||
_window.OpenCentered();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Linq;
|
||||
using Content.Server.Cloning.Components;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.GameTicking;
|
||||
using Content.Shared.Preferences;
|
||||
using Robust.Shared.Timing;
|
||||
@@ -54,6 +55,7 @@ namespace Content.Server.Cloning
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
// TODO: Make this stateful
|
||||
foreach (var (cloning, power) in EntityManager.EntityQuery<CloningPodComponent, ApcPowerReceiverComponent>())
|
||||
{
|
||||
if (cloning.UiKnownPowerState != power.Powered)
|
||||
|
||||
@@ -7,10 +7,14 @@ using Content.Shared.CharacterAppearance.Systems;
|
||||
using Content.Shared.Cloning;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Content.Shared.Sound;
|
||||
using Content.Shared.Species;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Cloning.Components
|
||||
@@ -18,15 +22,12 @@ namespace Content.Server.Cloning.Components
|
||||
[RegisterComponent]
|
||||
public sealed class CloningPodComponent : SharedCloningPodComponent
|
||||
{
|
||||
[Dependency] private readonly IPlayerManager _playerManager = null!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entities = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototype = default!;
|
||||
|
||||
[Dependency] private readonly EuiManager _euiManager = null!;
|
||||
|
||||
[ViewVariables]
|
||||
public bool Powered => !_entities.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered;
|
||||
|
||||
[ViewVariables]
|
||||
public BoundUserInterface? UserInterface =>
|
||||
Owner.GetUIOrNull(CloningPodUIKey.Key);
|
||||
@@ -39,6 +40,9 @@ namespace Content.Server.Cloning.Components
|
||||
// Used to prevent as many duplicate UI messages as possible
|
||||
[ViewVariables] public bool UiKnownPowerState = false;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite), DataField("soundCloneStart")]
|
||||
public SoundSpecifier? CloneStartSound = new SoundPathSpecifier("/Audio/Machines/genetics.ogg");
|
||||
|
||||
[ViewVariables]
|
||||
public CloningPodStatus Status;
|
||||
|
||||
@@ -135,13 +139,19 @@ namespace Content.Server.Cloning.Components
|
||||
return; // If we can't track down the client, we can't offer transfer. That'd be quite bad.
|
||||
}
|
||||
|
||||
// Cloning confirmed now.
|
||||
|
||||
var speciesProto = _prototype.Index<SpeciesPrototype>(dna.Profile.Species).Prototype;
|
||||
var mob = _entities.SpawnEntity(speciesProto, _entities.GetComponent<TransformComponent>(Owner).MapPosition);
|
||||
|
||||
|
||||
EntitySystem.Get<SharedHumanoidAppearanceSystem>().UpdateFromProfile(mob, dna.Profile);
|
||||
_entities.GetComponent<MetaDataComponent>(mob).EntityName = dna.Profile.Name;
|
||||
|
||||
// TODO: Ideally client knows about this and plays it on its own
|
||||
// Send them a sound to know it happened
|
||||
if (CloneStartSound != null)
|
||||
SoundSystem.Play(Filter.SinglePlayer(client), CloneStartSound.GetSound());
|
||||
|
||||
var cloneMindReturn = _entities.AddComponent<BeingClonedComponent>(mob);
|
||||
cloneMindReturn.Mind = mind;
|
||||
cloneMindReturn.Parent = Owner;
|
||||
|
||||
BIN
Resources/Audio/Machines/genetics.ogg
Normal file
BIN
Resources/Audio/Machines/genetics.ogg
Normal file
Binary file not shown.
@@ -2,6 +2,8 @@ circuitprinter.ogg taken from https://freesound.org/people/OroborosNZ/sounds/273
|
||||
|
||||
diagnoser_printing.ogg taken from https://freesound.org/people/RobSp1derp1g/sounds/615419/ and edited
|
||||
|
||||
genetics.ogg taken from https://github.com/Citadel-Station-13/Citadel-Station-13-RP/blob/5307e56a25a53fe1b4d34e7f1401ae8dfaa44922/sound/effects/genetics.ogg under CC BY-SA 3.0
|
||||
|
||||
uniformprinter.ogg taken from https://freesound.org/people/sukaton/sounds/60640/ and edited
|
||||
|
||||
vaccinator_running.ogg taken from https://freesound.org/people/RutgerMuller/sounds/365413/ and edited
|
||||
|
||||
Reference in New Issue
Block a user