POI - 'Demonpool' Remap (#9279)

* add new, generic decacode crate for POIs

* Update demonpool.dmm

* remove some blood drips, removed brackets

* actually remove the brackets this time

* refactors abandoned crates

-makes loot generating crates a subtype of generic, non loot generating decalock crates for PoI purposes
 -updates code and map files for new nomenclature
This commit is contained in:
ephemeralstoryteller
2023-12-03 20:41:47 -08:00
committed by GitHub
parent 2c1d5f6d7f
commit 47c3b1f214
12 changed files with 1307 additions and 936 deletions

View File

@@ -1,5 +1,5 @@
/obj/structure/closet/crate/secure/loot
name = "abandoned crate"
/obj/structure/closet/crate/secure/decalock
name = "decalock crate" //for use in POIs. named as such for a more generic aesthetic
desc = "What could be inside?"
closet_appearance = /decl/closet_appearance/crate/secure
var/list/code = list()
@@ -7,8 +7,8 @@
var/attempts = 10
var/codelen = 4
locked = 1
/obj/structure/closet/crate/secure/loot/Initialize()
/obj/structure/closet/crate/secure/decalock/Initialize()
. = ..()
var/list/digits = list("1", "2", "3", "4", "5", "6", "7", "8", "9", "0")
@@ -16,9 +16,92 @@
code += pick(digits)
digits -= code[code.len]
/obj/structure/closet/crate/secure/decalock/togglelock(mob/user as mob)
if(!locked)
return
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
if(!Adjacent(user))
return
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 == null || sanitycheck == null || length(input) != codelen)
to_chat(user, "<span class='notice'>You leave the crate alone.</span>")
else if(check_input(input))
to_chat(user, "<span class='notice'>The crate unlocks!</span>")
playsound(src, 'sound/machines/lockreset.ogg', 50, 1)
set_locked(0)
else
visible_message("<span class='warning'>A red light on \the [src]'s control panel flashes briefly.</span>")
attempts--
if (attempts == 0)
to_chat(user, "<span class='danger'>The crate's anti-tamper system activates!</span>")
var/turf/T = get_turf(src.loc)
explosion(T, 0, 0, 1, 2)
qdel(src)
/obj/structure/closet/crate/secure/decalock/emag_act(var/remaining_charges, var/mob/user)
if (locked)
to_chat(user, "<span class='notice'>The crate unlocks!</span>")
locked = 0
/obj/structure/closet/crate/secure/decalock/proc/check_input(var/input)
if(length(input) != codelen)
return 0
. = 1
lastattempt.Cut()
for(var/i in 1 to codelen)
var/guesschar = copytext(input, i, i+1)
lastattempt += guesschar
if(guesschar != code[i])
. = 0
/obj/structure/closet/crate/secure/decalock/attackby(obj/item/W as obj, mob/user as mob)
if(locked)
if (istype(W, /obj/item/multitool)) // Greetings Urist McProfessor, how about a nice game of cows and bulls?
to_chat(user, "<span class='notice'>DECA-CODE LOCK ANALYSIS:</span>")
if (attempts == 1)
to_chat(user, "<span class='warning'>* Anti-Tamper system will activate on the next failed access attempt.</span>")
else
to_chat(user, "<span class='notice'>* Anti-Tamper system will activate after [src.attempts] failed access attempts.</span>")
if(lastattempt.len)
var/bulls = 0
var/cows = 0
var/list/code_contents = code.Copy()
for(var/i in 1 to codelen)
if(lastattempt[i] == code[i])
++bulls
else if(lastattempt[i] in code_contents)
++cows
code_contents -= lastattempt[i]
var/previousattempt = null //convert back to string for readback
for(var/i in 1 to codelen)
previousattempt = addtext(previousattempt, lastattempt[i])
to_chat(user, "<span class='notice'>Last code attempt, [previousattempt], had [bulls] correct digits at correct positions and [cows] correct digits at incorrect positions.</span>")
return
..()
/obj/structure/closet/crate/secure/decalock/loot
name = "abandoned crate"
desc = "What could be inside?"
closet_appearance = /decl/closet_appearance/crate/secure
/obj/structure/closet/crate/secure/decalock/loot/Initialize()
. = ..()
generate_loot()
/obj/structure/closet/crate/secure/loot/proc/generate_loot()
/obj/structure/closet/crate/secure/decalock/loot/proc/generate_loot()
var/loot = rand(1, 99)
switch(loot)
if(1 to 5) // Common things go, 5%
@@ -140,78 +223,3 @@
if(99)
new/obj/item/storage/belt/champion(src)
new/obj/item/clothing/mask/luchador(src)
/obj/structure/closet/crate/secure/loot/togglelock(mob/user as mob)
if(!locked)
return
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
if(!Adjacent(user))
return
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 == null || sanitycheck == null || length(input) != codelen)
to_chat(user, "<span class='notice'>You leave the crate alone.</span>")
else if(check_input(input))
to_chat(user, "<span class='notice'>The crate unlocks!</span>")
playsound(src, 'sound/machines/lockreset.ogg', 50, 1)
set_locked(0)
else
visible_message("<span class='warning'>A red light on \the [src]'s control panel flashes briefly.</span>")
attempts--
if (attempts == 0)
to_chat(user, "<span class='danger'>The crate's anti-tamper system activates!</span>")
var/turf/T = get_turf(src.loc)
explosion(T, 0, 0, 1, 2)
qdel(src)
/obj/structure/closet/crate/secure/loot/emag_act(var/remaining_charges, var/mob/user)
if (locked)
to_chat(user, "<span class='notice'>The crate unlocks!</span>")
locked = 0
/obj/structure/closet/crate/secure/loot/proc/check_input(var/input)
if(length(input) != codelen)
return 0
. = 1
lastattempt.Cut()
for(var/i in 1 to codelen)
var/guesschar = copytext(input, i, i+1)
lastattempt += guesschar
if(guesschar != code[i])
. = 0
/obj/structure/closet/crate/secure/loot/attackby(obj/item/W as obj, mob/user as mob)
if(locked)
if (istype(W, /obj/item/multitool)) // Greetings Urist McProfessor, how about a nice game of cows and bulls?
to_chat(user, "<span class='notice'>DECA-CODE LOCK ANALYSIS:</span>")
if (attempts == 1)
to_chat(user, "<span class='warning'>* Anti-Tamper system will activate on the next failed access attempt.</span>")
else
to_chat(user, "<span class='notice'>* Anti-Tamper system will activate after [src.attempts] failed access attempts.</span>")
if(lastattempt.len)
var/bulls = 0
var/cows = 0
var/list/code_contents = code.Copy()
for(var/i in 1 to codelen)
if(lastattempt[i] == code[i])
++bulls
else if(lastattempt[i] in code_contents)
++cows
code_contents -= lastattempt[i]
var/previousattempt = null //convert back to string for readback
for(var/i in 1 to codelen)
previousattempt = addtext(previousattempt, lastattempt[i])
to_chat(user, "<span class='notice'>Last code attempt, [previousattempt], had [bulls] correct digits at correct positions and [cows] correct digits at incorrect positions.</span>")
return
..()

View File

@@ -679,7 +679,7 @@ var/global/list/mining_overlay_cache = list()
excavate_find(prob(5), finds[1])
else if(rand(1,500) == 1)
visible_message("<span class='notice'>An old dusty crate was buried within!</span>")
new /obj/structure/closet/crate/secure/loot(src)
new /obj/structure/closet/crate/secure/decalock/loot(src)
make_floor()
update_icon(1)