[MIRROR] Fixes Abandoned Crates exploding on right click + Code improvements. [MDB IGNORE] (#12020)

* Fixes Abandoned Crates exploding on right click + Code improvements. (#65353)

* Fixes Abandoned Crates exploding on right click + Code improvements.

* requested changes

* removes useless comments

* Fixes Abandoned Crates exploding on right click + Code improvements.

Co-authored-by: BurgerLUA <8602857+BurgerLUA@users.noreply.github.com>
This commit is contained in:
SkyratBot
2022-03-11 17:07:52 -07:00
committed by GitHub
co-authored by BurgerLUA
parent 44586112a3
commit 4e68131c88
+8 -8
View File
@@ -45,6 +45,9 @@
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)
@@ -55,8 +58,9 @@
attempts--
if(attempts == 0)
boom(user)
else
return ..()
return
return ..()
/obj/structure/closet/crate/secure/loot/AltClick(mob/living/user)
if(!user.canUseTopic(src, BE_CLOSE))
@@ -106,18 +110,14 @@
/obj/structure/closet/crate/secure/loot/togglelock(mob/user, silent = FALSE)
if(!locked)
. = ..()
if(locked)
. = ..() //Run the normal code.
if(locked) //Double check if the crate actually locked itself when the normal code ran.
//reset the anti-tampering, number of attempts and last attempt when the lock is re-enabled.
tamperproof = initial(tamperproof)
attempts = initial(attempts)
lastattempt = null
return
if(tamperproof)
boom(user)
return
if (qdel_on_open)
qdel(src)
return
return ..()