Actually call the mvps callback

This commit is contained in:
Novatux 2014-01-03 15:19:43 +01:00
parent 52e7014b7c
commit e1c995f654

@ -108,36 +108,26 @@ local function move_nodes_vect(poslist,vect,must_not_move,owner)
return
end]]
end
nodelist={}
frameslist = {}
local nodelist = {}
for _, pos in ipairs(poslist) do
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos):to_table()
nodelist[#(nodelist)+1]={pos=pos,node=node,meta=meta}
if frames_pos[pos_to_string(pos)] then
frameslist[#frameslist+1] = {pos=pos, name=frames_pos[pos_to_string(pos)]}
frames_pos[pos_to_string(pos)] = nil
nodelist[#(nodelist)+1] = {oldpos = pos, pos = vector.add(pos, vect), node = node, meta = meta}
end
end
objects={}
local objects = {}
for _, pos in ipairs(poslist) do
for _,object in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
local entity = object:get_luaentity()
if not entity or not mesecon:is_mvps_unmov(entity.name) then
add_table(objects, object)
end
end
end
for _, obj in ipairs(objects) do
obj:setpos(vector.add(obj:getpos(), vect))
le=obj:get_luaentity()
if le and le.name == "pipeworks:tubed_item" then
le.start_pos=vector.add(le.start_pos,vect)
end
end
for _, n in ipairs(frameslist) do
local npos=vector.add(n.pos,vect)
frames_pos[pos_to_string(npos)] = n.name
end
for _,n in ipairs(nodelist) do
local npos=vector.add(n.pos,vect)
local npos = n.pos
minetest.set_node(npos, n.node)
local meta = minetest.get_meta(npos)
meta:from_table(n.meta)
@ -151,6 +141,9 @@ local function move_nodes_vect(poslist,vect,must_not_move,owner)
for __, pos in ipairs(poslist) do
minetest.remove_node(pos)
end
for _, callback in ipairs(mesecon.on_mvps_move) do
callback(nodelist)
end
end
local function is_supported_node(name)