Skip to content

Fix hard deletes with the prosthetic limb quirk (prolly) #6316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Apr 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions code/datums/quirks/negative_quirks/prosthetic_limb.dm
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
/// the original limb from before the prosthetic was applied
var/obj/item/bodypart/old_limb

/datum/quirk/prosthetic_limb/Destroy()
. = ..()
QDEL_NULL(old_limb)

/datum/quirk/prosthetic_limb/add_unique(client/client_source)
var/limb_type = GLOB.limb_choice[client_source?.prefs?.read_preference(/datum/preference/choiced/prosthetic)]
if(isnull(limb_type)) //Client gone or they chose a random prosthetic
Expand All @@ -26,15 +22,22 @@

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

/datum/quirk/prosthetic_limb/post_add()
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, \
you need to use a welding tool and cables to repair it, instead of sutures and regenerative meshes."))

/datum/quirk/prosthetic_limb/remove()
if(QDELETED(quirk_holder))
QDEL_NULL(old_limb)
return
var/mob/living/carbon/human/human_holder = quirk_holder
human_holder.del_and_replace_bodypart(old_limb, special = TRUE)
if(!QDELETED(quirk_holder))
var/mob/living/carbon/human/human_holder = quirk_holder
human_holder.del_and_replace_bodypart(old_limb, special = TRUE)
clear_old_limb()
else
qdel(old_limb)

/datum/quirk/prosthetic_limb/proc/clear_old_limb()
SIGNAL_HANDLER
UnregisterSignal(old_limb, COMSIG_QDELETING)
old_limb = null
20 changes: 15 additions & 5 deletions monkestation/code/modules/cryopods/_cryopod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -363,18 +363,21 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/computer/cryopod, 32)

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

for(var/obj/item/item_content as anything in mob_occupant)
if(!istype(item_content) || HAS_TRAIT(item_content, TRAIT_NODROP))
mob_occupant.ghostize(can_reenter_corpse = FALSE)
ADD_TRAIT(mob_occupant, TRAIT_NO_TRANSFORM, REF(src))
var/list/items = mob_occupant.get_equipped_items(include_pockets = TRUE)
items |= mob_occupant.held_items
for(var/obj/item/item_content as anything in items)
if(!isitem(item_content) || QDELING(item_content))
continue
if (issilicon(mob_occupant) && istype(item_content, /obj/item/mmi))
if(issilicon(mob_occupant) && istype(item_content, /obj/item/mmi))
continue
if(control_computer)
if(istype(item_content, /obj/item/modular_computer))
var/obj/item/modular_computer/computer = item_content
for(var/datum/computer_file/program/messenger/message_app in computer.stored_files)
message_app.invisible = TRUE
mob_occupant.transferItemToLoc(item_content, control_computer, force = TRUE, silent = TRUE)
item_content.dropped(mob_occupant)
control_computer.frozen_item += item_content
for(var/list/stored as anything in control_computer.frozen_crew)
if(!istype(stored))
Expand All @@ -384,11 +387,18 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/computer/cryopod, 32)
else
mob_occupant.transferItemToLoc(item_content, drop_location(), force = TRUE, silent = TRUE)

if(iscarbon(mob_occupant))
var/mob/living/carbon/carbon_occupant = mob_occupant
for(var/obj/item/organ/organ as anything in carbon_occupant.organs)
if(QDELETED(organ))
continue
organ.Remove(carbon_occupant, special = TRUE)
SSwardrobe.stash_object(organ)

GLOB.joined_player_list -= stored_ckey
GLOB.manifest.general -= crewfile

handle_objectives()
mob_occupant.ghostize()
QDEL_NULL(occupant)
open_machine()
name = initial(name)
Expand Down
Loading