CloningPod emag effect. (#15876)

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
brainfood1183
2023-04-29 10:50:10 +01:00
committed by GitHub
parent a4f77b7376
commit ff58e6462d
7 changed files with 111 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ using Content.Server.Construction;
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;
@@ -32,6 +33,11 @@ using Robust.Shared.Configuration;
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
{
@@ -52,8 +58,10 @@ 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;
@@ -70,6 +78,7 @@ namespace Content.Server.Cloning
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)
@@ -280,6 +289,19 @@ namespace Content.Server.Cloning
}
}
/// <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))
@@ -306,6 +328,12 @@ namespace Content.Server.Cloning
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;
@@ -318,7 +346,10 @@ namespace Content.Server.Cloning
}
_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);

View File

@@ -1,6 +1,7 @@
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;
@@ -57,6 +58,27 @@ namespace Content.Server.Cloning.Components
[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>

View File

@@ -2,3 +2,4 @@ cloning-pod-biomass = It currently has [color=red]{$number}[/color] units of bio
cloning-pod-component-upgrade-speed = cloning speed
cloning-pod-component-upgrade-biomass-requirement = biomass requirement
cloning-pod-component-upgrade-emag-requirement = The card zaps something inside the cloning pod.

View File

@@ -154,3 +154,42 @@
- type: MovementSpeedModifier
baseWalkSpeed: 2
baseSprintSpeed: 2.5
- type: entity
parent: BaseMobFlesh
id: MobAbomination
name: abomination
description: A rejected clone, in constant pain and seeking revenge.
components:
- type: Sprite
drawdepth: Mobs
sprite: Mobs/Demons/abomination.rsi
layers:
- map: ["enum.DamageStateVisualLayers.Base"]
state: abomination
- type: DamageStateVisuals
states:
Alive:
Base: abomination
Dead:
Base: dead
- type: MobState
allowedStates:
- Alive
- Dead
- type: MobThresholds
thresholds:
0: Alive
100: Dead
- type: MovementSpeedModifier
baseWalkSpeed: 1.5
baseSprintSpeed: 2.5
- type: MeleeWeapon
hidden: true
soundHit:
path: /Audio/Weapons/Xeno/alien_claw_flesh3.ogg
angle: 0
animation: WeaponArcClaw
damage:
types:
Blunt: 10

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@@ -0,0 +1,18 @@
{
"version": 1,
"size": {
"x": 32,
"y": 32
},
"license": "CC-BY-SA-3.0",
"copyright": "Made by brainfood1183 (github) for ss14",
"states": [
{
"name": "dead"
},
{
"name": "abomination",
"directions": 4
}
]
}