From d748145156d5d2fd22c45d1e1f5d747a33d588fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Fri, 19 Nov 2021 18:09:24 +0100 Subject: [PATCH] Implement automatic clutch --- vehicles/vehicle.gd | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vehicles/vehicle.gd b/vehicles/vehicle.gd index e2a7571..59ebb34 100644 --- a/vehicles/vehicle.gd +++ b/vehicles/vehicle.gd @@ -81,7 +81,7 @@ func _get_gear_ratio(): func _handle_gear_switch(delta: float): if gear_timer > 0: gear_timer = max(0, gear_timer - delta) - if clutch_position > 0.8: + if clutch_position > 0.8 or GlobalSettings.auto_clutch: if Input.is_action_just_pressed("gear_up"): if gear + 1 <= gear_ratios.size(): gear += 1 @@ -123,6 +123,9 @@ func _physics_process(delta: float): clutch_position = Input.get_action_strength("clutch") _handle_gear_switch(delta) var throttle = Input.get_action_strength("throttle") + if GlobalSettings.auto_clutch: + clutch_position = 1 - min(rpm, 900) / 900.0 + if gear_timer > 0: clutch_position = 1 throttle = 0