Rebuild and relaunch the session
restartRestart a running tModLoader session by stopping, rebuilding, and relaunching with the same settings, avoiding build errors from an open game.
Instructions
Stop, rebuild, and start again with the session's own settings.
Args: build: Compile the mod between stopping and starting. On by default, because picking up a code change is the reason this loop exists. timeout: Seconds to wait for readiness on the relaunch. build_timeout: Seconds to allow the compile.
THE ORDER IS THE POINT. tModLoader REFUSES to build while the game is open and reports it with an error that reads like a compile failure, so stop-then-build-then-launch is not a preference — building first sends you hunting a syntax error that is not there. Three separate calls let a caller get that order wrong; this one cannot.
The mode, port, player and WORLD come from the running session rather than
from arguments or defaults. That last one is why Session had to start
recording the world it resolved: a relaunch that fell back to the
configured default would quietly load a different world than the one being
tested, and report success.
Needs a running session, because a session is where those settings live.
With nothing running there is nothing to reuse — call launch.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| build | No | ||
| timeout | No | ||
| build_timeout | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | Yes | ||
| port | Yes | ||
| built | Yes | ||
| world | Yes | ||
| player | Yes | ||
| killed_pids | Yes | ||
| started_pids | Yes | ||
| build_summary | Yes |