diff --git a/sparkmachine/lua/quarry.lua b/sparkmachine/lua/quarry.lua index 296f898..388eaa5 100644 --- a/sparkmachine/lua/quarry.lua +++ b/sparkmachine/lua/quarry.lua @@ -27,7 +27,7 @@ local function on_marker_placed(pos, quarry_pos, player) meta:set_string("marker", minetest.pos_to_string(pos)) meta:set_int("current_frame", 13) - timer = minetest.get_node_timer(quarry_pos):start(1.0) + minetest.get_node_timer(quarry_pos):start(1.0) end local function marker_construct(pos, player) @@ -37,14 +37,33 @@ local function marker_construct(pos, player) end local function clear_area(pos, pos2) - for x=pos.x , pos2.x do - for y=pos.y, pos2.y do - for z=pos.z, pos2.z do + local minx = pos.x + local maxx = pos2.x + if pos2.x < pos.x then + minx = pos2.x + maxx = pos.x + end + local miny = pos.y + local maxy = pos2.y + if pos2.y < pos.y then + miny = pos2.y + maxy = pos.y + end + local minz = pos.z + local maxz = pos2.z + if pos2.z < pos.z then + minz = pos2.z + maxz = pos.z + end + for x=minx , maxx do + for y=miny, maxy do + for z=minz, maxz do -- dont remove quarry or marker - -- - local node = minetest.get_node({ x=x, y=y, z=z}) - minetest.debug(node.name) - if node.name ~= "MOD_NAME" .. ":lv_quarry" and node.name ~= "MOD_NAME" .. ":quarry_marker" then + if x == pos.x and y == pos.y and z == pos.z then + + elseif x == pos2.x and y == pos2.y and z == pos2.z then + + else minetest.dig_node({ x=x, y=y, z=z }) end end @@ -53,13 +72,36 @@ local function clear_area(pos, pos2) end local function struct_line(pos, pos2) - for x=pos.x , pos2.x do - for y=pos.y, pos2.y do - for z=pos.z, pos2.z do - if node.name ~= "MOD_NAME" .. ":lv_quarry" and node.name ~= "MOD_NAME" .. ":quarry_marker" then + local minx = pos.x + local maxx = pos2.x + if pos2.x < pos.x then + minx = pos2.x + maxx = pos.x + end + local miny = pos.y + local maxy = pos2.y + if pos2.y < pos.y then + miny = pos2.y + maxy = pos.y + end + local minz = pos.z + local maxz = pos2.z + if pos2.z < pos.z then + minz = pos2.z + maxz = pos.z + end + for x=minx , maxx do + for y=miny, maxy do + for z=minz, maxz do + if x == pos.x and y == pos.y and z == pos.z then + + elseif x == pos2.x and y == pos2.y and z == pos2.z then + + else -- dont remove quarry or marker - minetest.dig_node({ x=x, y=y, z=z }) + minetest.debug(x .. ": " .. y .. ": " .. z .. ": " .. MOD_NAME) minetest.place_node({x=x, y=y, z=z}, MOD_NAME .. ":static_strut") + -- WHY THE FLYING FUCK DOES THIS TRIGGER "not a string" bullshit end end end @@ -70,8 +112,10 @@ local function timer_trigger(pos, elapsed) local meta = minetest.get_meta(pos) local framenum = meta:get_int("current_frame") local marker_pos = minetest.string_to_pos(meta:get_string("marker")) - - if framenum <= 0 then + if not framenum then + framenum = 13 + end + if framenum < 0 then -- Operation Phase -- else @@ -92,7 +136,7 @@ local function timer_trigger(pos, elapsed) struct_line( { x = marker_pos.x, y = pos.y, z = pos.z }, { x = marker_pos.x, y = pos.y, z = marker_pos.z }) elseif framenum == 6 then struct_line( { x = pos.x, y = marker_pos.y, z = pos.z }, { x = pos.x, y = marker_pos.y, z = marker_pos.z }) - elseif frmaenum == 5 then + elseif framenum == 5 then struct_line( { x = marker_pos.x, y = marker_pos.y, z = pos.z }, { x = marker_pos.x, y = marker_pos.y, z = marker_pos.z }) elseif framenum == 4 then struct_line( { x = pos.x, y = pos.y, z = marker_pos.z }, { x = marker_pos.x, y = pos.y, z = marker_pos.z }) @@ -102,22 +146,28 @@ local function timer_trigger(pos, elapsed) struct_line( { x = marker_pos.x, y = pos.y, z = marker_pos.z }, { x = marker_pos.x, y = marker_pos.y, z = marker_pos.z }) elseif framenum == 1 then struct_line( { x = pos.x, y = marker_pos.y, z = marker_pos.z }, { x = marker_pos.x, y = marker_pos.y, z = marker_pos.z }) + elseif framenum == 0 then + --shrink the operational area here to a 2d space with one piece of border taken away to drill there end end meta:set_int("current_frame", framenum -1) - meta:from_table(metatable) minetest.get_node_timer(pos):start(1.0) end minetest.register_node( MOD_NAME .. ":quarry_marker", { descritption = "quarry marker", - + tiles = { + "marker.png" + }, after_place_node = marker_construct, }) minetest.register_node( MOD_NAME .. ":static_strut", { - + desctiption = "supporting strut", + tiles = { + "strut.png" + } }) minetest.register_node( MOD_NAME .. ":lv_quarry", {