From 427a420d51b9968f6f587941fd4d7ee901e8b29b Mon Sep 17 00:00:00 2001 From: Kashargul <144968721+Kashargul@users.noreply.github.com> Date: Thu, 31 Oct 2024 14:13:40 +0100 Subject: [PATCH] fix multiple issues (#9366) --- code/controllers/subsystems/statpanel.dm | 56 +++++++++---------- code/datums/mind.dm | 1 + .../human/species/station/prommie_blob.dm | 2 +- .../human/species/virtual_reality/avatar.dm | 20 ++++--- code/modules/mob/mob_defines.dm | 1 - .../species/station/protean/protean_blob.dm | 2 +- .../code/modules/mob/living/living.dm | 2 +- .../modules/mob/living/simple_mob/teppi.dm | 1 - 8 files changed, 43 insertions(+), 42 deletions(-) diff --git a/code/controllers/subsystems/statpanel.dm b/code/controllers/subsystems/statpanel.dm index 3785596aaa..36d5e1c418 100644 --- a/code/controllers/subsystems/statpanel.dm +++ b/code/controllers/subsystems/statpanel.dm @@ -202,12 +202,12 @@ SUBSYSTEM_DEF(statpanels) return var/list/overrides = list() for(var/image/target_image as anything in target.images) - if(!target_image.loc || target_image.loc.loc != target_mob.listed_turf || !target_image.override) + if(!target_image.loc || target_image.loc.loc != target.tracked_turf || !target_image.override) continue overrides += target_image.loc - var/list/atoms_to_display = list(target_mob.listed_turf) - for(var/atom/movable/turf_content as anything in target_mob.listed_turf) + var/list/atoms_to_display = list(target.tracked_turf) + for(var/atom/movable/turf_content as anything in target.tracked_turf) if(turf_content.mouse_opacity == MOUSE_OPACITY_TRANSPARENT) continue if(turf_content.invisibility > target_mob.see_invisible) @@ -318,12 +318,11 @@ SUBSYSTEM_DEF(statpanels) // Handle turfs - if(target_mob?.listed_turf) - if(!target_mob.TurfAdjacent(target_mob.listed_turf)) - target.stat_panel.send_message("removed_listedturf") - target_mob.listed_turf = null + if(target.tracked_turf) + if(!target_mob.TurfAdjacent(target.tracked_turf)) + target_mob.set_listed_turf(null) - else if(target.stat_tab == target_mob?.listed_turf.name || !(target_mob?.listed_turf.name in target.panel_tabs)) + else if(target.stat_tab == target.tracked_turf.name || !(target.tracked_turf.name in target.panel_tabs)) set_turf_examine_tab(target, target_mob) return TRUE @@ -350,6 +349,8 @@ SUBSYSTEM_DEF(statpanels) /// Stat panel window declaration /client/var/datum/tgui_window/stat_panel +/// Turf examine turf +/client/var/turf/tracked_turf /// Datum that holds and tracks info about a client's object window /// Really only exists because I want to be able to do logic with signals @@ -364,8 +365,6 @@ SUBSYSTEM_DEF(statpanels) var/list/atoms_to_imagify = list() /// Our owner client var/client/parent - /// Are we currently tracking a turf? - var/actively_tracking = FALSE ///For reusing this logic for examines var/atom/examine_target var/flags = 0 @@ -417,28 +416,31 @@ SUBSYSTEM_DEF(statpanels) if(!length(to_make)) return PROCESS_KILL -/datum/object_window_info/proc/start_turf_tracking() - if(actively_tracking) +/datum/object_window_info/proc/start_turf_tracking(turf/new_turf) + if(parent.tracked_turf) stop_turf_tracking() var/static/list/connections = list( COMSIG_MOVABLE_MOVED = PROC_REF(on_mob_move), COMSIG_MOB_LOGOUT = PROC_REF(on_mob_logout), ) AddComponent(/datum/component/connect_mob_behalf, parent, connections) - RegisterSignal(parent.mob.listed_turf, COMSIG_ATOM_ENTERED, PROC_REF(turflist_changed)) - RegisterSignal(parent.mob.listed_turf, COMSIG_ATOM_EXITED, PROC_REF(turflist_changed)) - actively_tracking = TRUE + RegisterSignal(parent.tracked_turf, COMSIG_ATOM_ENTERED, PROC_REF(turflist_changed)) + RegisterSignal(parent.tracked_turf, COMSIG_ATOM_EXITED, PROC_REF(turflist_changed)) + parent.stat_panel.send_message("create_listedturf", new_turf) + parent.tracked_turf = new_turf /datum/object_window_info/proc/stop_turf_tracking() - qdel(GetComponent(/datum/component/connect_mob_behalf)) - UnregisterSignal(parent.mob.listed_turf, COMSIG_ATOM_ENTERED) - UnregisterSignal(parent.mob.listed_turf, COMSIG_ATOM_EXITED) - actively_tracking = FALSE + if(GetComponent(/datum/component/connect_mob_behalf)) + qdel(GetComponent(/datum/component/connect_mob_behalf)) + if(parent.tracked_turf) + UnregisterSignal(parent.tracked_turf, COMSIG_ATOM_ENTERED) + UnregisterSignal(parent.tracked_turf, COMSIG_ATOM_EXITED) + parent.stat_panel.send_message("remove_listedturf") + parent.tracked_turf = null /datum/object_window_info/proc/on_mob_move(mob/source) SIGNAL_HANDLER - var/turf/listed = source.listed_turf - if(!listed || !source.TurfAdjacent(listed)) + if(!parent.tracked_turf || !source.TurfAdjacent(parent.tracked_turf)) source.set_listed_turf(null) /datum/object_window_info/proc/on_mob_logout(mob/source) @@ -465,16 +467,12 @@ SUBSYSTEM_DEF(statpanels) /mob/proc/set_listed_turf(turf/new_turf) if(!client) - listed_turf = new_turf return if(!client.obj_window) client.obj_window = new(client) + if(client.tracked_turf == new_turf) + return if(!new_turf) client.obj_window.stop_turf_tracking() //Needs to go before listed_turf is set to null so signals can be removed - listed_turf = new_turf - - if(listed_turf) - client.stat_panel.send_message("create_listedturf", listed_turf.name) - client.obj_window.start_turf_tracking() - else - client.stat_panel.send_message("remove_listedturf") + return + client.obj_window.start_turf_tracking(new_turf) diff --git a/code/datums/mind.dm b/code/datums/mind.dm index c94edabea5..3ae07590b3 100644 --- a/code/datums/mind.dm +++ b/code/datums/mind.dm @@ -95,6 +95,7 @@ if(new_character.client) new_character.client.init_verbs() // re-initialize character specific verbs + new_character.set_listed_turf(null) /datum/mind/proc/store_memory(new_text) memory += "[new_text]
" diff --git a/code/modules/mob/living/carbon/human/species/station/prommie_blob.dm b/code/modules/mob/living/carbon/human/species/station/prommie_blob.dm index bbdb4af661..3faee829d8 100644 --- a/code/modules/mob/living/carbon/human/species/station/prommie_blob.dm +++ b/code/modules/mob/living/carbon/human/species/station/prommie_blob.dm @@ -446,7 +446,7 @@ blob.mob_radio = R R.forceMove(blob) if(wear_id) - blob.myid = wear_id + blob.myid = wear_id.GetID() wear_id.forceMove(blob) //ChompAdd End //Mail them to nullspace 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 8e772443a6..0c2db4b1f6 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 @@ -125,12 +125,16 @@ var/obj/machinery/vr_sleeper/V = vr_holder.loc V.go_out() +//CHOMPAdd Start 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) + addtimer(CALLBACK(src, PROC_REF(cleanup_vr)), 3000, TIMER_DELETE_ME) //Delete the body after 5 minutes + +/mob/living/carbon/human/proc/cleanup_vr() + 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) +//CHOMPAdd End diff --git a/code/modules/mob/mob_defines.dm b/code/modules/mob/mob_defines.dm index a7e9f2cf34..cf35200cb4 100644 --- a/code/modules/mob/mob_defines.dm +++ b/code/modules/mob/mob_defines.dm @@ -208,7 +208,6 @@ //so don't treat them as being SSD even though their client var is null. var/mob/teleop = null - var/turf/listed_turf = null //the current turf being examined in the stat panel var/list/shouldnt_see = list(/mob/observer/eye) //list of objects that this mob shouldn't see in the stat panel. this silliness is needed because of AI alt+click and cult blood runes var/list/active_genes=list() diff --git a/modular_chomp/code/modules/mob/living/carbon/human/species/station/protean/protean_blob.dm b/modular_chomp/code/modules/mob/living/carbon/human/species/station/protean/protean_blob.dm index ac80b13b8a..ff45e0ab98 100644 --- a/modular_chomp/code/modules/mob/living/carbon/human/species/station/protean/protean_blob.dm +++ b/modular_chomp/code/modules/mob/living/carbon/human/species/station/protean/protean_blob.dm @@ -497,7 +497,7 @@ blob.mob_radio = R R.forceMove(blob) if(wear_id) - blob.myid = wear_id + blob.myid = wear_id.GetID() wear_id.forceMove(blob) //Mail them to nullspace diff --git a/modular_chomp/code/modules/mob/living/living.dm b/modular_chomp/code/modules/mob/living/living.dm index 545f8e9291..6bfe2805aa 100644 --- a/modular_chomp/code/modules/mob/living/living.dm +++ b/modular_chomp/code/modules/mob/living/living.dm @@ -163,7 +163,7 @@ Maybe later, gotta figure out a way to click yourself when in a locker etc. new_mob.vore_organs += B new_mob.nutrition = src.nutrition - src.soulgem.transfer_self(new_mob) //CHOMPAdd Soulcatcher + src.soulgem?.transfer_self(new_mob) //CHOMPAdd Soulcatcher new_mob.ckey = src.ckey if(new_mob.tf_form_ckey) diff --git a/modular_chomp/code/modules/mob/living/simple_mob/teppi.dm b/modular_chomp/code/modules/mob/living/simple_mob/teppi.dm index cf0f1c89d6..96eb9868c7 100644 --- a/modular_chomp/code/modules/mob/living/simple_mob/teppi.dm +++ b/modular_chomp/code/modules/mob/living/simple_mob/teppi.dm @@ -1,3 +1,2 @@ /mob/living/simple_mob/vore/alienanimals/teppi/baby mob_size = MOB_MEDIUM - allow_mind_transfer = TRUE