anchor.diff:  		code += dig
   		digits -= dig  //there are never matching digits in the answer
   
  +//ATTACK HAND IGNORING PARENT RETURN VALUE
  +/obj/structure/closet/crate/secure/loot/attack_hand(mob/user)
  +	if(locked)
  +		to_chat(user, "<span class='notice'>The crate is locked with a Deca-code lock.</span>")
  +		var/input = input(usr, "Enter [codelen] digits. All digits must be unique.", "Deca-Code Lock", "") as text|null
  +		if(user.canUseTopic(src, BE_CLOSE))
  +			var/list/sanitised = list()
  +			var/sanitycheck = 1
  +			for(var/i=1,i<=length(input),i++) //put the guess into a list
  +				sanitised += text2num(copytext(input,i,i+1))
  +			for(var/i=1,i<=(length(input)-1),i++) //compare each digit in the guess to all those following it
  +				for(var/j=(i+1),j<=length(input),j++)
  +					if(sanitised[i] == sanitised[j])
  +						sanitycheck = null //if a digit is repeated, reject the input
  +			if (input == code)
  +				to_chat(user, "<span class='notice'>The crate unlocks!</span>")
  +				locked = FALSE
  +				cut_overlays()
  +				add_overlay("securecrateg")
  +				tamperproof = 0 // set explosion chance to zero, so we dont accidently hit it with a multitool and instantly die
  +				if(!spawned_loot)
  +					spawn_loot()
  +			else if (input == null || sanitycheck == null || length(input) != codelen)
  +				to_chat(user, "<span class='notice'>You leave the crate alone.</span>")
  +			else
  +				to_chat(user, "<span class='warning'>A red light flashes.</span>")
  +				lastattempt = input
  +				attempts--
  +				if(attempts == 0)
  +					boom(user)
  +	else
  +		return ..()
  +
  +/obj/structure/closet/crate/secure/loot/AltClick(mob/living/user)
  +	if(!user.canUseTopic(src, BE_CLOSE))
  +		return
  +	return attack_hand(user) //this helps you not blow up so easily by overriding unlocking which results in an immediate boom.
  +
  +/obj/structure/closet/crate/secure/loot/attackby(obj/item/W, mob/user)
  +	if(locked)
  +		if(W.tool_behaviour == TOOL_MULTITOOL)
  +			to_chat(user, "<span class='notice'>DECA-CODE LOCK REPORT:</span>")
  +			if(attempts == 1)
  +				to_chat(user, "<span class='warning'>* Anti-Tamper Bomb will activate on next failed access attempt.</span>")
  +			else
  +				to_chat(user, "<span class='notice'>* Anti-Tamper Bomb will activate after [attempts] failed access attempts.</span>")
  +			if(lastattempt != null)
  +				var/list/guess = list()
  +				var/list/answer = list()
  +				var/bulls = 0
  +				var/cows = 0
  +				for(var/i=1,i<=length(lastattempt),i++)
  +					guess += text2num(copytext(lastattempt,i,i+1))
  +				for(var/i=1,i<=length(lastattempt),i++)
  +					answer += text2num(copytext(code,i,i+1))
  +				for(var/i = 1, i < codelen + 1, i++) // Go through list and count matches
  +					if( answer.Find(guess[i],1,codelen+1))
  +						++cows
  +					if( answer[i] == guess[i])
  +						++bulls
  +						--cows
  +
  +				to_chat(user, "<span class='notice'>Last code attempt, [lastattempt], had [bulls] correct digits at correct positions and [cows] correct digits at incorrect positions.</span>")
  +			return
  +	return ..()
  +
  +/obj/structure/closet/secure/loot/dive_into(mob/living/user)
  +	if(!locked)
  +		return ..()
  +	to_chat(user, "<span class='notice'>That seems like a stupid idea.</span>")
  +	return FALSE
  +
  +/obj/structure/closet/crate/secure/loot/emag_act(mob/user)
  +	if(locked)
  +		boom(user)
  +
  +/obj/structure/closet/crate/secure/loot/togglelock(mob/user)
  +	if(locked)
  +		boom(user)
  +	else
  +		if (qdel_on_open)
  +			qdel(src)
  +		..()
  +
  +/obj/structure/closet/crate/secure/loot/deconstruct(disassembled = TRUE)
  +	boom()
  +
  +/obj/structure/closet/crate/secure/loot/proc/spawn_loot()
   	var/loot = rand(1,100) //100 different crates with varying chances of spawning
   	switch(loot)
   		if(1 to 5) //5% chance
  
positive.code: 			new /obj/item/reagent_containers/food/drinks/bottle/whiskey(src)
  			new /obj/item/lighter(src)
  			new /obj/item/reagent_containers/food/drinks/bottle/absinthe/premium(src)
  			new /obj/item/clothing/mask/cigarette/rollie(src)
  			new /obj/item/clothing/mask/cigarette/rollie(src)
  			new /obj/item/clothing/mask/cigarette/rollie(src)
  		if(6 to 10)
  			new /obj/item/melee/skateboard/pro(src)
  		if(11 to 15)
  
negative.code: 	var/attempts = 10
  	var/codelen = 4
  	var/qdel_on_open = FALSE
  	var/spawned_loot = FALSE
  	tamperproof = 90
  
  /obj/structure/closet/crate/secure/loot/Initialize()
  