Avoid any punishment if countdown expires after user submits

This commit is contained in:
RandyTheSilly committed 2026-11-11 21:16:14 -05:00
1 parent 4b9d90efc8
commit eca38890b6
1 file changed
+2 -8
+2 -8
View File
@@ -520,7 +520,7 @@ static void door_layer_green_update_proc(Layer *layer, GContext *ctx) {
static void door_closed_animation_stopped_handler(Animation *a, bool finished, void *ctx) { static void door_closed_animation_stopped_handler(Animation *a, bool finished, void *ctx) {
if (!finished) if (!finished)
return; return; // prevents running if animation is cancelled due to unload
if (s_door_correct) if (s_door_correct)
s_current_triangle_num++; s_current_triangle_num++;
else if (s_current_triangle_num > 1) else if (s_current_triangle_num > 1)
@@ -535,12 +535,6 @@ static void door_animation_stopped_handler(Animation *a, bool finished, void *ct
} }
static void play_door_animation(bool correct) { static void play_door_animation(bool correct) {
// prevent from playing if an instance is already running and not yet finished;
// prevents instances where the user is punished if the timer expires AFTER the submission
if (s_door_anim) {
return;
}
// reset shake cooldown here so it is guaranteed // reset shake cooldown here so it is guaranteed
// to be in effect while an animation is playing // to be in effect while an animation is playing
s_shake_cooldown = SHAKE_COOLDOWN_SECS; s_shake_cooldown = SHAKE_COOLDOWN_SECS;
@@ -610,7 +604,7 @@ static void alarm_tick_handler(struct tm *tick_time, TimeUnits units_changed) {
} }
snprintf(s_countdown_buf, sizeof(s_countdown_buf), "%03u", s_countdown_int); snprintf(s_countdown_buf, sizeof(s_countdown_buf), "%03u", s_countdown_int);
text_layer_set_text(s_countdown_txt_layer, s_countdown_buf); text_layer_set_text(s_countdown_txt_layer, s_countdown_buf);
if (s_countdown_int == 0) { if (s_countdown_int == 0 && !s_door_anim) { // punish user and demote if countdown expires
s_continuous_zap_on_first_triangle = true; // begin zapping once the first countdown expires s_continuous_zap_on_first_triangle = true; // begin zapping once the first countdown expires
send_zap(); send_zap();
s_secs_since_last_input = 10; s_secs_since_last_input = 10;