Code: Select all
timeout -f "$TIMEOUT" bash -c '/opt/factorio/bin/x64/factorio \
--start-server-load-scenario "$SCENARIO_NAME" \
--mod-directory "$MODS" \
--server-settings "$CONFIG/server-settings.json" 2>&1 | \
while IFS= read -r line; do
printf "%s\\n" "$line"
case "$line" in
(*__FUNIT__*====END====*)
echo "FUNIT end signal detected"
touch "$EARLY_SUCCESS_FLAG"
pkill -TERM -f ".*factorio.*--start-server-load-scenario" 2>/dev/null || true
exit 0
;;
esac
done
exit ${PIPESTATUS[0]}'
EXIT_CODE=$?
if [ -f "$EARLY_SUCCESS_FLAG" ]; then
rm -f "$EARLY_SUCCESS_FLAG"
EXIT_CODE=0
fi
- Add a command line parameter to tell Factorio to exit when game state is set to game_finished = true
- Add a command line parameter to specify some other way for a script to signal the game to exit
- Change to --until-tick parameter to work with more options (does not currently work with --start-server-load-scenario)
