Fixes headphones not updating icons properly when a song starts & stops playing (#75322)

🆑 ShizCalev
fix: Headphones now properly update to display musical notes when a song
starts & stops playing while worn!
/🆑

Fixes #74965

REQUIRES #75324
This commit is contained in:
ShizCalev
2023-05-11 21:56:41 -04:00
committed by GitHub
parent 9eafac6fc3
commit 32362968cb
+7 -14
View File
@@ -33,24 +33,17 @@
/obj/item/instrument/piano_synth/headphones/Initialize(mapload)
. = ..()
AddElement(/datum/element/update_icon_updates_onmob)
RegisterSignal(src, COMSIG_INSTRUMENT_START, PROC_REF(start_playing))
RegisterSignal(src, COMSIG_INSTRUMENT_END, PROC_REF(stop_playing))
RegisterSignal(src, COMSIG_INSTRUMENT_START, PROC_REF(update_icon_for_playing_music))
RegisterSignal(src, COMSIG_INSTRUMENT_END, PROC_REF(update_icon_for_playing_music))
/**
* Called by a component signal when our song starts playing.
*/
/obj/item/instrument/piano_synth/headphones/proc/start_playing()
// Called by a component signal to update musical note VFX for songs playing while worn.
/obj/item/instrument/piano_synth/headphones/proc/update_icon_for_playing_music()
SIGNAL_HANDLER
icon_state = "[initial(icon_state)]_on"
update_appearance()
/**
* Called by a component signal when our song stops playing.
*/
/obj/item/instrument/piano_synth/headphones/proc/stop_playing()
SIGNAL_HANDLER
icon_state = "[initial(icon_state)]"
update_appearance()
/obj/item/instrument/piano_synth/headphones/update_icon_state()
. = ..()
icon_state = "[initial(icon_state)][song?.playing ? "_on" : null]"
/obj/item/instrument/piano_synth/headphones/spacepods
name = "\improper Nanotrasen space pods"