[MIRROR] Fixes headphones not updating icons properly when a song starts & stops playing [MDB IGNORE] (#21095)

* 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

* Fixes headphones not updating icons properly when a song starts & stops playing

---------

Co-authored-by: ShizCalev <ShizCalev@users.noreply.github.com>
This commit is contained in:
SkyratBot
2023-05-12 00:42:41 -07:00
committed by GitHub
co-authored by ShizCalev
parent e8d7bbe160
commit 81215e241b
+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"