Skip to content

Commit

Permalink
Properly handle when ClientTick is wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
hasenbanck committed Dec 28, 2024
1 parent a2f2f55 commit e34271c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion korangar/src/input/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ impl InputSystem {

if self.right_mouse_button.pressed()
&& self.previous_mouse_button.button == MouseButton::Right
&& client_tick.0.saturating_sub(self.previous_mouse_button.tick.0) < DOUBLE_CLICK_TIME_MS
&& client_tick.0.wrapping_sub(self.previous_mouse_button.tick.0) < DOUBLE_CLICK_TIME_MS
{
events.push(UserEvent::CameraResetRotation);
}
Expand Down
2 changes: 1 addition & 1 deletion korangar/src/world/entity/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl SoundState {
let should_play = if Some(sound_effect_key) == self.previous_key
&& let Some(last_tick) = self.last_played_at
{
(client_tick.0.saturating_sub(last_tick.0)) >= SOUND_COOLDOWN_DURATION
(client_tick.0.wrapping_sub(last_tick.0)) >= SOUND_COOLDOWN_DURATION
} else {
true
};
Expand Down

0 comments on commit e34271c

Please sign in to comment.