fix: Fixed a bug preventing auto shoot

This commit is contained in:
Theo Champion 2025-09-17 16:05:41 +02:00
parent 784962c79d
commit c339bb7334

View file

@ -6,7 +6,7 @@
/* By: kcolin <kcolin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/07/17 14:14:30 by kcolin #+# #+# */
/* Updated: 2025/09/17 12:51:34 by tchampio ### ########.fr */
/* Updated: 2025/09/17 13:36:22 by tchampio ### ########.fr */
/* */
/* ************************************************************************** */
@ -50,7 +50,7 @@ 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 (data->last_since_shoot != 0 && data->player.weapon.is_auto)
{
if (get_milliseconds() - data->last_since_shoot < 50000)
return ;