From fb6111a3f626701e06a65131844efb02ee053b47 Mon Sep 17 00:00:00 2001 From: RealBadAngel <mk@realbadangel.pl> Date: Sun, 14 Apr 2013 04:38:57 +0200 Subject: [PATCH] Merge pull request #13 from Novatux/master --- technic/frames.lua | 75 ++++++++++++++++++++----------------- 1 files changed, 40 insertions(+), 35 deletions(-) diff --git a/technic/frames.lua b/technic/frames.lua index f149409..565a2ef 100644 --- a/technic/frames.lua +++ b/technic/frames.lua @@ -1,31 +1,3 @@ - minetest.register_node("technic:wall", { - description = description, - drawtype = "nodebox", - tiles = {"default_wood.png"}, - paramtype = "light", - --paramtype2 = "facedir", - sunlight_propagates = true, - is_ground_content = true, - node_box = { - type = "fixed", - --fixed = {-0.5, -0.5, 0.25, 0.5, 0.5, 0.5}, - fixed={ - {-0.5, -0.5, -0.5, -0.4, 0.5, -0.4}, - {-0.4, -0.5, 0.3, -0.3, 0.5, 0.4}, - {0.3, -0.5, 0.3, 0.4, 0.5,0.4}, - {0.3, -0.5, -0.3, 0.4, 0.5,-0.4}, - {-0.3, -0.35, -0.3, 0.3, -0.2,-0.25}, - {-0.3, 0.2, -0.3, 0.3, 0.35,-0.25}, - {-0.3, -0.35, 0.25, 0.3, -0.2,0.3}, - {-0.3, 0.2, 0.25, 0.3, 0.35,0.3}, - {-0.3, -0.35, -0.25, -0.25, -0.2,0.25}, - {-0.3, 0.2, -0.25, -0.25, 0.35,0.25}, - {0.25, -0.35, -0.25, 0.3, -0.2,0.25}, - {0.25, 0.2, -0.25, 0.3, 0.35,0.25}, - },}, - sounds = default.node_sound_stone_defaults(), - }) - 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 @@ -124,6 +96,10 @@ node_box = { type = "fixed", fixed=nodeboxes, + }, + selection_box = { + type="fixed", + fixed={-0.5,-0.5,-0.5,0.5,0.5,0.5} }, paramtype = "light", frame=1, @@ -326,7 +302,7 @@ minetest.register_node("technic:frame_motor4",{ description = "Frame motor 4", tiles = {"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png", - "technic_lv_cable.png", "technic_lv_cable.png", "pipeworks_filter_top.png"}, + "technic_lv_cable.png", "technic_lv_cable.png", "pipeworks_filter_top.png^[transformR180"}, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,mesecon=2}, paramtype2 = "facedir", mesecons={effector={action_on=frame_motor4_on}}, @@ -342,7 +318,7 @@ minetest.register_node("technic:frame_motor5",{ description = "Frame motor 5", tiles = {"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png", - "technic_lv_cable.png", "technic_lv_cable.png", "pipeworks_filter_top.png"}, + "technic_lv_cable.png", "technic_lv_cable.png", "pipeworks_filter_top.png^[transformR90"}, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,mesecon=2}, paramtype2 = "facedir", mesecons={effector={action_on=frame_motor5_on}}, @@ -358,7 +334,7 @@ minetest.register_node("technic:frame_motor6",{ description = "Frame motor 6", tiles = {"technic_lv_cable.png", "technic_lv_cable.png", "technic_lv_cable.png", - "technic_lv_cable.png", "technic_lv_cable.png", "pipeworks_filter_top.png"}, + "technic_lv_cable.png", "technic_lv_cable.png", "pipeworks_filter_top.png^[transformR270"}, groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,mesecon=2}, paramtype2 = "facedir", mesecons={effector={action_on=frame_motor6_on}}, @@ -371,11 +347,19 @@ end }) - - +function add_table(table,toadd) + local i=1 + while true do + o=table[i] + if o==toadd then return end + if o==nil then break end + i=i+1 + end + table[i]=toadd +end function move_nodes_vect(poslist,vect) - for _,pos in ipairs(poslist) do + 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 end @@ -384,13 +368,34 @@ local node=minetest.env:get_node(pos) local meta=minetest.env:get_meta(pos):to_table() nodelist[#(nodelist)+1]={pos=pos,node=node,meta=meta} - minetest.env:remove_node(pos) + end + objects={} + for _,pos in ipairs(poslist) do + for _,object in ipairs(minetest.env:get_objects_inside_radius(pos, 1)) do + add_table(objects,object) + end + end + for _,obj in ipairs(objects) do + obj:setpos(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) + end end for _,n in ipairs(nodelist) do local npos=addVect(n.pos,vect) minetest.env:set_node(npos,n.node) local meta=minetest.env:get_meta(npos) meta:from_table(n.meta) + for __,pos in ipairs(poslist) do + if npos.x==pos.x and npos.y==pos.y and npos.z==pos.z then + table.remove(poslist, __) + break + end + end + end + for __,pos in ipairs(poslist) do + minetest.env:remove_node(pos) end end -- Gitblit v1.8.0