From 07f63489dc9bfa06ec354a5b298f74544c55ec56 Mon Sep 17 00:00:00 2001 From: dearmochi Date: Sat, 28 Nov 2020 17:48:12 +0100 Subject: [PATCH] Fixes instruments not looping (#15005) --- code/modules/instruments/songs/_song.dm | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/code/modules/instruments/songs/_song.dm b/code/modules/instruments/songs/_song.dm index fc4a9b63579..5d682cd915b 100644 --- a/code/modules/instruments/songs/_song.dm +++ b/code/modules/instruments/songs/_song.dm @@ -261,14 +261,6 @@ if(++elapsed_delay >= delay_by) // We were sustaining the final note but not anymore if(current_chord > length(compiled_chords)) - stop_playing() - return - var/list/chord = compiled_chords[current_chord] - play_chord(chord) - elapsed_delay = 0 - delay_by = tempodiv_to_delay(chord[length(chord)]) - current_chord++ - if(current_chord > length(compiled_chords) + 1) if(repeat) repeat-- current_chord = 1 @@ -277,6 +269,11 @@ else stop_playing() return + var/list/chord = compiled_chords[current_chord] + play_chord(chord) + elapsed_delay = 0 + delay_by = tempodiv_to_delay(chord[length(chord)]) + current_chord++ /** * Converts a tempodiv to ticks to elapse before playing the next chord, taking into account our tempo.