Skip to content

Commit

Permalink
Do not stop node timers on mvps move (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
Desour authored and sfan5 committed Sep 11, 2017
1 parent 36a6419 commit 42cd973
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mesecons_mvps/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, all_pull_sti
-- remove all nodes
for _, n in ipairs(nodes) do
n.meta = minetest.get_meta(n.pos):to_table()
local node_timer = minetest.get_node_timer(n.pos)
if node_timer:is_started() then
n.node_timer = {node_timer:get_timeout(), node_timer:get_elapsed()}
end
minetest.remove_node(n.pos)
end

Expand All @@ -179,6 +183,9 @@ function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, all_pull_sti

minetest.set_node(np, n.node)
minetest.get_meta(np):from_table(n.meta)
if n.node_timer then
minetest.get_node_timer(np):set(unpack(n.node_timer))
end
end

local moved_nodes = {}
Expand All @@ -190,6 +197,7 @@ function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, all_pull_sti
moved_nodes[i].pos = nodes[i].pos
moved_nodes[i].node = nodes[i].node
moved_nodes[i].meta = nodes[i].meta
moved_nodes[i].node_timer = nodes[i].node_timer
end

on_mvps_move(moved_nodes)
Expand Down

0 comments on commit 42cd973

Please sign in to comment.