From 90820f96a7e3f930436db566154b25a1117a9444 Mon Sep 17 00:00:00 2001 From: ashleygrobler04 Date: Wed, 1 Jul 2026 16:55:07 +0200 Subject: [PATCH] Use Q and W to shift gears as apposed to the numeric row --- CHANGELOG.md | 1 + src/freight_fate/states/driving_controls.py | 20 ++++++++++++++++---- src/freight_fate/states/driving_core.py | 14 +------------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0adf07a..96b61a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -104,6 +104,7 @@ equivalent nightly. ### Changed +- **During a manual drive, use shift+W to shift up gears, and shift+q to shift down gears . - **Hours-of-service rules are more realistic.** Realistic mode now tracks the 11-hour driving limit, 14-hour duty window, 30-minute break requirement, 60/70-hour weekly limits, roadside inspections, and legal sleeper-berth split diff --git a/src/freight_fate/states/driving_controls.py b/src/freight_fate/states/driving_controls.py index 40ab129..ff6a10f 100644 --- a/src/freight_fate/states/driving_controls.py +++ b/src/freight_fate/states/driving_controls.py @@ -4,7 +4,6 @@ from .driving_core import * from .driving_menu_states import DrivingStatusState, PauseMenuState - class DrivingControlsMixin: def handle_event(self, event: pygame.event.Event) -> None: if event.type == pygame.KEYUP and event.key == pygame.K_h: @@ -14,6 +13,7 @@ def handle_event(self, event: pygame.event.Event) -> None: return key = event.key tr = self.truck.transmission + global gear_idx if key in (pygame.K_LCTRL, pygame.K_RCTRL): self.ctx.stop_event_speech() self._set_status("Event voice stopped.") @@ -29,8 +29,20 @@ def handle_event(self, event: pygame.event.Event) -> None: self.ctx.say("Neutral.") elif key == pygame.K_BACKSPACE and not tr.automatic: self._manual_shift(REVERSE) - elif key in GEAR_KEYS and not tr.automatic: - self._manual_shift(GEAR_KEYS[key]) + elif key==pygame.K_q and not tr.automatic and gear_idx>1: + gear_idx-=1 + self._manual_shift(gear_idx) + elif key==pygame.K_w and not tr.automatic : + if tr.in_reverse: + gear_idx=1 + self._manual_shift(gear_idx) + elif tr.in_neutral: + gear_idx=1 + self._manual_shift(gear_idx) + elif gear_idx<10: + gear_idx+=1 + self._manual_shift(gear_idx) + elif key == pygame.K_j: if self.truck.throttle > 0.05 and not self.truck.engine_brake: self.ctx.say("Release the accelerator before turning the engine brake on.") @@ -121,7 +133,7 @@ def handle_event(self, event: pygame.event.Event) -> None: + ( "" if self.truck.transmission.automatic - else "Hold Left Shift for clutch, then 1 through 0 for gears, " + else "Hold Left Shift for clutch, then W to shift up or Q to shift down, " "Backspace for reverse, N for neutral." ) ) diff --git a/src/freight_fate/states/driving_core.py b/src/freight_fate/states/driving_core.py index d7e5e07..96ac3c3 100644 --- a/src/freight_fate/states/driving_core.py +++ b/src/freight_fate/states/driving_core.py @@ -38,19 +38,7 @@ log = logging.getLogger(__name__) -GEAR_KEYS = { - pygame.K_1: 1, - pygame.K_2: 2, - pygame.K_3: 3, - pygame.K_4: 4, - pygame.K_5: 5, - pygame.K_6: 6, - pygame.K_7: 7, - pygame.K_8: 8, - pygame.K_9: 9, - pygame.K_0: 10, -} - +gear_idx=1 HAZARD_SAFE_MPH = 25.0 MPH_PER_MPS = 2.23694