From ffe8ae378635cb51e50478cd129294e5caf7ac92 Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Thu, 15 Oct 2020 21:02:02 +0100 Subject: [PATCH] Update filingcabinet.dm (#14616) --- code/modules/paperwork/filingcabinet.dm | 71 +++++++++++-------------- 1 file changed, 32 insertions(+), 39 deletions(-) diff --git a/code/modules/paperwork/filingcabinet.dm b/code/modules/paperwork/filingcabinet.dm index eb350f5e29a..01552b6b3e2 100644 --- a/code/modules/paperwork/filingcabinet.dm +++ b/code/modules/paperwork/filingcabinet.dm @@ -15,7 +15,7 @@ icon = 'icons/obj/bureaucracy.dmi' icon_state = "filingcabinet" density = 1 - anchored = 1 + anchored = TRUE /obj/structure/filingcabinet/chestdrawer @@ -30,14 +30,14 @@ icon_state = "tallcabinet" -/obj/structure/filingcabinet/Initialize() +/obj/structure/filingcabinet/Initialize(mapload) ..() for(var/obj/item/I in loc) if(istype(I, /obj/item/paper) || istype(I, /obj/item/folder) || istype(I, /obj/item/photo)) I.loc = src -/obj/structure/filingcabinet/attackby(obj/item/P as obj, mob/user as mob, params) +/obj/structure/filingcabinet/attackby(obj/item/P, mob/user, params) if(istype(P, /obj/item/paper) || istype(P, /obj/item/folder) || istype(P, /obj/item/photo) || istype(P, /obj/item/paper_bundle) || istype(P, /obj/item/documents)) to_chat(user, "You put [P] in [src].") user.drop_item() @@ -46,15 +46,15 @@ sleep(5) icon_state = initial(icon_state) updateUsrDialog() - else if(istype(P, /obj/item/wrench)) - playsound(loc, P.usesound, 50, 1) - anchored = !anchored - to_chat(user, "You [anchored ? "wrench" : "unwrench"] \the [src].") else if(user.a_intent != INTENT_HARM) to_chat(user, "You can't put [P] in [src]!") else return ..() +/obj/structure/filingcabinet/wrench_act(mob/living/user, obj/item/I) + . = TRUE + default_unfasten_wrench(user, I) + /obj/structure/filingcabinet/deconstruct(disassembled = TRUE) if(!(flags & NODECONSTRUCT)) new /obj/item/stack/sheet/metal(loc, 2) @@ -62,9 +62,9 @@ I.forceMove(loc) qdel(src) -/obj/structure/filingcabinet/attack_hand(mob/user as mob) - if(contents.len <= 0) - to_chat(user, "\The [src] is empty.") +/obj/structure/filingcabinet/attack_hand(mob/user) + if(!length(contents)) + to_chat(user, "[src] is empty.") return user.set_machine(src) @@ -74,7 +74,7 @@ dat += "" var/datum/browser/popup = new(user, "filingcabinet", name, 350, 300) popup.set_content(dat) - popup.open(0) + popup.open(FALSE) return @@ -85,8 +85,8 @@ ..() /obj/structure/filingcabinet/attack_self_tk(mob/user) - if(contents.len) - if(prob(40 + contents.len * 5)) + if(length(contents)) + if(prob(40 + (length(contents) * 5))) var/obj/item/I = pick(contents) I.loc = loc if(prob(25)) @@ -105,16 +105,15 @@ usr.put_in_hands(P) updateUsrDialog() icon_state = "[initial(icon_state)]-open" - spawn(0) - sleep(5) - icon_state = initial(icon_state) + sleep(5) + icon_state = initial(icon_state) /* * Security Record Cabinets */ /obj/structure/filingcabinet/security - var/virgin = 1 + var/virgin = TRUE /obj/structure/filingcabinet/security/proc/populate() @@ -133,7 +132,7 @@ P.info += "[c]
" P.info += "" P.name = "paper - '[G.fields["name"]]'" - virgin = 0 //tabbing here is correct- it's possible for people to try and use it + virgin = FALSE //tabbing here is correct- it's possible for people to try and use it //before the records have been generated, so we do this inside the loop. /obj/structure/filingcabinet/security/attack_hand() @@ -148,7 +147,7 @@ * Medical Record Cabinets */ /obj/structure/filingcabinet/medical - var/virgin = 1 + var/virgin = TRUE /obj/structure/filingcabinet/medical/proc/populate() if(virgin) @@ -166,7 +165,7 @@ P.info += "[c]
" P.info += "" P.name = "paper - '[G.fields["name"]]'" - virgin = 0 //tabbing here is correct- it's possible for people to try and use it + virgin = FALSE //tabbing here is correct- it's possible for people to try and use it //before the records have been generated, so we do this inside the loop. /obj/structure/filingcabinet/medical/attack_hand() @@ -184,9 +183,9 @@ GLOBAL_LIST_EMPTY(employmentCabinets) /obj/structure/filingcabinet/employment - var/cooldown = 0 + var/cooldown = FALSE // Only used for devils icon_state = "employmentcabinet" - var/virgin = 1 + var/virgin = TRUE /obj/structure/filingcabinet/employment/New() GLOB.employmentCabinets += src @@ -210,23 +209,17 @@ GLOBAL_LIST_EMPTY(employmentCabinets) new /obj/item/paper/contract/employment(src, employee) /obj/structure/filingcabinet/employment/attack_hand(mob/user) - if(!cooldown) + if(cooldown) + to_chat(user, "[src] is jammed, give it a few seconds.") + else if(virgin) fillCurrent() - virgin = 0 - cooldown = 1 - ..() - sleep(100) // prevents the devil from just instantly emptying the cabinet, ensuring an easy win. - cooldown = 0 - else - to_chat(user, "The [src] is jammed, give it a few seconds.") + virgin = FALSE + if(user.mind.special_role != "devil") + return ..() -/obj/structure/filingcabinet/employment/attackby(obj/item/P, mob/user, params) - if(istype(P, /obj/item/wrench)) - to_chat(user, "You begin to [anchored ? "wrench" : "unwrench"] [src].") - if (do_after(user,300,user)) - playsound(loc, 'sound/items/Ratchet.ogg', 50, 1) - anchored = !anchored - to_chat(user, "You successfully [anchored ? "wrench" : "unwrench"] [src].") - else - return ..() + else + cooldown = TRUE + ..() + sleep(10 SECONDS) // prevents the devil from just instantly emptying the cabinet, ensuring an easy win. + cooldown = FALSE