From: brainfood1183 <113240905+brainfood1183@users.noreply.github.com> Date: Sat, 29 Apr 2023 09:50:10 +0000 (+0100) Subject: CloningPod emag effect. (#15876) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=ff58e6462d493cbaef3194ada2c23beff0394bf1;p=space-station-14.git CloningPod emag effect. (#15876) Co-authored-by: metalgearsloth --- diff --git a/Content.Server/Cloning/CloningSystem.cs b/Content.Server/Cloning/CloningSystem.cs index 0483a50d9d..c98fa51803 100644 --- a/Content.Server/Cloning/CloningSystem.cs +++ b/Content.Server/Cloning/CloningSystem.cs @@ -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 ClonesWaitingForMind = new(); public const float EasyModeCloningCost = 0.7f; @@ -70,6 +78,7 @@ namespace Content.Server.Cloning SubscribeLocalEvent(OnPortDisconnected); SubscribeLocalEvent(OnAnchor); SubscribeLocalEvent(OnExamined); + SubscribeLocalEvent(OnEmagged); } private void OnComponentInit(EntityUid uid, CloningPodComponent clonePod, ComponentInit args) @@ -280,6 +289,19 @@ namespace Content.Server.Cloning } } + /// + /// On emag, spawns a failed clone when cloning process fails which attacks nearby crew. + /// + 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(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(uid)) + { _material.SpawnMultipleFromMaterial(_robustRandom.Next(1, (int) (clonePod.UsedBiomass / 2.5)), clonePod.RequiredMaterial, Transform(uid).Coordinates); + } clonePod.UsedBiomass = 0; RemCompDeferred(uid); diff --git a/Content.Server/Cloning/Components/CloningPodComponent.cs b/Content.Server/Cloning/Components/CloningPodComponent.cs index 97b276b8d0..30674856aa 100644 --- a/Content.Server/Cloning/Components/CloningPodComponent.cs +++ b/Content.Server/Cloning/Components/CloningPodComponent.cs @@ -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; + /// + /// The mob to spawn on emag + /// + [ViewVariables(VVAccess.ReadWrite), DataField("mobSpawnId", customTypeSerializer: typeof(PrototypeIdSerializer))] + public string MobSpawnId = "MobAbomination"; + + /// + /// Emag sound effects. + /// + [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), + }; + /// /// The machine part that affects how much biomass is needed to clone a body. /// diff --git a/Resources/Locale/en-US/medical/components/cloning-pod-component.ftl b/Resources/Locale/en-US/medical/components/cloning-pod-component.ftl index 81f9778e5e..e92ac86a1e 100644 --- a/Resources/Locale/en-US/medical/components/cloning-pod-component.ftl +++ b/Resources/Locale/en-US/medical/components/cloning-pod-component.ftl @@ -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. diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/flesh.yml b/Resources/Prototypes/Entities/Mobs/NPCs/flesh.yml index 9c98789536..eabbc68c0b 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/flesh.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/flesh.yml @@ -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 diff --git a/Resources/Textures/Mobs/Demons/abomination.rsi/abomination.png b/Resources/Textures/Mobs/Demons/abomination.rsi/abomination.png new file mode 100644 index 0000000000..1444ab4523 Binary files /dev/null and b/Resources/Textures/Mobs/Demons/abomination.rsi/abomination.png differ diff --git a/Resources/Textures/Mobs/Demons/abomination.rsi/dead.png b/Resources/Textures/Mobs/Demons/abomination.rsi/dead.png new file mode 100644 index 0000000000..8630df12ec Binary files /dev/null and b/Resources/Textures/Mobs/Demons/abomination.rsi/dead.png differ diff --git a/Resources/Textures/Mobs/Demons/abomination.rsi/meta.json b/Resources/Textures/Mobs/Demons/abomination.rsi/meta.json new file mode 100644 index 0000000000..d40e2c53fb --- /dev/null +++ b/Resources/Textures/Mobs/Demons/abomination.rsi/meta.json @@ -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 + } + ] +} \ No newline at end of file