diff --git a/mine.lua b/mine.lua index f6ef302..18b2598 100644 --- a/mine.lua +++ b/mine.lua @@ -168,7 +168,7 @@ function move (v) turnToFace(LEFT) moveInLine(-v.x) end - mode.v = mode.v + UNIT_X + mode.v.x = mode.v.x + v.x -- z if v.z > 0 then turnToFace(FORWARD) @@ -178,10 +178,10 @@ function move (v) turnToFace(BACK) moveInLine(-v.z) end - mode.v = mode.v + UNIT_Z + mode.v.z = mode.v.z + v.z -- y moveUpDown(v.y) - mode.v = mode.v + UNIT_Y + mode.v.y = mode.v.y + v.y end -------------- DROPPING OFF AND REFUELING ------------------- @@ -302,31 +302,6 @@ function process (stack, starting_point) return process (stack) end -function calculateBlock (v1, v2) - -- Using the coordinates, construct a block of certain dimensions, a - -- certain distance away. - local block = {} - local normalize = function (dim, c1, c2) - -- pick the closest point - -- offset goes to the other point - local corner, offset - if math.abs(c1) <= math.abs(c2) then - corner, offset = c1, c2 - c1 - else - corner, offset = c2, c1 - c2 - end - block[dim] = corner - block[dim .. "off"] = offset - end - normalize("x", v1.x, v2.x) - normalize("y", v1.y, v2.y) - normalize("z", v1.z, v2.z) - return new_block( - vector.new(block.x, block.y, block.z), - vector.new(block.xoff, block.yoff, block.zoff) - ) -end - function run (v1, v2) -- TODO calculate starting_point, the place turtle will move to before -- moving to the first corner of block