3 # Abort the script on error.
6 # Don't let any log leftovers from before interfere.
12 # Give helpful message to players that want to start without compiling first.
13 if [ ! -e ./roguelike-client ]
15 echo 'No ./roguelike-client file found to execute. Try "./redo" first?'
19 # Use shell script's arguments for server and pipe server output to log file.
20 # This script's wrapper script will read it out on exit.
21 python3 ./plomrogue-server.py "$@" > log 2>&1 &
23 # Give server some time to start up and exit on error.
26 # The client should not start if the server is not running. (If the server was
27 # running in the foreground, any error exit of it so far would be caught by "set
28 # -e" above. But "set -e" is blind to error codes generated in the background.)
29 kill -0 $! 2> /dev/null
31 # Give server some time (max. 10 seconds) to generate its worldstate file.
33 while [ ! -e server/worldstate ] && [ $i -le 1000 ]
38 if [ ! -e server/worldstate ]
40 echo "Server failed generating worldstate file within given time limit."
44 # Only start the interface when everything else went well.
45 kill -0 $! 2> /dev/null