3 # Abort the script on error.
6 # Run script in its own process group so SIGINT doesn't kill parent script.
9 # Don't let any log leftovers from before interfere.
15 # Abort if no proper Python version installed.
16 test=`command -v python3 | wc -l`
20 echo "No python3 installed, but it's needed!"
24 # Give helpful message to players that want to start without compiling first.
25 if [ ! -e ./libplomrogue.so ]
27 echo 'No ./libplomrogue.so library found. Building …'
31 # Use shell script's arguments for server and pipe server output to log file.
32 # This script's wrapper script will read it out on exit.
33 python3 ./roguelike-server "$@" > log 2>&1 &
35 # Give server some time to start up and exit on error.
38 # The client should not start if the server is not running. (If the server was
39 # running in the foreground, any error exit of it so far would be caught by "set
40 # -e" above. But "set -e" is blind to error codes generated in the background.)
41 kill -0 $! 2> /dev/null
43 # Give server some time (max. 10 seconds) to generate its worldstate file.
45 echo -n "Waiting for server to set up world: "
46 while [ ! -e server_run/worldstate ] && [ $i -le 100 ]
53 if [ ! -e server_run/worldstate ]
57 echo "Server failed generating worldstate file within time limit."
61 # Only start the interface when everything else went well.
62 kill -0 $! 2> /dev/null
63 python3 ./roguelike-client