Fix meta handling

This commit is contained in:
number Zero 2019-06-28 00:29:23 +03:00
parent c2af1b2e67
commit 3eba0bfba9
3 changed files with 8 additions and 6 deletions

View File

@ -56,6 +56,8 @@ function mesecon.register_movestone(name, def, is_sticky, is_vertical)
-- ### Step 2: Move the movestone ###
minetest.set_node(frontpos, node)
local meta2 = minetest.get_meta(frontpos)
meta2:from_table(meta:to_table())
minetest.remove_node(pos)
mesecon.on_dignode(pos, node)
mesecon.on_placenode(frontpos, node)

View File

@ -137,11 +137,11 @@ function mesecon.mvps_mark_owner(pos, placer)
local meta = minetest.get_meta(pos)
local owner = placer and placer.get_player_name and placer:get_player_name()
if owner and owner ~= "" then
meta.set_string("owner", owner)
meta.set_string("infotext", "Owned by " .. owner)
meta:set_string("owner", owner)
meta:set_string("infotext", "Owned by " .. owner)
else
meta.set_string("owner", "$unknown") -- to distinguish from older pistons
meta.set_string("infotext", "Unowned")
meta:set_string("owner", "$unknown") -- to distinguish from older pistons
meta:set_string("infotext", "Unowned")
end
end

View File

@ -91,7 +91,7 @@ local piston_on = function(pos, node)
if not success then
return
end
minetest.set_node(pos, {param2 = node.param2, name = pistonspec.onname})
minetest.swap_node(pos, {param2 = node.param2, name = pistonspec.onname})
minetest.set_node(pusher_pos, {param2 = node.param2, name = pistonspec.pusher})
minetest.sound_play("piston_extend", {
pos = pos,
@ -104,7 +104,7 @@ end
local function piston_off(pos, node)
local pistonspec = get_pistonspec(node.name, "onname")
minetest.set_node(pos, {param2 = node.param2, name = pistonspec.offname})
minetest.swap_node(pos, {param2 = node.param2, name = pistonspec.offname})
piston_remove_pusher(pos, node, not pistonspec.sticky) -- allow that even in protected area
if not pistonspec.sticky then