3 # Abort the script on error.
6 # Don't let any log leftovers from before interfere.
12 # Abort if no proper Python version installed.
13 test=`command -v python3 | wc -l`
17 echo "No python3 installed, but it's needed!"
21 # Give helpful message to players that want to start without compiling first.
22 if [ ! -e ./roguelike-client ]
24 echo 'No ./roguelike-client executable found. Try "./redo" first?'
27 if [ ! -e ./libplomrogue.so ]
29 echo 'No ./libplomrogue.so library found. Try "./redo" first?'
33 # Use shell script's arguments for server and pipe server output to log file.
34 # This script's wrapper script will read it out on exit.
35 python3 ./roguelike-server "$@" > log 2>&1 &
37 # Give server some time to start up and exit on error.
40 # The client should not start if the server is not running. (If the server was
41 # running in the foreground, any error exit of it so far would be caught by "set
42 # -e" above. But "set -e" is blind to error codes generated in the background.)
43 kill -0 $! 2> /dev/null
45 # Give server some time (max. 10 seconds) to generate its worldstate file.
47 while [ ! -e server/worldstate ] && [ $i -le 1000 ]
52 if [ ! -e server/worldstate ]
54 echo "Server failed generating worldstate file within given time limit."
58 # Only start the interface when everything else went well.
59 kill -0 $! 2> /dev/null