From bf8f344f79e5138a626d64f2ddec255d78990cb5 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Thu, 8 Dec 2022 16:49:11 +0100 Subject: [PATCH] [MIRROR] Moves loot var to the abandoned crate itself, qdel_on_open now actually qdels on open instead of unlock [MDB IGNORE] (#17972) * Moves loot var to the abandoned crate itself, qdel_on_open now actually qdels on open instead of unlock (#71723) ## About The Pull Request This stupid var is should have been called "qdel_on_unlock". Now it actually triggers on open, and qdels AFTER all of the contents in the crate are gone. This prevents it from deleting its contents before it can dump them, which I'm assuming it has been doing since the dawn of time. ## Why It's Good For The Game Closes #71718 Makes it so admins can set the loot for abandoned crates or peek into their contents, for whatever reason they may have. Also allows coders to choose which loot to recieve in the event that a bug like this needs debugging (again). ## Changelog :cl: Rhials fix: Earning the Mimic loot drop from an abandoned crate now properly spawns the mimic. /:cl: * Moves loot var to the abandoned crate itself, qdel_on_open now actually qdels on open instead of unlock Co-authored-by: Rhials --- code/modules/mining/abandoned_crates.dm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/code/modules/mining/abandoned_crates.dm b/code/modules/mining/abandoned_crates.dm index fa884ea9b0e..922d03043bb 100644 --- a/code/modules/mining/abandoned_crates.dm +++ b/code/modules/mining/abandoned_crates.dm @@ -45,9 +45,6 @@ if(input == code) if(!spawned_loot) spawn_loot() - if(qdel_on_open) - qdel(src) - return tamperproof = 0 // set explosion chance to zero, so we dont accidently hit it with a multitool and instantly die togglelock(user) else if(!input || !sanitycheck || length(sanitised) != codelen) @@ -127,6 +124,11 @@ return return ..() +/obj/structure/closet/crate/secure/loot/open(mob/living/user, force = FALSE) + . = ..() + if(qdel_on_open) + qdel(src) + /obj/structure/closet/crate/secure/loot/proc/spawn_loot() var/loot = rand(1,100) //100 different crates with varying chances of spawning switch(loot)