From 86ba25992c88cd4979bc5e43f097718775fb5e0e Mon Sep 17 00:00:00 2001 From: NovaBot <154629622+NovaBot13@users.noreply.github.com> Date: Tue, 9 Apr 2024 06:53:39 -0400 Subject: [PATCH] [MIRROR] Mech mob deletion fix (#1884) * Mech mob deletion fix (#82415) ## About The Pull Request If the occupant of a mech has their mob changed -- mutation, polymorph, admin fuckery -- or if a mob somehow enters a mech without becoming an occupant -- the above, or a chestburster in said mech pilot -- then they don't get added to the occupants, only the contents. All contents are hard-deleted if a mech is destroyed. This fixes that, and ejects any mobs inside mechs who are technically inside the mech but not an occupant. ## Why It's Good For The Game Fixes #82395 and any similar case ## Changelog Being inside a mech when it's destroyed should no longer delete you, even if you ended up in that mech in an odd way. :cl: Bisar fix: Mechs will no longer delete their living non-occupant contents when destroyed. /:cl: * Mech mob deletion fix --------- Co-authored-by: Joshua Kidder <49173900+Metekillot@users.noreply.github.com> --- code/modules/vehicles/mecha/_mecha.dm | 8 ++++++-- code/modules/vehicles/mecha/mecha_mob_interaction.dm | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm index a64bd4d1c37..7cee1b6541c 100644 --- a/code/modules/vehicles/mecha/_mecha.dm +++ b/code/modules/vehicles/mecha/_mecha.dm @@ -269,8 +269,12 @@ AddElement(/datum/element/hostile_machine) /obj/vehicle/sealed/mecha/Destroy() - for(var/ejectee in occupants) - mob_exit(ejectee, silent = TRUE) + /// If the former occupants get polymorphed, mutated, chestburstered, + /// or otherwise replaced by another mob, that mob is no longer in .occupants + /// and gets deleted with the mech. However, they do remain in .contents + var/list/potential_occupants = contents ^ occupants + for(var/mob/buggy_ejectee in potential_occupants) + mob_exit(buggy_ejectee, silent = TRUE) if(LAZYLEN(flat_equipment)) for(var/obj/item/mecha_parts/mecha_equipment/equip as anything in flat_equipment) diff --git a/code/modules/vehicles/mecha/mecha_mob_interaction.dm b/code/modules/vehicles/mecha/mecha_mob_interaction.dm index e9d7f5a1e1f..7accab008f1 100644 --- a/code/modules/vehicles/mecha/mecha_mob_interaction.dm +++ b/code/modules/vehicles/mecha/mecha_mob_interaction.dm @@ -139,6 +139,8 @@ mob_container = AI newloc = get_turf(AI.linked_core) qdel(AI.linked_core) + else if(isliving(M)) + mob_container = M else return ..() var/mob/living/ejector = M