Fix two fly/move controller bugs

This commit is contained in:
Joachim Stolberg 2022-01-10 21:36:54 +01:00
parent 859be9954d
commit d010256b05
4 changed files with 16 additions and 9 deletions

View File

@ -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

View File

@ -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
-------------------------------------------------------------------------------

View File

@ -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

View File

@ -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