diff --git a/code/_onclick/hud/screen_objects.dm b/code/_onclick/hud/screen_objects.dm index f92a2f2bb09..726cfec6a11 100644 --- a/code/_onclick/hud/screen_objects.dm +++ b/code/_onclick/hud/screen_objects.dm @@ -15,10 +15,26 @@ var/datum/hud/hud = null // A reference to the owner HUD, if any. appearance_flags = NO_CLIENT_COLOR +/obj/screen/Initialize(mapload, ...) + . = ..() + //This is done with signals because the screen code sucks, blame the ancient developers + if(hud) + RegisterSignal(hud, COMSIG_QDELETING, PROC_REF(handle_hud_destruction)) + /obj/screen/Destroy(force = FALSE) master = null screen_loc = null - return ..() + hud = null + . = ..() + +/** + * Handles the deletion of the HUD this screen is associated to + */ +/obj/screen/proc/handle_hud_destruction() + SIGNAL_HANDLER + + UnregisterSignal(hud, COMSIG_QDELETING) + qdel(src) /obj/screen/text icon = null diff --git a/code/controllers/subsystems/mob.dm b/code/controllers/subsystems/mob.dm index 8b016fcbb29..b1800bb888f 100644 --- a/code/controllers/subsystems/mob.dm +++ b/code/controllers/subsystems/mob.dm @@ -41,6 +41,11 @@ SUBSYSTEM_DEF(mobs) /mob/living/simple_animal/penguin/holodeck ) + /** + * An associative list containing timer IDs associated with a mannequin that they're supposed to delete + */ + var/list/mannequins_del_timers = list() + /datum/controller/subsystem/mobs/Initialize() // Some setup work for the eat-types lists. mtl_synthetic = typecacheof(mtl_synthetic) + list( @@ -119,13 +124,38 @@ SUBSYSTEM_DEF(mobs) . = new /mob/living/carbon/human/dummy/mannequin mannequins[ckey] = . - addtimer(CALLBACK(src, PROC_REF(del_mannequin), ckey), 5 MINUTES, TIMER_UNIQUE | TIMER_OVERRIDE) + mannequins_del_timers[ckey] = addtimer(CALLBACK(src, PROC_REF(del_mannequin), ckey), 5 MINUTES, TIMER_UNIQUE | TIMER_OVERRIDE | TIMER_STOPPABLE) /datum/controller/subsystem/mobs/proc/del_mannequin(ckey) var/mannequin = mannequins[ckey] - qdel(mannequin) + mannequins[ckey] = null mannequins -= ckey + //Remove the deletion timer, if it exists + if(mannequins_del_timers[ckey]) + deltimer(mannequins_del_timers[ckey]) + mannequins_del_timers[ckey] = null + mannequins_del_timers -= ckey + + qdel(mannequin) + +/** + * Used to dereference a mannequin, does not delete it per-se + * + * * the_mannequin - A `/mob/living/carbon/human/dummy/mannequin` to search for, and dereference if found + */ +/datum/controller/subsystem/mobs/proc/free_mannequin(mob/living/carbon/human/dummy/mannequin/the_mannequin) + for(var/ckey in mannequins) + if(mannequins[ckey] == the_mannequin) + mannequins[ckey] = null + mannequins -= ckey + + //Remove the deletion timer, if it exists + if(mannequins_del_timers[ckey]) + deltimer(mannequins_del_timers[ckey]) + mannequins_del_timers[ckey] = null + mannequins_del_timers -= ckey + // Helper so PROCESS_KILL works. /datum/controller/subsystem/mobs/proc/stop_processing(datum/D) STOP_PROCESSING(src, D) diff --git a/code/modules/admin/verbs/modifyvariables.dm b/code/modules/admin/verbs/modifyvariables.dm index 86e367c0707..40e15ff3ebf 100644 --- a/code/modules/admin/verbs/modifyvariables.dm +++ b/code/modules/admin/verbs/modifyvariables.dm @@ -211,8 +211,13 @@ var/list/VVdynamic_lock = list( if(!check_rights(R_SPAWN|R_DEBUG|R_DEV)) return if(variable in VVicon_edit_lock) if(!check_rights(R_FUN|R_DEBUG|R_DEV)) return - if(VVdynamic_lock[variable]) - if(!check_rights(VVdynamic_lock[variable])) return + + if(isnum(variable)) + if((length(VVdynamic_lock) < variable) && VVdynamic_lock.Find(variable)) + if(!check_rights(VVdynamic_lock[variable])) return + else + if(VVdynamic_lock[variable]) + if(!check_rights(VVdynamic_lock[variable])) return if(isnull(variable)) to_chat(usr, "Unable to determine variable type.") diff --git a/code/modules/mob/living/carbon/human/human_species.dm b/code/modules/mob/living/carbon/human/human_species.dm index d685b69650c..d0724252151 100644 --- a/code/modules/mob/living/carbon/human/human_species.dm +++ b/code/modules/mob/living/carbon/human/human_species.dm @@ -17,6 +17,10 @@ INITIALIZE_IMMEDIATE(/mob/living/carbon/human/dummy/mannequin) GLOB.human_mob_list -= src delete_inventory() +/mob/living/carbon/human/dummy/mannequin/Destroy() + SSmobs.free_mannequin(src) + . = ..() + /mob/living/carbon/human/vatgrown/Initialize(mapload) . = ..(mapload, SPECIES_HUMAN_VATGROWN) mob_thinks = FALSE diff --git a/html/changelogs/fluffyghost-fixmannequinharddelandmore.yml b/html/changelogs/fluffyghost-fixmannequinharddelandmore.yml new file mode 100644 index 00000000000..364dc2edd3c --- /dev/null +++ b/html/changelogs/fluffyghost-fixmannequinharddelandmore.yml @@ -0,0 +1,43 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: FluffyGhost + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Attempted fix to mannequins harddeling." + - bugfix: "Attempted fix to some HUDs harddeling because screens were still referencing them." + - bugfix: "Fixed ability for VV to edit lists."