Skip to content

Commit

Permalink
Better textline handling without rotating node
Browse files Browse the repository at this point in the history
  • Loading branch information
SX authored and BuckarooBanzay committed Dec 14, 2020
1 parent c91ec73 commit 91769cd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions compat/textline.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@

local textline_def = minetest.registered_nodes["textline:lcd"]
assert(textline_def)
assert(textline_def.after_place_node)

-- refresh textline entities after the jump
minetest.override_item("textline:lcd", {
on_movenode = function(from_pos, to_pos)
minetest.after(1, function()
textline_def.after_place_node(to_pos)
end)
local delta_vector = vector.subtract(to_pos, from_pos)
local objects = minetest.get_objects_inside_radius(from_pos, 0.5)
for _,object in ipairs(objects) do
local entity = object:get_luaentity()
if entity and entity.name == "textline:text" then
object:set_pos(vector.add(object:get_pos(), delta_vector))
end
end
end
})

0 comments on commit 91769cd

Please sign in to comment.