Aktualizovat „mesecons/mesecons_pistons/init.lua“
This commit is contained in:
parent
29689c6335
commit
9d33641453
1 changed files with 12 additions and 4 deletions
|
@ -86,11 +86,12 @@ local piston_on = function(pos, node)
|
|||
local pistonspec = get_pistonspec(node.name, "offname")
|
||||
local dir = vector.multiply(minetest.facedir_to_dir(node.param2), -1)
|
||||
local pusher_pos = vector.add(pos, dir)
|
||||
local success, stack, oldstack = mesecon.mvps_push(pusher_pos, dir, max_push)
|
||||
local owner = minetest.get_meta(pos):get_string("owner")
|
||||
local success, stack, oldstack = mesecon.mvps_push(pusher_pos, dir, max_push, owner)
|
||||
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,
|
||||
|
@ -103,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)
|
||||
|
||||
if not pistonspec.sticky then
|
||||
|
@ -111,7 +112,8 @@ local function piston_off(pos, node)
|
|||
end
|
||||
local dir = minetest.facedir_to_dir(node.param2)
|
||||
local pullpos = vector.add(pos, vector.multiply(dir, -2))
|
||||
local success, stack, oldstack = mesecon.mvps_pull_single(pullpos, dir, max_pull)
|
||||
local owner = minetest.get_meta(pos):get_string("owner")
|
||||
local success, stack, oldstack = mesecon.mvps_pull_single(pullpos, dir, max_pull, owner)
|
||||
if success then
|
||||
mesecon.mvps_move_objects(pullpos, vector.multiply(dir, -1), oldstack, -1)
|
||||
end
|
||||
|
@ -281,6 +283,9 @@ minetest.register_node("mesecons_pistons:piston_normal_off", {
|
|||
}},
|
||||
on_rotate = piston_rotate,
|
||||
on_blast = mesecon.on_blastnode,
|
||||
after_place_node = function(pos, placer)
|
||||
minetest.get_meta(pos):set_string("owner", placer:get_player_name())
|
||||
end,
|
||||
})
|
||||
|
||||
-- onstate
|
||||
|
@ -359,6 +364,9 @@ minetest.register_node("mesecons_pistons:piston_sticky_off", {
|
|||
}},
|
||||
on_rotate = piston_rotate,
|
||||
on_blast = mesecon.on_blastnode,
|
||||
after_place_node = function(pos, placer)
|
||||
minetest.get_meta(pos):set_string("owner", placer:get_player_name())
|
||||
end,
|
||||
})
|
||||
|
||||
-- onstate
|
||||
|
|
Loading…
Reference in a new issue