Update xpanes init.lua

Uses `minetest.swap_node` instead of `minetest.set_node`.
Make rotation %2, since the panes look the same both ways.
This commit is contained in:
mbartlett21 2019-09-02 20:03:51 +10:00 committed by GitHub
parent e8097c9e87
commit 0622f544a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,7 +27,7 @@ local function swap(pos, node, name, param2)
return
end
minetest.set_node(pos, {name = name, param2 = param2})
minetest.swap_node(pos, {name = name, param2 = param2})
end
local function update_pane(pos)
@ -54,10 +54,10 @@ local function update_pane(pos)
if count == 0 then
swap(pos, node, name .. "_flat", any)
elseif count == 1 then
swap(pos, node, name .. "_flat", (any + 1) % 4)
swap(pos, node, name .. "_flat", (any + 1) % 2)
elseif count == 2 then
if (c[0] and c[2]) or (c[1] and c[3]) then
swap(pos, node, name .. "_flat", (any + 1) % 4)
swap(pos, node, name .. "_flat", (any + 1) % 2)
else
swap(pos, node, name, 0)
end