Blown engines and repairs
An engine that blows in a race the race server judged (career events, boss and tournament rounds, quick races and online heats) stays blown. That car cannot race again until it is repaired in the Garage. Test runs never count, so tuning experiments stay free. The player can switch to another car they own and race that one meanwhile.
The rules
Section titled “The rules”player/repair.ts holds them, with no Phaser, so the server runs the same code:
markBlown(state, modelId)setsblownon thatOwnedCar. Cars are unique per model, so the model id names the car.repairPrice(car)is 5% of the car’s value: its model price plus the parts bought for it (carValueinplayer/shopRules.ts, the same base as the sell price).repairChargeis what the repair takes: the price, or all the player’s cash when they have less. A player at $0 repairs for free, so nobody is ever stuck. Repairs are rare, so this costs the economy little.- The
repairgarage action (player/garageActions.ts) repairs the current car and refuses one that is fine.
tests/repair.test.ts covers price, the short-of-cash case and the refusal.
On the race server
Section titled “On the race server”- Career and quick races: each judge reports
blownfrom its replay, andfinishinparty/src/api/raceApi.tsmarks the car from the race ticket.startrefuses a ticket while the current car is blown. - Online:
markOnlineBlown(party/src/race/onlineBlown.ts) marks each blown runner after a heat, andownedEntryrefuses a blown car at join.
The game cannot clear the flag: blown is not one of the fields its sync sends (player/garageSync.ts).
In the game
Section titled “In the game”- Race guard (
ui/raceGuard.ts):whenCarCanRaceruns before every way into a race (career event, boss, next boss round, quick race, Results retry). For a blown car it opens a dialog that sends the player to the Garage. Online,joinRoomAction(net/joinRoom.ts) refuses without connecting. - Car picker (
hub/pickEligibleCar.ts): a class-restricted event does not offer blown cars. - Garage (
garage/view/repairButton.ts): a red Repair engine button with the charge, shown only while the current car is blown.