From 8add24d84919d12a869eada38859a54a636a09fc Mon Sep 17 00:00:00 2001 From: dan63047 Date: Mon, 13 Nov 2023 00:29:45 +0300 Subject: [PATCH] Fix lock resets I still need to implement disabled and gravity lock delay modes --- src/engine/resources.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/engine/resources.rs b/src/engine/resources.rs index 7dc8877..e7ad019 100644 --- a/src/engine/resources.rs +++ b/src/engine/resources.rs @@ -274,7 +274,6 @@ impl Engine { } }, } - info!("lock resets: {}, lock delay: {}", self.lock_delay_resets_left, self.lock_delay_left); } pub fn rotate_current_piece(&mut self, rotation: i8) -> bool { @@ -287,12 +286,12 @@ impl Engine { }else{ 1 }; + self.lock_delay_check((0, 0)); for test in &self.rotation_system.kicks[self.current_piece.as_ref().unwrap().id][self.current_piece.as_ref().unwrap().rotation][id_for_kicks]{ let future_position = (self.current_piece.as_ref().unwrap().position.0 + test.0 as isize, self.current_piece.as_ref().unwrap().position.1 + test.1 as isize); if self.position_is_valid(future_position, future_rotation) { self.current_piece.as_mut().unwrap().rotation = future_rotation; self.current_piece.as_mut().unwrap().position = future_position; - self.lock_delay_check(*test); return true; } } @@ -303,12 +302,12 @@ impl Engine { if (shift.0 == 0 && shift.1 == 0) || self.current_piece.is_none(){ return true; } - self.lock_delay_check(shift); let future_position = ( self.current_piece.as_ref().unwrap().position.0 + shift.0 as isize, // future X self.current_piece.as_ref().unwrap().position.1 + shift.1 as isize // future Y ); if self.position_is_valid(future_position, self.current_piece.as_ref().unwrap().rotation) { + if shift.0 != 0 {self.lock_delay_check(shift);} self.current_piece.as_mut().unwrap().position = future_position; true }else {