using Content.Server.Materials;
using Content.Server.Stack;
using Content.Server.Jobs;
+using Content.Shared.Emag.Components;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Zombies;
using Robust.Shared.Containers;
using Robust.Shared.Physics.Components;
using Content.Shared.Humanoid;
+using Content.Shared.Doors.Components;
+using Content.Shared.Emag.Systems;
+using Robust.Shared.Audio;
+using System.Runtime.InteropServices;
+using Content.Server.Popups;
namespace Content.Server.Cloning
{
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly PuddleSystem _puddleSystem = default!;
[Dependency] private readonly ChatSystem _chatSystem = default!;
+ [Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly IConfigurationManager _configManager = default!;
[Dependency] private readonly MaterialStorageSystem _material = default!;
+ [Dependency] private readonly PopupSystem _popupSystem = default!;
public readonly Dictionary<Mind.Mind, EntityUid> ClonesWaitingForMind = new();
public const float EasyModeCloningCost = 0.7f;
SubscribeLocalEvent<CloningPodComponent, PortDisconnectedEvent>(OnPortDisconnected);
SubscribeLocalEvent<CloningPodComponent, AnchorStateChangedEvent>(OnAnchor);
SubscribeLocalEvent<CloningPodComponent, ExaminedEvent>(OnExamined);
+ SubscribeLocalEvent<CloningPodComponent, GotEmaggedEvent>(OnEmagged);
}
private void OnComponentInit(EntityUid uid, CloningPodComponent clonePod, ComponentInit args)
}
}
+ /// <summary>
+ /// On emag, spawns a failed clone when cloning process fails which attacks nearby crew.
+ /// </summary>
+ private void OnEmagged(EntityUid uid, CloningPodComponent clonePod, ref GotEmaggedEvent args)
+ {
+ if (!this.IsPowered(uid, EntityManager))
+ return;
+
+ _audio.PlayPvs(clonePod.SparkSound, uid);
+ _popupSystem.PopupEntity(Loc.GetString("cloning-pod-component-upgrade-emag-requirement"), uid);
+ args.Handled = true;
+ }
+
public void Eject(EntityUid uid, CloningPodComponent? clonePod)
{
if (!Resolve(uid, ref clonePod))
var tileMix = _atmosphereSystem.GetTileMixture(transform.GridUid, null, indices, true);
+ if (HasComp<EmaggedComponent>(uid))
+ {
+ _audio.PlayPvs(clonePod.ScreamSound, uid);
+ Spawn(clonePod.MobSpawnId, transform.Coordinates);
+ }
+
Solution bloodSolution = new();
int i = 0;
}
_puddleSystem.TrySpillAt(uid, bloodSolution, out _);
+ if (!HasComp<EmaggedComponent>(uid))
+ {
_material.SpawnMultipleFromMaterial(_robustRandom.Next(1, (int) (clonePod.UsedBiomass / 2.5)), clonePod.RequiredMaterial, Transform(uid).Coordinates);
+ }
clonePod.UsedBiomass = 0;
RemCompDeferred<ActiveCloningPodComponent>(uid);
using Content.Shared.Cloning;
using Content.Shared.Construction.Prototypes;
using Content.Shared.Materials;
+using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
[ViewVariables(VVAccess.ReadWrite)]
public float CloningTime = 30f;
+ /// <summary>
+ /// The mob to spawn on emag
+ /// </summary>
+ [ViewVariables(VVAccess.ReadWrite), DataField("mobSpawnId", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
+ public string MobSpawnId = "MobAbomination";
+
+ /// <summary>
+ /// Emag sound effects.
+ /// </summary>
+ [DataField("sparkSound")]
+ public SoundSpecifier SparkSound = new SoundCollectionSpecifier("sparks")
+ {
+ Params = AudioParams.Default.WithVolume(8),
+ };
+
+ [DataField("screamSound")]
+ public SoundSpecifier ScreamSound = new SoundCollectionSpecifier("ZombieScreams")
+ {
+ Params = AudioParams.Default.WithVolume(4),
+ };
+
/// <summary>
/// The machine part that affects how much biomass is needed to clone a body.
/// </summary>