diff --git a/code/modules/mining/abandonedcrates.dm b/code/modules/mining/abandonedcrates.dm
index 9102af9e0ab..3e9580ef14b 100644
--- a/code/modules/mining/abandonedcrates.dm
+++ b/code/modules/mining/abandonedcrates.dm
@@ -179,6 +179,7 @@
if(locked)
if(istype(W, /obj/item/weapon/card/emag))
boom(user)
+ return 1
if(istype(W, /obj/item/device/multitool))
to_chat(user, "DECA-CODE LOCK REPORT:")
if(attempts == 1)
@@ -186,30 +187,24 @@
else
to_chat(user, "* Anti-Tamper Bomb will activate after [src.attempts] failed access attempts.")
if(lastattempt != null)
- var/guess = lastattempt
var/bulls = 0
var/cows = 0
var/list/banned = list()
- for(var/i; i <= length(lastattempt); i++)
- var/list/a = strip_first(guess)
- if(a[1] in banned)
+ for(var/i in 1 to codelen)
+ var/list/a = copytext(lastattempt, i, i + 1)
+ if(a in banned)
continue
- if(findtext(a[2], a[1]))
- if(findtext(code, a[1], i, i+1))
+ var/g = findtext(code, a)
+ if(g)
+ banned += a
+ if(g == i)
++bulls
- banned += a[1]
- else
- var/g = findtext(code, a[1])
- if(g)
- if(g == i)
- ++bulls
- else
- ++cows
- guess = a[2]
+ else
+ ++cows
to_chat(user, "Last code attempt had [bulls] correct digits at correct positions and [cows] correct digits at incorrect positions.")
- else ..()
- else ..()
+ return 1
+ return ..()
/obj/structure/closet/crate/secure/loot/togglelock(mob/user)
if(locked)