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 dir = vector.subtract(obj:get_pos(), pos)
local entity = obj:get_luaentity() local entity = obj:get_luaentity()
if entity then if entity then
if entity.name == "__builtin:item" then -- dropped items local mod = entity.name:gmatch("(.-):")()
--obj:set_attach(objref, "", {x=0, y=0, z=0}, {x=0, y=0, z=0}, true) -- hier kracht es if techage.RegisteredMobsMods[mod] then
elseif entity.name ~= "techage:move_item" then
dir.y = dir.y + yoffs dir.y = dir.y + yoffs
attach_single_object(parent, obj, dir) attach_single_object(parent, obj, dir)
end end

View File

@ -505,6 +505,14 @@ function techage.wrench_tooltip(x, y)
"tooltip["..x..","..y..";0.5,0.5;"..tooltip..";#0C3D32;#FFFFFF]" "tooltip["..x..","..y..";0.5,0.5;"..tooltip..";#0C3D32;#FFFFFF]"
end 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 -- Terminal history buffer
------------------------------------------------------------------------------- -------------------------------------------------------------------------------

View File

@ -96,7 +96,7 @@ minetest.register_node("techage:ta5_flycontroller", {
nvm.lpos1 = {} nvm.lpos1 = {}
nvm.lpos2 = {} nvm.lpos2 = {}
nvm.moveBA = false nvm.moveBA = false
nvm.running = true nvm.running = nil
meta:set_string("status", S("Recording...")) meta:set_string("status", S("Recording..."))
local name = player:get_player_name() local name = player:get_player_name()
minetest.chat_send_player(name, S("Click on all blocks that shall be moved")) 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 if not err then
meta:set_string("path", fields.path) meta:set_string("path", fields.path)
end end
nvm.running = false nvm.running = nil
local text = #pos_list.." "..S("block positions are stored.") local text = #pos_list.." "..S("block positions are stored.")
meta:set_string("status", text) meta:set_string("status", text)
nvm.lpos1 = pos_list nvm.lpos1 = pos_list
@ -128,7 +128,7 @@ minetest.register_node("techage:ta5_flycontroller", {
local name = player:get_player_name() local name = player:get_player_name()
mark.stop(name) mark.stop(name)
nvm.moveBA = false nvm.moveBA = false
nvm.running = true nvm.running = nil
elseif fields.test then elseif fields.test then
local path, err = fly.to_path(fields.path, MAX_DIST) local path, err = fly.to_path(fields.path, MAX_DIST)
if err then if err then

View File

@ -112,7 +112,7 @@ minetest.register_node("techage:ta4_movecontroller", {
nvm.lpos1 = {} nvm.lpos1 = {}
nvm.lpos2 = {} nvm.lpos2 = {}
nvm.moveBA = false nvm.moveBA = false
nvm.running = true nvm.running = nil
meta:set_string("status", S("Recording...")) meta:set_string("status", S("Recording..."))
local name = player:get_player_name() local name = player:get_player_name()
minetest.chat_send_player(name, S("Click on all blocks that shall be moved")) 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) meta:set_string("path", fields.path)
end end
local text = #pos_list.." "..S("block positions are stored.") local text = #pos_list.." "..S("block positions are stored.")
nvm.running = false nvm.running = nil
meta:set_string("status", text) meta:set_string("status", text)
nvm.lpos1 = pos_list nvm.lpos1 = pos_list
mark.unmark_all(name) mark.unmark_all(name)
@ -142,7 +142,7 @@ minetest.register_node("techage:ta4_movecontroller", {
local name = player:get_player_name() local name = player:get_player_name()
mark.stop(name) mark.stop(name)
nvm.moveBA = false nvm.moveBA = false
nvm.running = true nvm.running = nil
elseif fields.moveAB then elseif fields.moveAB then
meta:set_string("status", "") meta:set_string("status", "")
if fly.move_to_other_pos(pos, false) then if fly.move_to_other_pos(pos, false) then