1 # common functions used by Elidragon v2 scripts
4 echo "/tmp/ElidragonV2_$1_lock"
7 function world_screenname {
8 echo "Elidragon v2 - $1"
12 kill `cat \`world_lock $1\``
16 return $(test -f `world_lock $1`)
19 function loop_worlds {
21 for WORLD in $WORLDS; do
26 function assert_running {
27 if ! is_running $1; then
28 echo -e "\e[31mWorld $1 is not running\e[0m"
37 function assert_not_running {
38 if is_running $1; then
39 echo -e "\e[31mWorld $1 is already running\e[0m"
48 function start_world {
49 echo -n "Starting $1... "
50 if assert_not_running $1 "true"; then
53 screen -dmS `world_screenname $1` bash -c "
54 while is_running $1; do
57 exec minetest --server --terminal --world worlds/$1 --config worlds/$1/minetest.conf --logfile worlds/$1/debug.txt
63 echo -e "\e[32mDone\e[0m"
68 echo -n "Stopping $1..."
69 if assert_running $1 "true"; then
73 echo -e "\e[32mDone\e[0m"
77 function restart_world {
78 echo -n "Restarting $1..."
79 if assert_running $1 "true"; then
82 echo -e "\e[32mDone\e[0m"
86 function run_one_or_all {