fix(@projects/@magic-civilization): 🐛 update godot headless path and env vars

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-04-15 17:03:47 -07:00
parent df3064a6c9
commit 42aaf38d3e

View file

@ -1,21 +1,18 @@
#!/bin/bash
# Godot headless autoplay runner. Uses Godot's --headless flag (no weston,
# no Wayland, no X). Screenshots will be blank but turn_stats.jsonl /
# events.jsonl / saves/ are produced.
set -uo pipefail
export XDG_RUNTIME_DIR=/run/user/$(id -u)
pkill -f "weston.*godot-headless" 2>/dev/null || true
pkill -f "flatpak run.*Godot" 2>/dev/null || true
pkill -f godot 2>/dev/null || true
sleep 1
weston --backend=headless --socket=godot-headless --width=1920 --height=1080 &
WESTON_PID=$!
sleep 3
export WAYLAND_DISPLAY=godot-headless
: "${AUTO_PLAY:=true}"
: "${AUTO_PLAY_DIR:=/tmp/ap_default}"
: "${AUTO_PLAY_DIR:=$HOME/tmp/ap_default}"
: "${AUTO_PLAY_TURN_LIMIT:=500}"
mkdir -p "$AUTO_PLAY_DIR"
cd ~/Code/@projects/@magic-civilization/src/game
cd "$HOME/Code/@projects/@magic-civilization/src/game"
SAFETY=$((AUTO_PLAY_TURN_LIMIT * 2 + 300))
FLATPAK_ENVS=(
"--env=WAYLAND_DISPLAY=godot-headless"
"--env=AUTO_PLAY=true"
"--env=AUTO_PLAY_DIR=$AUTO_PLAY_DIR"
"--env=AUTO_PLAY_TURN_LIMIT=$AUTO_PLAY_TURN_LIMIT"
@ -24,11 +21,8 @@ if [ -n "${AUTO_PLAY_SEED:-}" ]; then
FLATPAK_ENVS+=("--env=AUTO_PLAY_SEED=$AUTO_PLAY_SEED")
fi
timeout "$SAFETY" flatpak run --user \
--socket=wayland \
--filesystem=home \
--filesystem=xdg-run/godot-headless \
"${FLATPAK_ENVS[@]}" \
org.godotengine.Godot --path . --rendering-method gl_compatibility 2>&1
org.godotengine.Godot --path . --headless 2>&1
EXIT=$?
kill $WESTON_PID 2>/dev/null || true
echo "EXIT_CODE=$EXIT"