]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
CloningPod emag effect. (#15876)
authorbrainfood1183 <113240905+brainfood1183@users.noreply.github.com>
Sat, 29 Apr 2023 09:50:10 +0000 (10:50 +0100)
committerGitHub <noreply@github.com>
Sat, 29 Apr 2023 09:50:10 +0000 (19:50 +1000)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
Content.Server/Cloning/CloningSystem.cs
Content.Server/Cloning/Components/CloningPodComponent.cs
Resources/Locale/en-US/medical/components/cloning-pod-component.ftl
Resources/Prototypes/Entities/Mobs/NPCs/flesh.yml
Resources/Textures/Mobs/Demons/abomination.rsi/abomination.png [new file with mode: 0644]
Resources/Textures/Mobs/Demons/abomination.rsi/dead.png [new file with mode: 0644]
Resources/Textures/Mobs/Demons/abomination.rsi/meta.json [new file with mode: 0644]

index 0483a50d9d3a1392819943ca5c1d503c093d7860..c98fa518036fdae2b4e10bcff80c42fcf175d6e5 100644 (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);
index 97b276b8d062e1bea99e16157a7f24feee94cd4d..30674856aa117c9776e1dd72f87d15ab187325d2 100644 (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>
index 81f9778e5e1a605051ba233a2b6746fc7b59411a..e92ac86a1e4caabadcd3021da0e319fa0e96c385 100644 (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.
index 9c987895369c6a1d56f1bc29dca2ad280d9d9dcf..eabbc68c0bd7c5fa5c90137776f4b468579d8301 100644 (file)
   - 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 (file)
index 0000000..1444ab4
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 (file)
index 0000000..8630df1
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 (file)
index 0000000..d40e2c5
--- /dev/null
@@ -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