Adds the Janitor's Keyring (#21104)

* janitor gaming

* access was too powerful

* fix examine + add mining bay access + SECONDS

* src-b-gone

Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>

* sounds

* cooldown fix + sprite

* adds janitor check

* Sirryan reviews

* i forgot how comments work lul

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* AA review

* styling moment

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>

* lewcc review

* im silly

* autodoc + lewcc suggestions

* begone indentation

* new sprite

---------

Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
This commit is contained in:
matttheficus
2023-06-22 09:52:57 +01:00
committed by GitHub
co-authored by SteelSlayer Ryan AffectedArc07
parent 2e2d158664
commit b781597e85
5 changed files with 76 additions and 0 deletions
+75
View File
@@ -155,7 +155,82 @@
busy = FALSE
icon_state = "hacktool"
/// How long before you can "jangle" your keyring again (to prevent spam)
#define JANGLE_COOLDOWN 10 SECONDS
/obj/item/door_remote/janikeyring
name = "janitor's keyring"
desc = "An absolutely unwieldy set of keys attached to a metal ring. The keys on the ring allow you to access most Departmental entries and the Service Department!"
icon_state = "keyring"
item_state = "keyring"
/// Are you already using the keyring?
var/busy = FALSE
/// This prevents spamming the key-shake.
var/cooldown = 0
/// How fast does the keyring open an airlock. It is not set here so that it can be set via the user's role.
var/hack_speed
additional_access = list(ACCESS_MEDICAL, ACCESS_RESEARCH, ACCESS_CONSTRUCTION, ACCESS_CARGO, ACCESS_MINING, ACCESS_KITCHEN, ACCESS_BAR, ACCESS_JANITOR, ACCESS_CHAPEL_OFFICE)
/obj/item/door_remote/janikeyring/examine(mob/user)
. = ..()
. += "<span class='notice'>This keyring has access to Medbay, Science, Engineering, Cargo, the Bar and the Kitchen!</span>"
/obj/item/door_remote/janikeyring/attack_self(mob/user)
if(cooldown > world.time)
return
to_chat(user, "<span class='warning'>You shake [src]!</span>")
playsound(src, 'sound/items/keyring_shake.ogg', 50)
cooldown = world.time + JANGLE_COOLDOWN
/obj/item/door_remote/janikeyring/afterattack(obj/machinery/door/airlock/D, mob/user, proximity)
if(!proximity)
return
if(!istype(D))
return
if(busy)
to_chat(user, "<span class='warning'>You are already using [src] on the [D] airlock's access panel!</span>")
return
busy = TRUE
to_chat(user, "<span class='notice'>You fiddle with [src], trying different keys to open the [D] airlock...</span>")
playsound(src, 'sound/items/keyring_unlock.ogg', 50)
var/mob/living/carbon/human/H = user
if(H.mind.assigned_role != "Janitor")
hack_speed = rand(30, 60) SECONDS
else
hack_speed = rand(5, 20) SECONDS
if(!do_after(user, hack_speed, target = D, progress = 0))
return
busy = FALSE
if(!istype(D))
return
if(HAS_TRAIT(D, TRAIT_CMAGGED))
to_chat(user, "<span class='danger'>[src] won't fit in the [D] airlock's access panel, there's slime everywhere!</span>")
return
if(D.is_special)
to_chat(user, "<span class='danger'>[src] cannot fit in the [D] airlock's access panel!</span>")
return
if(!D.arePowerSystemsOn())
to_chat(user, "<span class='danger'>The [D] airlock has no power!</span>")
return
if(D.check_access(ID))
D.add_hiddenprint(user)
if(D.density)
D.open()
else
to_chat(user, "<span class='danger'>The [D] airlock is already open!</span>")
else
to_chat(user, "<span class='danger'>[src] does not seem to have a key for the [D] airlock's access panel!</span>")
#undef WAND_OPEN
#undef WAND_BOLT
#undef WAND_EMERGENCY
#undef WAND_SPEED
#undef JANGLE_COOLDOWN