Stethoscopes now highlight the correct vault sound (#19684)

* stethoscope

* make it work on accessory

* bolditalics
This commit is contained in:
S34N
2022-11-30 15:50:44 -05:00
committed by GitHub
parent 208fec0a04
commit 0d14b178c3
3 changed files with 16 additions and 6 deletions
+12 -6
View File
@@ -249,8 +249,14 @@ GLOBAL_LIST_EMPTY(safes)
var/canhear = FALSE
if(ishuman(usr))
var/mob/living/carbon/human/H = usr
if(H.can_hear() && H.is_in_hands(/obj/item/clothing/accessory/stethoscope))
canhear = TRUE
var/list/accessories = H.w_uniform?.accessories
if(H.can_hear()) // This is cursed but is_type_in_list somehow fails
if(H.is_in_hands(/obj/item/clothing/accessory/stethoscope))
canhear = TRUE
else
for(var/obj/item/clothing/accessory/stethoscope/S in accessories)
canhear = TRUE
break
. = TRUE
switch(action)
@@ -276,7 +282,7 @@ GLOBAL_LIST_EMPTY(safes)
current_tumbler_index = 1
if(!invalid_turn && dial == tumblers[current_tumbler_index])
notify_user(usr, canhear, list("tink", "krink", "plink"), ticks, i)
notify_user(usr, canhear, list("tink", "krink", "plink"), ticks, i, TRUE)
current_tumbler_index++
else
notify_user(usr, canhear, list("clack", "scrape", "clank"), ticks, i)
@@ -296,7 +302,7 @@ GLOBAL_LIST_EMPTY(safes)
current_tumbler_index = 1
if(!invalid_turn && dial == tumblers[current_tumbler_index])
notify_user(usr, canhear, list("tonk", "krunk", "plunk"), ticks, i)
notify_user(usr, canhear, list("tonk", "krunk", "plunk"), ticks, i, TRUE)
current_tumbler_index++
else
notify_user(usr, canhear, list("click", "chink", "clink"), ticks, i)
@@ -330,14 +336,14 @@ GLOBAL_LIST_EMPTY(safes)
/**
* Called every dial turn to provide feedback if possible.
*/
/obj/structure/safe/proc/notify_user(user, canhear, sounds, total_ticks, current_tick)
/obj/structure/safe/proc/notify_user(user, canhear, sounds, total_ticks, current_tick, correct_sound)
if(!canhear)
return
if(current_tick == 2)
to_chat(user, "<span class='italics'>The sounds from [src] are too fast and blend together.</span>")
if(total_ticks == 1 || prob(SOUND_CHANCE))
to_chat(user, "<span class='italics'>You hear a [pick(sounds)] from [src].</span>")
to_chat(user, "<span class='[correct_sound ? "bolditalics" : "italics"]'>You hear a [pick(sounds)] from [src].</span>")
/**
* Returns the combination to unlock the safe as text.