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 ./libplomrogue.so ]
24 echo 'No ./libplomrogue.so library found. Building …'
28 # Use shell script's arguments for server and pipe server output to log file.
29 # This script's wrapper script will read it out on exit.
30 python3 ./roguelike-server "$@" > log 2>&1 &
32 # Give server some time to start up and exit on error.
35 # The client should not start if the server is not running. (If the server was
36 # running in the foreground, any error exit of it so far would be caught by "set
37 # -e" above. But "set -e" is blind to error codes generated in the background.)
38 kill -0 $! 2> /dev/null
40 # Give server some time (max. 10 seconds) to generate its worldstate file.
42 while [ ! -e server_run/worldstate ] && [ $i -le 1000 ]
47 if [ ! -e server_run/worldstate ]
49 echo "Server failed generating worldstate file within given time limit."
53 # Only start the interface when everything else went well.
54 kill -0 $! 2> /dev/null
55 python3 ./roguelike-client