diff --git a/basis/fly_lib.lua b/basis/fly_lib.lua index 9370e79..ed1840b 100644 --- a/basis/fly_lib.lua +++ b/basis/fly_lib.lua @@ -863,19 +863,21 @@ function flylib.reset_move(pos) if nvm.running then return false end if meta:get_string("teleport_mode") == "enable" then return false end - if nvm.moveBA then -- A/B mode has no nvm.lastpos - if nvm.lpos2 and nvm.lpos2[1] then - local move = vector.subtract(nvm.lpos2[1], nvm.lpos1[1]) - nvm.running, nvm.lastpos = move_nodes(pos, meta, nvm.lpos2, move, max_speed, height) - return nvm.running - end - else + if meta:get_string("opmode") == "move xyz" then if nvm.lpos1 and nvm.lpos1[1] then local move = vector.subtract(nvm.lpos1[1], (nvm.lastpos or nvm.lpos2)[1]) local lpos = nvm.lastpos or nvm.lpos1 nvm.running, nvm.lastpos = move_nodes(pos, meta, lpos, move, max_speed, height) return nvm.running end + else + if nvm.moveBA then + if nvm.lpos1 and nvm.lpos1[1] and nvm.lpos2 and nvm.lpos2[1] then + local move = vector.subtract(nvm.lpos1[1], nvm.lpos2[1]) + nvm.running, _ = move_nodes(pos, meta, nvm.lpos2, move, max_speed, height) + return nvm.running + end + end end return false end diff --git a/move_controller/doorcontroller2.lua b/move_controller/doorcontroller2.lua index c133a92..8618104 100644 --- a/move_controller/doorcontroller2.lua +++ b/move_controller/doorcontroller2.lua @@ -93,11 +93,11 @@ local function formspec1(nvm, meta) local play_sound = dump(nvm.play_sound or false) return "size[8,7]".. "tabheader[0,0;tab;"..S("Ctrl,Inv")..";1;;true]".. - "button[0.7,0.0;3,1;record;"..S("Record").."]".. + "button_exit[0.7,0.0;3,1;record;"..S("Record").."]".. "button[4.3,0.0;3,1;ready;"..S("Done").."]".. - "button[0.7,0.9;3,1;reset;"..S("Reset").."]".. - "button[4.3,0.9;3,1;exchange;"..S("Exchange").."]".. - "button[0.7,1.8;3,1;show;"..S("Show positions").."]".. + "button_exit[0.7,0.9;3,1;reset;"..S("Reset").."]".. + "button_exit[4.3,0.9;3,1;exchange;"..S("Exchange").."]".. + "button_exit[0.7,1.8;3,1;show;"..S("Show positions").."]".. "checkbox[4.3,1.8;play_sound;"..S("with door sound")..";"..play_sound.."]".. "label[0.5,2.8;"..status.."]".. "list[current_player;main;0,3.3;8,4;]" diff --git a/move_controller/movecontroller.lua b/move_controller/movecontroller.lua index a701746..157f17c 100644 --- a/move_controller/movecontroller.lua +++ b/move_controller/movecontroller.lua @@ -66,13 +66,13 @@ local function formspec(nvm, meta) buttons = "field[0.4,2.3;3.8,1;path;" .. S("Move distance") .. ";" .. path .. "]" .. "button_exit[4.1,2.0;3.8,1;move2;" .. S("Move") .. "]" .. "button_exit[0.1,3.0;3.8,1;reset;" .. S("Reset") .. "]" .. - "button[4.1,3.0;3.8,1;show;" .. S("Show positions") .. "]" + "button_exit[4.1,3.0;3.8,1;show;" .. S("Show positions") .. "]" else buttons = "field[0.4,2.3;3.8,1;path;" .. S("Move distance (A to B)") .. ";" .. path .. "]" .. "button_exit[0.1,3.0;3.8,1;moveAB;" .. S("Move A-B") .. "]" .. "button_exit[4.1,3.0;3.8,1;moveBA;" .. S("Move B-A") .. "]" .. "button[4.1,2.0;3.8,1;store;" .. S("Store") .. "]" .. - "button[0.1,4.0;3.8,1;show;" .. S("Show positions") .. "]" .. + "button_exit[0.1,4.0;3.8,1;show;" .. S("Show positions") .. "]" .. "button_exit[4.1,4.0;3.8,1;reset;" .. S("Reset") .. "]" end return "size[8,5.5]" .. @@ -82,7 +82,7 @@ local function formspec(nvm, meta) "box[0,-0.1;7.2,0.5;#c6e8ff]" .. "label[0.2,-0.1;" .. minetest.colorize( "#000000", S("TA4 Move Controller")) .. "]" .. techage.wrench_image(7.4, -0.05) .. - "button[0.1,0.7;3.8,1;record;" .. S("Record") .. "]" .. + "button_exit[0.1,0.7;3.8,1;record;" .. S("Record") .. "]" .. "button[4.1,0.7;3.8,1;done;" .. S("Done") .. "]" .. buttons .. "label[0.3,5.0;" .. status .. "]" @@ -117,6 +117,7 @@ minetest.register_node("techage:ta4_movecontroller", { nvm.lpos1 = {} nvm.lpos2 = {} nvm.moveBA = false + nvm.recording = true nvm.running = nil nvm.lastpos = nil meta:set_string("status", S("Recording...")) @@ -125,7 +126,8 @@ minetest.register_node("techage:ta4_movecontroller", { mark.unmark_all(name) mark.start(name, MAX_BLOCKS) meta:set_string("formspec", formspec(nvm, meta)) - elseif fields.done then + elseif fields.done and nvm.recording then + nvm.recording = false local name = player:get_player_name() local pos_list = mark.get_poslist(name) if fly.to_vector(fields.path or "", MAX_DIST) then