From d010256b05288a108e7a231b20fabdbd219cbfb6 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Mon, 10 Jan 2022 21:36:54 +0100 Subject: [PATCH] Fix two fly/move controller bugs --- basis/fly_lib.lua | 5 ++--- basis/lib.lua | 8 ++++++++ move_controller/flycontroller.lua | 6 +++--- move_controller/movecontroller.lua | 6 +++--- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/basis/fly_lib.lua b/basis/fly_lib.lua index a9064b7..4ae48b2 100644 --- a/basis/fly_lib.lua +++ b/basis/fly_lib.lua @@ -242,9 +242,8 @@ local function attach_objects(pos, offs, parent, yoffs) local dir = vector.subtract(obj:get_pos(), pos) local entity = obj:get_luaentity() if entity then - if entity.name == "__builtin:item" then -- dropped items - --obj:set_attach(objref, "", {x=0, y=0, z=0}, {x=0, y=0, z=0}, true) -- hier kracht es - elseif entity.name ~= "techage:move_item" then + local mod = entity.name:gmatch("(.-):")() + if techage.RegisteredMobsMods[mod] then dir.y = dir.y + yoffs attach_single_object(parent, obj, dir) end diff --git a/basis/lib.lua b/basis/lib.lua index edbe7c1..d605784 100644 --- a/basis/lib.lua +++ b/basis/lib.lua @@ -505,6 +505,14 @@ function techage.wrench_tooltip(x, y) "tooltip["..x..","..y..";0.5,0.5;"..tooltip..";#0C3D32;#FFFFFF]" end +techage.RegisteredMobsMods = {} + +-- Register mobs mods for the move/fly controllers +function techage.register_mobs_mods(mod) + techage.RegisteredMobsMods[mod] = true +end + + ------------------------------------------------------------------------------- -- Terminal history buffer ------------------------------------------------------------------------------- diff --git a/move_controller/flycontroller.lua b/move_controller/flycontroller.lua index 2db7300..3a9683e 100644 --- a/move_controller/flycontroller.lua +++ b/move_controller/flycontroller.lua @@ -96,7 +96,7 @@ minetest.register_node("techage:ta5_flycontroller", { nvm.lpos1 = {} nvm.lpos2 = {} nvm.moveBA = false - nvm.running = true + nvm.running = nil meta:set_string("status", S("Recording...")) local name = player:get_player_name() minetest.chat_send_player(name, S("Click on all blocks that shall be moved")) @@ -109,7 +109,7 @@ minetest.register_node("techage:ta5_flycontroller", { if not err then meta:set_string("path", fields.path) end - nvm.running = false + nvm.running = nil local text = #pos_list.." "..S("block positions are stored.") meta:set_string("status", text) nvm.lpos1 = pos_list @@ -128,7 +128,7 @@ minetest.register_node("techage:ta5_flycontroller", { local name = player:get_player_name() mark.stop(name) nvm.moveBA = false - nvm.running = true + nvm.running = nil elseif fields.test then local path, err = fly.to_path(fields.path, MAX_DIST) if err then diff --git a/move_controller/movecontroller.lua b/move_controller/movecontroller.lua index 92e2348..ab000ec 100644 --- a/move_controller/movecontroller.lua +++ b/move_controller/movecontroller.lua @@ -112,7 +112,7 @@ minetest.register_node("techage:ta4_movecontroller", { nvm.lpos1 = {} nvm.lpos2 = {} nvm.moveBA = false - nvm.running = true + nvm.running = nil meta:set_string("status", S("Recording...")) local name = player:get_player_name() minetest.chat_send_player(name, S("Click on all blocks that shall be moved")) @@ -125,7 +125,7 @@ minetest.register_node("techage:ta4_movecontroller", { meta:set_string("path", fields.path) end local text = #pos_list.." "..S("block positions are stored.") - nvm.running = false + nvm.running = nil meta:set_string("status", text) nvm.lpos1 = pos_list mark.unmark_all(name) @@ -142,7 +142,7 @@ minetest.register_node("techage:ta4_movecontroller", { local name = player:get_player_name() mark.stop(name) nvm.moveBA = false - nvm.running = true + nvm.running = nil elseif fields.moveAB then meta:set_string("status", "") if fly.move_to_other_pos(pos, false) then