play.sh to start the game; Godot checks shared with run_server.sh
This commit is contained in:
@@ -8,37 +8,9 @@
|
||||
# Set GODOT=/path/to/godot to use a particular Godot. Stop it with Ctrl+C.
|
||||
#
|
||||
# Before starting it checks that Godot is 4.7 or newer, and imports a fresh
|
||||
# copy of the project once (Godot's class cache lives in .godot/, which isn't
|
||||
# in git, so a new clone can't run headless until it has been imported).
|
||||
# copy of the project once (tools/godot_env.sh).
|
||||
|
||||
cd "$(dirname "$0")/.." || exit 1
|
||||
|
||||
GODOT="${GODOT:-godot}"
|
||||
if ! command -v "$GODOT" >/dev/null 2>&1; then
|
||||
# macOS: use the app bundle if `godot` isn't on the PATH.
|
||||
if [ -x /Applications/Godot.app/Contents/MacOS/Godot ]; then
|
||||
GODOT=/Applications/Godot.app/Contents/MacOS/Godot
|
||||
else
|
||||
echo "Can't find Godot. Install 4.7.2 from https://godotengine.org/download, or set GODOT=/path/to/godot" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
version=$("$GODOT" --version 2>/dev/null | tail -n 1)
|
||||
major=$(echo "$version" | cut -d. -f1)
|
||||
minor=$(echo "$version" | cut -d. -f2)
|
||||
if [ -z "$major" ] || [ "$major" -lt 4 ] || { [ "$major" -eq 4 ] && [ "$minor" -lt 7 ]; }; then
|
||||
echo "This game needs Godot 4.7 or newer, but $GODOT is ${version:-unknown}." >&2
|
||||
echo "Download 4.7.2 from https://godotengine.org/download (or set GODOT=/path/to/a/newer/godot)" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f .godot/global_script_class_cache.cfg ]; then
|
||||
echo "First run on this copy: importing the project (a few seconds)..."
|
||||
if ! "$GODOT" --headless --path . --import >/dev/null 2>&1 || [ ! -f .godot/global_script_class_cache.cfg ]; then
|
||||
echo "Import failed. Try: $GODOT --headless --path . --import" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
. tools/godot_env.sh
|
||||
|
||||
exec "$GODOT" --headless --path . -- --server "$@"
|
||||
|
||||
Reference in New Issue
Block a user