Skip to content

Commit

Permalink
[MIRROR] Mech mob deletion fix (#1884)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
2 people authored and StealsThePRs committed Apr 9, 2024
1 parent 002019a commit 86ba259
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions code/modules/vehicles/mecha/_mecha.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions code/modules/vehicles/mecha/mecha_mob_interaction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 86ba259

Please sign in to comment.