autofly: fix regression
This commit is contained in:
parent
af4d3c1e72
commit
2ac62c69b7
12
automt
12
automt
@ -2,11 +2,21 @@
|
|||||||
if [ -z $1 ] || [ -z $2 ] || [ -z $3 ]; then echo "usage: automat server username password"; exit 1; fi
|
if [ -z $1 ] || [ -z $2 ] || [ -z $3 ]; then echo "usage: automat server username password"; exit 1; fi
|
||||||
pwf=~/.mtpw
|
pwf=~/.mtpw
|
||||||
srv=$1
|
srv=$1
|
||||||
|
prt=30000
|
||||||
usr=$2
|
usr=$2
|
||||||
pas=$3
|
pas=$3
|
||||||
logfile=$HOME/.wslog
|
logfile=$HOME/.wslog
|
||||||
mtpath=$(dirname $0)
|
mtpath=$(dirname $0)
|
||||||
if [ -f $pwf ]; then pas=$(cat $pwf); fi
|
if [ -f $pwf ]; then pas=$(cat $pwf); fi
|
||||||
|
check_host() {
|
||||||
|
if [ ! -x $(which nc) ]; then return 0; fi
|
||||||
|
if nc -z $1 $2; then return 0; fi
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
$mtpath/bin/minetest --go --address $srv --name $usr --password $pas --logfile $logfile --color never
|
if check_host $srv $prt; then
|
||||||
|
$mtpath/bin/minetest --go --address $srv --name $usr --password $pas --logfile $logfile
|
||||||
|
else echo host is down. waiting 10...; sleep 10
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
@ -108,7 +108,7 @@ minetest.register_globalstep(function()
|
|||||||
local etatime=-1
|
local etatime=-1
|
||||||
if not (speed == 0) then etatime = round2(dst / speed / 60,2) end
|
if not (speed == 0) then etatime = round2(dst / speed / 60,2) end
|
||||||
autofly.set_hud_info(autofly.last_name .. "\n" .. pos_to_string(pos) .. "\n" .. "ETA" .. etatime .. " mins")
|
autofly.set_hud_info(autofly.last_name .. "\n" .. pos_to_string(pos) .. "\n" .. "ETA" .. etatime .. " mins")
|
||||||
if dst < landing_distance then
|
if autofly.flying and dst < landing_distance then
|
||||||
autofly.arrived()
|
autofly.arrived()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user