[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
🆑 Rhials
fix: Earning the Mimic loot drop from an abandoned crate now properly
spawns the mimic.
/🆑

* Moves loot var to the abandoned crate itself, qdel_on_open now actually qdels on open instead of unlock

Co-authored-by: Rhials <Datguy33456@gmail.com>
This commit is contained in:
SkyratBot
2022-12-08 16:49:11 +01:00
committed by GitHub
parent eddc4a0d13
commit bf8f344f79
+5 -3
View File
@@ -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)