From 784962c79d4076c0f01634c458e366615c3026b2 Mon Sep 17 00:00:00 2001 From: Theo Champion Date: Wed, 17 Sep 2025 12:52:30 +0200 Subject: [PATCH] feat: Added a cooldown for auto weapons --- src/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index c053bd9..3199ab7 100644 --- a/src/main.c +++ b/src/main.c @@ -6,7 +6,7 @@ /* By: kcolin +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */ -/* Updated: 2025/09/16 16:07:09 by tchampio ### ########.fr */ +/* Updated: 2025/09/17 12:51:34 by tchampio ### ########.fr */ /* */ /* ************************************************************************** */ @@ -50,6 +50,11 @@ void handle_shooting(t_cub3d_data *data) data->keypresses.is_space_pressed = false; if (data->player.weapon.clip <= 0) return ; + if (data->player.weapon.is_auto) + { + if (get_milliseconds() - data->last_since_shoot < 50000) + return ; + } data->player.weapon.is_shooting = true; data->last_since_shoot = get_milliseconds(); data->player.weapon.clip--;