Can a script swap the positions of a follower and its leader? #12

Closed
opened 2026-10-05 21:24:44 +00:00 by haylan · 1 comment
Owner

Part of #1

Question

Can a script swap the positions of a held-back follower and its leader, so that the faster vehicle continues from the leader's spot and the slower one from the follower's? Candidate: on the GUI thread, exchange the two vehicles' MovePath components (route plus position) with api.cmd.debug.makeComponentExchangeCmd. The callbacks report the game's success or failure per exchange. The doc comment only promises EmissionEmitter/ModelInstanceList, and from the engine thread the command can't be sent at all.

HITL: the human runs a save copy with debug mode on and watches a fast/slow pair. The probe on branch prototype/vehicle-probe (guiUpdate in overtake_probe.script.tl) does the flip at most twice and traces both vehicles for about 10 s.

Outcome:

  1. Does the exchange succeed?
  2. Do the vehicles visibly swap and keep driving normally (route, stops, line)?
  3. Is debug mode required?
  4. Go/no-go for the position flip as the single-lane overtaking mechanism.
Part of #1 ## Question Can a script swap the positions of a held-back follower and its leader, so that the faster vehicle continues from the leader's spot and the slower one from the follower's? Candidate: on the GUI thread, exchange the two vehicles' `MovePath` components (route plus position) with `api.cmd.debug.makeComponentExchangeCmd`. The callbacks report the game's success or failure per exchange. The doc comment only promises `EmissionEmitter`/`ModelInstanceList`, and from the engine thread the command can't be sent at all. HITL: the human runs a save copy with debug mode on and watches a fast/slow pair. The probe on branch `prototype/vehicle-probe` (`guiUpdate` in `overtake_probe.script.tl`) does the flip at most twice and traces both vehicles for about 10 s. Outcome: 1. Does the exchange succeed? 2. Do the vehicles visibly swap and keep driving normally (route, stops, line)? 3. Is debug mode required? 4. Go/no-go for the position flip as the single-lane overtaking mechanism.
haylan added the wayfinder:prototype label 2026-10-05 21:24:44 +00:00
haylan self-assigned this 2026-10-05 21:24:54 +00:00
Author
Owner

Resolution

No-go: a script cannot swap (or otherwise set) the positions of road vehicles.

  • api.cmd.debug.makeComponentExchangeCmd(vehicle, movePath) fails at sendCommand with Error decoding argument #3: The lua object can't be cast to desired type on both the engine thread (without callback) and the GUI thread (with callback; the callback is never reached). Debug mode was active. The command only accepts EmissionEmitter/ModelInstanceList, as its doc says.
  • No other command writes a line vehicle's position or route. The only teleport is makeVehicleSendToDepotCmd(…, jumpToDepotEntity), which can only target a depot. makeCustomVehicleCreateOrUpdateCmd is aircraft-only.
  • Together with the earlier results (no native passing, timeToIgnore unreachable, set-line doesn't force lanes, segment rebuild has no effect on single-lane roads), no script mechanism moves a vehicle past another on a single-lane road.

Details: docs/research/vehicle-probe.md on branch prototype/vehicle-probe (the flip code is last in commit 0465a93 and removed in 9623abb).

## Resolution **No-go: a script cannot swap (or otherwise set) the positions of road vehicles.** - `api.cmd.debug.makeComponentExchangeCmd(vehicle, movePath)` fails at `sendCommand` with `Error decoding argument #3: The lua object can't be cast to desired type` on **both** the engine thread (without callback) and the GUI thread (with callback; the callback is never reached). Debug mode was active. The command only accepts `EmissionEmitter`/`ModelInstanceList`, as its doc says. - No other command writes a line vehicle's position or route. The only teleport is `makeVehicleSendToDepotCmd(…, jumpToDepotEntity)`, which can only target a depot. `makeCustomVehicleCreateOrUpdateCmd` is aircraft-only. - Together with the earlier results (no native passing, `timeToIgnore` unreachable, set-line doesn't force lanes, segment rebuild has no effect on single-lane roads), **no script mechanism moves a vehicle past another on a single-lane road.** Details: docs/research/vehicle-probe.md on branch prototype/vehicle-probe (the flip code is last in commit 0465a93 and removed in 9623abb).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: haylan/tpf3-overtake#12