From 4ac8de1f7e17bc4c131ef533a89963b9711cafc6 Mon Sep 17 00:00:00 2001 From: Bib Bob Date: Fri, 23 Sep 2022 10:50:49 -0500 Subject: [PATCH] tags: disposal (of bodies) dead VR bodies auto delete after 5 minutes, no more lag! --- code/modules/mob/living/carbon/human/death.dm | 2 ++ .../carbon/human/species/virtual_reality/avatar.dm | 12 +++++++++++- modular_chomp/code/modules/mob/mob.dm | 3 ++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm index dd816d1e8f..b8e4629299 100644 --- a/code/modules/mob/living/carbon/human/death.dm +++ b/code/modules/mob/living/carbon/human/death.dm @@ -99,11 +99,13 @@ // If the body is in VR, move the mind back to the real world if(vr_holder) + src.died_in_vr = TRUE //CHOMPedit, so avatar.dm can delete bodies src.exit_vr() src.vr_holder.vr_link = null for(var/obj/item/W in src) src.drop_from_inventory(W) + // If our mind is in VR, bring it back to the real world so it can die with its body if(vr_link) vr_link.exit_vr() diff --git a/code/modules/mob/living/carbon/human/species/virtual_reality/avatar.dm b/code/modules/mob/living/carbon/human/species/virtual_reality/avatar.dm index ec054ab520..79a9d5688e 100644 --- a/code/modules/mob/living/carbon/human/species/virtual_reality/avatar.dm +++ b/code/modules/mob/living/carbon/human/species/virtual_reality/avatar.dm @@ -117,4 +117,14 @@ if(istype(vr_holder.loc, /obj/machinery/vr_sleeper)) var/obj/machinery/vr_sleeper/V = vr_holder.loc - V.go_out() \ No newline at end of file + V.go_out() + + if(died_in_vr) + spawn(3000) //Delete the body after 5 minutes to make sure mob subsystem doesn't cry + var/list/slots = list(slot_back,slot_handcuffed,slot_l_store,slot_r_store,slot_wear_mask,slot_l_hand,slot_r_hand,slot_wear_id,slot_glasses,slot_gloves,slot_head,slot_shoes,slot_belt,slot_wear_suit,slot_w_uniform,slot_s_store,slot_l_ear,slot_r_ear) + for(var/slot in slots) + var/obj/item/I = get_equipped_item(slot = slot) + if(I) + unEquip(I,force = TRUE) + release_vore_contents(include_absorbed = TRUE, silent = TRUE) + qdel(src) \ No newline at end of file diff --git a/modular_chomp/code/modules/mob/mob.dm b/modular_chomp/code/modules/mob/mob.dm index ba287eada4..7f23ddff90 100644 --- a/modular_chomp/code/modules/mob/mob.dm +++ b/modular_chomp/code/modules/mob/mob.dm @@ -1,3 +1,4 @@ /mob var/voice_freq = 42500 // Preference for character voice frequency - var/list/voice_sounds_list = list() // The sound list containing our voice sounds! \ No newline at end of file + var/list/voice_sounds_list = list() // The sound list containing our voice sounds! + var/died_in_vr = FALSE //For virtual reality sleepers \ No newline at end of file