magicciv/scripts/apricot/run_seeded.sh
Natalie df3064a6c9 feat(@projects/@magic-civilization): add automated play scripts
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-04-16 17:51:23 -07:00

25 lines
798 B
Bash
Executable file

#!/bin/bash
SEED="${1:-1}"
TURN_LIMIT="${2:-200}"
export XDG_RUNTIME_DIR=/run/user/$(id -u)
killall -q weston godot 2>/dev/null
sleep 1
weston --backend=headless --socket=godot-headless --width=1920 --height=1080 &
sleep 3
export WAYLAND_DISPLAY=godot-headless
DIR="/tmp/ap_seeded_${SEED}"
rm -rf "$DIR"
mkdir -p "$DIR"
cd ~/Code/@projects/@magic-civilization/src/game
timeout $((TURN_LIMIT * 2 + 300)) flatpak run --user \
--socket=wayland \
--filesystem=/tmp \
--filesystem=home \
--filesystem=xdg-run/godot-headless \
--env=WAYLAND_DISPLAY=godot-headless \
--env=AUTO_PLAY=true \
--env=AUTO_PLAY_SEED="$SEED" \
--env=AUTO_PLAY_TURN_LIMIT="$TURN_LIMIT" \
--env=AUTO_PLAY_DIR="$DIR" \
org.godotengine.Godot --path . --rendering-method gl_compatibility 2>&1
echo "EXIT_CODE=$?"