From d42ef64230f584560f7bd9a9739dd4d7bf60c10b Mon Sep 17 00:00:00 2001
From: CRUNCH <143041327+Fordoxia@users.noreply.github.com>
Date: Mon, 15 Jul 2024 23:00:17 +0100
Subject: [PATCH] [s] Fixes Mechs Protecting Their Pilots From the Crushing
Force of a 2 000 Metric Ton Shuttlecraft. (#26211)
* Update shuttle.dm
* async
* Update code/game/mecha/mecha.dm
Co-authored-by: Matt <116982774+Burzah@users.noreply.github.com>
Signed-off-by: CRUNCH <143041327+Fordoxia@users.noreply.github.com>
---------
Signed-off-by: CRUNCH <143041327+Fordoxia@users.noreply.github.com>
Co-authored-by: Matt <116982774+Burzah@users.noreply.github.com>
---
code/game/mecha/mecha.dm | 12 ++++++++++++
code/modules/shuttle/shuttle.dm | 5 +++++
2 files changed, 17 insertions(+)
diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm
index 0c7d5ca91db..0baadafef15 100644
--- a/code/game/mecha/mecha.dm
+++ b/code/game/mecha/mecha.dm
@@ -1317,6 +1317,18 @@
/obj/mecha/force_eject_occupant(mob/target)
go_out()
+// Called when a shuttle lands on top of the mech. Prevents the mech from just dropping the pilot unharmed inside the shuttle when destroyed.
+/obj/mecha/proc/get_out_and_die()
+ var/mob/living/pilot = occupant
+ pilot.visible_message(
+ "[src] is hit by a hyperspace ripple!",
+ "You feel an immense crushing pressure as the space around you ripples."
+ )
+ go_out(TRUE)
+ if(iscarbon(pilot))
+ pilot.gib()
+ qdel(src)
+
/////////////////////////
////// MARK: Access stuff
/////////////////////////
diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm
index beaf5b25cda..3afeee8ec9f 100644
--- a/code/modules/shuttle/shuttle.dm
+++ b/code/modules/shuttle/shuttle.dm
@@ -640,6 +640,11 @@
var/obj/machinery/atmospherics/supermatter_crystal/bakoom = AM
addtimer(CALLBACK(bakoom, TYPE_PROC_REF(/obj/machinery/atmospherics/supermatter_crystal, explode), bakoom.combined_gas, bakoom.power, bakoom.gasmix_power_ratio), 1 SECONDS)
continue
+ // Your mech will not save you.
+ if(ismecha(AM))
+ var/obj/mecha/mech = AM
+ if(mech.occupant)
+ INVOKE_ASYNC(mech, TYPE_PROC_REF(/obj/mecha, get_out_and_die))
if(ismob(AM))
var/mob/M = AM
if(M.buckled)