--[[
Automated stair digger
- Digs down DIG_DEPTH amount
- Each stairs has a height of STAIR_HEIGHT
- The top of every other stair will have a torch
_ (If you place torches in inventory slot 2)
http://davehendler.com/tracedata/
--]]
local tArgs = { ... }
if (#tArgs ~= 2) then
print( "USAGE: stairs DIG_DEPTH STAIR_HEIGHT" )
return
end
depth=tonumber(tArgs[1])
stairHeight=tonumber(tArgs[2])
fuelSlot = 1
torchSlot = 2
torchEvery = 2
-- TODO: limit to rational sizes
t=turtle
climb = stairHeight-2
-- TODO: fuel management
t.select( fuelSlot )
t.refuel( 1 )
for i = 1, depth do
print( "Step " .. i .. " of " .. depth )
print( "Fuel level: " .. t.getFuelLevel() )
-- move up to top of stair level
for j = 1, climb do
t.digUp()
t.up()
end
-- move in
dug = t.dig()
went = t.forward()
-- TODO: variable stair width
-- TODO: place stairs blocks
-- TODO: fill in empty spots?
-- dig out the stair
for j = 1, stairHeight do
t.turnLeft()
t.dig()
t.turnRight()
t.turnRight()
t.dig()
t.turnLeft()
-- Don't go down on last iteration
if j ~= stairHeight then
t.digDown()
t.down()
-- TODO: check for empty spots to fill in
end
-- Only place torches at the top
if j == 1 then
-- place torch every Nth level
if 0 == i % torchEvery then
t.select( torchSlot )
t.placeUp()
end
end
end
end
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}