#!/usr/bin/env bash # Collaudo grafico del client Godot: compila server e client, importa il progetto, avvia una # partita locale con il pilota automatico (stazioni, ponte, treni) e salva le schermate. # Senza display usa xvfb-run (rendering software Mesa). # Uso: GODOT=/percorso/Godot_v4.7.2-stable_mono_linux.x86_64 scripts/client-autopilot.sh [cartella] set -euo pipefail cd "$(dirname "$0")/.." godot="${GODOT:-godot}" out="$(realpath -m "${1:-out/autopilot}")" mkdir -p "$out" dotnet build src/RailEnterprise.Server -c Release -v quiet -nologo dotnet build client/RailEnterprise.Client/RailEnterprise.Client.csproj -c Debug -v quiet -nologo "$godot" --headless --path client/RailEnterprise.Client --import >/dev/null 2>&1 || true run=("$godot" --path client/RailEnterprise.Client --rendering-driver opengl3 --resolution 1600x900 --windowed -- --autopilot "$out") if [ -z "${DISPLAY:-}" ] && command -v xvfb-run >/dev/null 2>&1; then xvfb-run -a -s "-screen 0 1600x900x24" "${run[@]}" 2>&1 | grep -E "autopilot|ERROR" || true else "${run[@]}" 2>&1 | grep -E "autopilot|ERROR" || true fi ls "$out"/*.jpg >/dev/null 2>&1 && grep -q . <(ls "$out") && echo "client-autopilot: schermate in $out"