#!/usr/bin/env bash # Startet das Spiel. Godot liegt auf dieser Maschine nicht im PATH, sondern # unter /opt/godot — das Skript findet beides. set -euo pipefail HIER="$(cd "$(dirname "$0")" && pwd)" if [ -n "${GODOT:-}" ]; then : elif command -v godot >/dev/null 2>&1; then GODOT="$(command -v godot)" elif [ -x "/Applications/Godot.app/Contents/MacOS/Godot" ]; then GODOT="/Applications/Godot.app/Contents/MacOS/Godot" elif [ -x "/opt/godot/Godot_v4.7.2-stable_linux.x86_64" ]; then GODOT="/opt/godot/Godot_v4.7.2-stable_linux.x86_64" else echo "Godot nicht gefunden. Setze GODOT=/pfad/zu/godot" >&2 exit 1 fi # Frischer Klon / neue Maschine: ohne .godot/ fehlt der Cache der globalen # class_name (Dice, Auftrag, Charakter …) — die Skripte scheitern dann schon # beim Parsen. Einmal importieren, dann starten. if [ ! -f "$HIER/game/.godot/global_script_class_cache.cfg" ]; then echo "Erster Start: importiere Assets …" >&2 IMPORT_LOG="${TMPDIR:-/tmp}/taloria-import.log" "$GODOT" --headless --path "$HIER/game" --import >"$IMPORT_LOG" 2>&1 || { echo "Import fehlgeschlagen — siehe $IMPORT_LOG" >&2 exit 1 } fi exec "$GODOT" --path "$HIER/game" "$@"