Revert "12/21 modernizations from TG live"

This commit is contained in:
LetterJay
2016-12-22 22:35:44 -06:00
committed by GitHub
parent cf59ac1c3d
commit ae40d4134e
2215 changed files with 86928 additions and 707332 deletions
+30 -34
View File
@@ -4,21 +4,19 @@
name = "abandoned crate"
desc = "What could be inside?"
icon_state = "securecrate"
integrity_failure = 0 //no breaking open the crate
var/code = null
var/lastattempt = null
var/attempts = 10
var/codelen = 4
tamperproof = 90
/obj/structure/closet/crate/secure/loot/New()
..()
var/list/digits = list("1", "2", "3", "4", "5", "6", "7", "8", "9", "0")
var/list/digits = list("1", "2", "3", "4", "5", "6", "7", "8", "9", "z")
code = ""
for(var/i = 0, i < codelen, i++)
var/dig = pick(digits)
code += dig
digits -= dig //there are never matching digits in the answer
digits -= dig //Player can enter codes with matching digits, but there are never matching digits in the answer
var/loot = rand(1,100) //100 different crates with varying chances of spawning
switch(loot)
@@ -47,7 +45,7 @@
for(var/i in 1 to 3)
new /obj/item/weapon/reagent_containers/glass/beaker/noreact(src)
if(31 to 35)
new /obj/item/seeds/firelemon(src)
new /obj/item/seeds/cash(src)
if(36 to 40)
new /obj/item/weapon/melee/baton(src)
if(41 to 45)
@@ -56,7 +54,7 @@
if(46 to 50)
new /obj/item/clothing/under/chameleon(src)
for(var/i in 1 to 7)
new /obj/item/clothing/neck/tie/horrible(src)
new /obj/item/clothing/tie/horrible(src)
if(51 to 52) // 2% chance
new /obj/item/weapon/melee/classic_baton(src)
if(53 to 54)
@@ -67,13 +65,13 @@
if(57 to 58)
new /obj/item/toy/syndicateballoon(src)
if(59 to 60)
new /obj/item/borg/upgrade/modkit/aoe/mobs(src)
new /obj/item/weapon/gun/energy/kinetic_accelerator/hyper(src)
new /obj/item/clothing/suit/space(src)
new /obj/item/clothing/head/helmet/space(src)
if(61 to 62)
for(var/i in 1 to 5)
new /obj/item/clothing/head/kitty(src)
new /obj/item/clothing/neck/petcollar(src)
new /obj/item/clothing/tie/petcollar(src)
if(63 to 64)
for(var/i in 1 to rand(4, 7))
var/newcoin = pick(/obj/item/weapon/coin/silver, /obj/item/weapon/coin/silver, /obj/item/weapon/coin/silver, /obj/item/weapon/coin/iron, /obj/item/weapon/coin/iron, /obj/item/weapon/coin/iron, /obj/item/weapon/coin/gold, /obj/item/weapon/coin/diamond, /obj/item/weapon/coin/plasma, /obj/item/weapon/coin/uranium)
@@ -142,7 +140,7 @@
new /obj/item/weapon/hand_tele(src)
if(97)
new /obj/item/clothing/mask/balaclava
new /obj/item/weapon/gun/ballistic/automatic/pistol(src)
new /obj/item/weapon/gun/projectile/automatic/pistol(src)
new /obj/item/ammo_box/magazine/m10mm(src)
if(98)
new /obj/item/weapon/katana/cursed(src)
@@ -155,32 +153,27 @@
/obj/structure/closet/crate/secure/loot/attack_hand(mob/user)
if(locked)
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
var/input = input(usr, "Enter [codelen] digits.", "Deca-Code Lock", "") as text
if(user.canUseTopic(src, 1))
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)
user << "<span class='notice'>The crate unlocks!</span>"
locked = 0
cut_overlays()
add_overlay("securecrateg")
else if (input == null || sanitycheck == null || length(input) != codelen)
else if (input == null || length(input) != codelen)
user << "<span class='notice'>You leave the crate alone.</span>"
else
user << "<span class='warning'>A red light flashes.</span>"
lastattempt = input
lastattempt = replacetext(input, 0, "z")
attempts--
if(attempts == 0)
boom(user)
else
return ..()
/obj/structure/closet/crate/secure/loot/attack_animal(mob/user)
boom(user)
/obj/structure/closet/crate/secure/loot/AltClick(mob/living/user)
if(!user.canUseTopic(src))
return
@@ -199,21 +192,19 @@
user << "<span class='notice'>* Anti-Tamper Bomb will activate after [src.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])
for(var/i = 1, i < codelen + 1, i++)
var/a = copytext(lastattempt, i, i+1) //Stuff the code into the list
guess += a
guess[a] = i
for(var/i in guess) //Go through list and count matches
var/a = findtext(code, i)
if(a == guess[i])
++bulls
--cows
user << "<span class='notice'>Last code attempt, [lastattempt], had [bulls] correct digits at correct positions and [cows] correct digits at incorrect positions.</span>"
else if(a)
++cows
user << "<span class='notice'>Last code attempt had [bulls] correct digits at correct positions and [cows] correct digits at incorrect positions.</span>"
return
return ..()
@@ -223,5 +214,10 @@
else
..()
/obj/structure/closet/crate/secure/loot/deconstruct(disassembled = TRUE)
boom()
/obj/structure/closet/crate/secure/loot/proc/boom(mob/user)
user << "<span class='danger'>The crate's anti-tamper system activates!</span>"
for(var/atom/movable/AM in src)
qdel(AM)
var/turf/T = get_turf(src)
explosion(T, -1, -1, 1, 1)
qdel(src)