fix(ebike): unlock walking during breakdown + hide interact prompt + 450m ride
Three fixes for the ebike-breakdown substep: 1. PlayerController: the previous `if (!isEbikeBreakdown)` guard zeroed _wishDir for everyone during breakdown, including the player after they had been auto-dismounted to walk mode. Narrow the guard to `isEbikeMounted && isEbikeBreakdown` so the bike stops accepting drive input but the player on foot can move. 2. Ebike: track `window.ebikeBreakdownActive` in component state and hide the InteractableObject (and therefore the interact prompt UI) while the breakdown sequence is active. The bike must read as inert and non-interactive while the panne dialogue plays and during the auto-dismount that follows. 3. ebikeConfig: bump EBIKE_INTRO_BREAKDOWN_DISTANCE from 15 m to 450 m so the panne triggers after a real ride instead of a few meters from the parked spawn.
This commit is contained in:
@@ -344,13 +344,19 @@ export function Ebike({
|
||||
// pollute the view. The prompt comes back the moment the bike comes to
|
||||
// a stop. window.ebikeDriveInputActive is published every frame by
|
||||
// PlayerController based on whether a movement key is currently held.
|
||||
// Also hide entirely while the breakdown sequence is active — the bike
|
||||
// must read as inert and non-interactive while the panne dialogue plays
|
||||
// and during the auto-dismount that follows.
|
||||
const [isEbikeDriving, setIsEbikeDriving] = useState(false);
|
||||
const [isEbikeBreakdown, setIsEbikeBreakdown] = useState(false);
|
||||
useFrame(() => {
|
||||
const driving =
|
||||
movementMode === "ebike" && window.ebikeDriveInputActive === true;
|
||||
if (driving !== isEbikeDriving) setIsEbikeDriving(driving);
|
||||
const breakdown = window.ebikeBreakdownActive === true;
|
||||
if (breakdown !== isEbikeBreakdown) setIsEbikeBreakdown(breakdown);
|
||||
});
|
||||
const showInteractPrompt = !isEbikeDriving;
|
||||
const showInteractPrompt = !isEbikeDriving && !isEbikeBreakdown;
|
||||
|
||||
const handleInteract = useCallback((): void => {
|
||||
if (window.ebikeBreakdownActive === true) return;
|
||||
|
||||
Reference in New Issue
Block a user