This is the basic of what I'm attempting (very, very not done!)
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
local ppos
local pname
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack)
if ppos ~= nil then
minetest.debug("(" .. ppos.x .. "," .. ppos.y .. "," .. ppos.z .. ")")
local directions = {
(ppos.x == pos.x and 1 or 0),
(ppos.y == pos.y and 1 or 0),
(ppos.z == pos.z and 1 or 0)}
for i = 0, # directions do
if directions[i] == 1 then
local npos = pos
for j = pos[i], ppos[i] do
npos[i] = j
set_node(npos, pname)
end
end
end
end
ppos = pos
pname = newnode.name
end
)
The issue is that ppos and pname are always nil, when I want them (or the small table that will replace them) to persist between node placements.