From 32362968cb1e45d8ac7dead880ea145b477802af Mon Sep 17 00:00:00 2001 From: ShizCalev Date: Thu, 11 May 2023 21:56:41 -0400 Subject: [PATCH] Fixes headphones not updating icons properly when a song starts & stops playing (#75322) :cl: ShizCalev fix: Headphones now properly update to display musical notes when a song starts & stops playing while worn! /:cl: Fixes #74965 REQUIRES #75324 --- code/modules/instruments/piano_synth.dm | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/code/modules/instruments/piano_synth.dm b/code/modules/instruments/piano_synth.dm index 416d164cac0..a93ca0b7f51 100644 --- a/code/modules/instruments/piano_synth.dm +++ b/code/modules/instruments/piano_synth.dm @@ -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"