Fix fly controller 'move' bug

This commit is contained in:
Joachim Stolberg 2022-01-07 17:29:56 +01:00
parent aedf234ae5
commit 0f14d504d5

View File

@ -133,7 +133,7 @@ minetest.register_node("techage:ta5_flycontroller", {
local path, err = fly.to_path(fields.path, MAX_DIST)
if err then
meta:set_string("status", err)
elseif path and nvm.lpos1 then
elseif path and nvm.lpos1 and nvm.lpos1[1] then
local pos = table.copy(nvm.lpos1[1])
if pos then
for _, offs in ipairs(path) do
@ -179,8 +179,7 @@ minetest.register_node("techage:ta5_flycontroller", {
meta:set_string("formspec", formspec(nvm, meta))
elseif fields.move then
meta:set_string("status", "")
nvm.moveBA = nvm.moveBA == false
if fly.move_to_other_pos(pos, nvm.moveBA == false) then
if fly.move_to_other_pos(pos, nvm.moveBA) then
nvm.moveBA = nvm.moveBA == false
nvm.running = true
meta:set_string("formspec", formspec(nvm, meta))