From 1524a9f610d1116604255b9d0f479c8c43da6633 Mon Sep 17 00:00:00 2001 From: Novatux Date: Wed, 5 Jun 2013 16:22:45 +0200 Subject: [PATCH] Frames destroy liquids they should replace and are not blocked by them. --- technic/frames.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/technic/frames.lua b/technic/frames.lua index 565a2ef..7d141dc 100644 --- a/technic/frames.lua +++ b/technic/frames.lua @@ -1,3 +1,5 @@ +frames={} + function get_face(pos,ppos,pvect) ppos={x=ppos.x-pos.x,y=ppos.y-pos.y+1.5,z=ppos.z-pos.z} if pvect.x>0 then @@ -360,8 +362,10 @@ end function move_nodes_vect(poslist,vect) for _,pos in ipairs(poslist) do - local npos=addVect(pos,vect) - if minetest.env:get_node(npos).name~="air" and not(pos_in_list(poslist,npos)) then return end + local npos=frames.addVect(pos,vect) + local name = minetest.env:get_node(npos).name + if (name~="air" and minetest.registered_nodes[name].liquidtype=="none") and not(pos_in_list(poslist,npos)) then + return end end nodelist={} for _,pos in ipairs(poslist) do @@ -376,14 +380,14 @@ function move_nodes_vect(poslist,vect) end end for _,obj in ipairs(objects) do - obj:setpos(addVect(obj:getpos(),vect)) + obj:setpos(frames.addVect(obj:getpos(),vect)) le=obj:get_luaentity() if le and le.name == "pipeworks:tubed_item" then - le.start_pos=addVect(le.start_pos,vect) + le.start_pos=frames.addVect(le.start_pos,vect) end end for _,n in ipairs(nodelist) do - local npos=addVect(n.pos,vect) + local npos=frames.addVect(n.pos,vect) minetest.env:set_node(npos,n.node) local meta=minetest.env:get_meta(npos) meta:from_table(n.meta) @@ -406,7 +410,7 @@ function get_connected_nodes(pos) return c end -function addVect(pos,vect) +function frames.addVect(pos,vect) return {x=pos.x+vect.x,y=pos.y+vect.y,z=pos.z+vect.z} end @@ -419,7 +423,7 @@ end function connected(pos,c,adj) for _,vect in ipairs(adj) do - local pos1=addVect(pos,vect) + local pos1=frames.addVect(pos,vect) local nodename=minetest.env:get_node(pos1).name if not(pos_in_list(c,pos1)) and nodename~="air" and (minetest.registered_nodes[nodename].frames_can_connect==nil or