Skip to content

Commit 7e69648

Browse files
authored
Fix hard deletes with the prosthetic limb quirk (prolly) (#6316)
1 parent 4aa073a commit 7e69648

File tree

2 files changed

+27
-14
lines changed

2 files changed

+27
-14
lines changed

code/datums/quirks/negative_quirks/prosthetic_limb.dm

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@
1111
/// the original limb from before the prosthetic was applied
1212
var/obj/item/bodypart/old_limb
1313

14-
/datum/quirk/prosthetic_limb/Destroy()
15-
. = ..()
16-
QDEL_NULL(old_limb)
17-
1814
/datum/quirk/prosthetic_limb/add_unique(client/client_source)
1915
var/limb_type = GLOB.limb_choice[client_source?.prefs?.read_preference(/datum/preference/choiced/prosthetic)]
2016
if(isnull(limb_type)) //Client gone or they chose a random prosthetic
@@ -26,15 +22,22 @@
2622

2723
medical_record_text = "Patient uses a low-budget prosthetic on the [slot_string]."
2824
old_limb = human_holder.return_and_replace_bodypart(surplus, special = TRUE)
25+
if(!isnull(old_limb))
26+
RegisterSignal(old_limb, COMSIG_QDELETING, PROC_REF(clear_old_limb))
2927

3028
/datum/quirk/prosthetic_limb/post_add()
3129
to_chat(quirk_holder, span_boldannounce("Your [slot_string] has been replaced with a surplus prosthetic. It is fragile and will easily come apart under duress. Additionally, \
3230
you need to use a welding tool and cables to repair it, instead of sutures and regenerative meshes."))
3331

3432
/datum/quirk/prosthetic_limb/remove()
35-
if(QDELETED(quirk_holder))
36-
QDEL_NULL(old_limb)
37-
return
38-
var/mob/living/carbon/human/human_holder = quirk_holder
39-
human_holder.del_and_replace_bodypart(old_limb, special = TRUE)
33+
if(!QDELETED(quirk_holder))
34+
var/mob/living/carbon/human/human_holder = quirk_holder
35+
human_holder.del_and_replace_bodypart(old_limb, special = TRUE)
36+
clear_old_limb()
37+
else
38+
qdel(old_limb)
39+
40+
/datum/quirk/prosthetic_limb/proc/clear_old_limb()
41+
SIGNAL_HANDLER
42+
UnregisterSignal(old_limb, COMSIG_QDELETING)
4043
old_limb = null

monkestation/code/modules/cryopods/_cryopod.dm

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,18 +363,21 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/computer/cryopod, 32)
363363

364364
visible_message(span_notice("[src] hums and hisses as it moves [mob_occupant.real_name] into storage."))
365365

366-
for(var/obj/item/item_content as anything in mob_occupant)
367-
if(!istype(item_content) || HAS_TRAIT(item_content, TRAIT_NODROP))
366+
mob_occupant.ghostize(can_reenter_corpse = FALSE)
367+
ADD_TRAIT(mob_occupant, TRAIT_NO_TRANSFORM, REF(src))
368+
var/list/items = mob_occupant.get_equipped_items(include_pockets = TRUE)
369+
items |= mob_occupant.held_items
370+
for(var/obj/item/item_content as anything in items)
371+
if(!isitem(item_content) || QDELING(item_content))
368372
continue
369-
if (issilicon(mob_occupant) && istype(item_content, /obj/item/mmi))
373+
if(issilicon(mob_occupant) && istype(item_content, /obj/item/mmi))
370374
continue
371375
if(control_computer)
372376
if(istype(item_content, /obj/item/modular_computer))
373377
var/obj/item/modular_computer/computer = item_content
374378
for(var/datum/computer_file/program/messenger/message_app in computer.stored_files)
375379
message_app.invisible = TRUE
376380
mob_occupant.transferItemToLoc(item_content, control_computer, force = TRUE, silent = TRUE)
377-
item_content.dropped(mob_occupant)
378381
control_computer.frozen_item += item_content
379382
for(var/list/stored as anything in control_computer.frozen_crew)
380383
if(!istype(stored))
@@ -384,11 +387,18 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/computer/cryopod, 32)
384387
else
385388
mob_occupant.transferItemToLoc(item_content, drop_location(), force = TRUE, silent = TRUE)
386389

390+
if(iscarbon(mob_occupant))
391+
var/mob/living/carbon/carbon_occupant = mob_occupant
392+
for(var/obj/item/organ/organ as anything in carbon_occupant.organs)
393+
if(QDELETED(organ))
394+
continue
395+
organ.Remove(carbon_occupant, special = TRUE)
396+
SSwardrobe.stash_object(organ)
397+
387398
GLOB.joined_player_list -= stored_ckey
388399
GLOB.manifest.general -= crewfile
389400

390401
handle_objectives()
391-
mob_occupant.ghostize()
392402
QDEL_NULL(occupant)
393403
open_machine()
394404
name = initial(name)

0 commit comments

Comments
 (0)