Merge branch 'master' of github.com:Jaxan/Computercraft
This commit is contained in:
commit
ced93b77fd
1 changed files with 31 additions and 9 deletions
40
makefloor
40
makefloor
|
@ -1,32 +1,53 @@
|
|||
local args = { ... }
|
||||
|
||||
turnedLeft = nil
|
||||
local args = { ... }
|
||||
--[[
|
||||
local function placeholder() return true end
|
||||
local turtle = {}
|
||||
turtle.up = placeholder
|
||||
turtle.down = placeholder
|
||||
turtle.digUp = placeholder
|
||||
turtle.digDown = placeholder
|
||||
turtle.dig = placeholder
|
||||
turtle.forward = placeholder
|
||||
turtle.turnLeft = placeholder
|
||||
turtle.turnRight = placeholder
|
||||
turtle.detect = placeholder
|
||||
turtle.getItemCount = placeholder
|
||||
turtle.placeDown = placeholder
|
||||
turtle.select = placeholder
|
||||
]]
|
||||
|
||||
local turnedLeft = nil
|
||||
if args[1] == "rightturn" or args[1] == "leftturn" then
|
||||
local turnedLeft = args[1] == "rightturn"
|
||||
turnedLeft = (args[1] == "rightturn")
|
||||
else
|
||||
print("usage: \"makefloor [leftturn|rightturn] whatever the first turn may be")
|
||||
print("usage: \"makefloor [leftturn|rightturn]\" whatever the first turn may be")
|
||||
return
|
||||
end
|
||||
|
||||
print(turnedLeft)
|
||||
|
||||
local curContainer = 1
|
||||
turtle.select(curContainer)
|
||||
|
||||
local function selectMatStack()
|
||||
itemCount = turtle.getItemCount(curContainer)
|
||||
while itemCount == 0 do
|
||||
if curContainer == 10 then
|
||||
if curContainer == 9 then
|
||||
return false
|
||||
end
|
||||
curContainer = curContainer + 1
|
||||
turtle.select(curContainer)
|
||||
itemCount = turtle.getItemCount(curContainer)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
local function checkIfNextTurn()
|
||||
if turnedLeft then turnAction = turtle.TurnRight else turnAction = turtle.TurnLeft end
|
||||
if turnedLeft then turnAction = turtle.turnRight else turnAction = turtle.turnLeft end
|
||||
turnAction()
|
||||
retval = not turtle.detect()
|
||||
if not turnedLeft then turnAction = turtle.TurnRight else turnAction = turtle.TurnLeft end
|
||||
if not turnedLeft then turnAction = turtle.turnRight else turnAction = turtle.turnLeft end
|
||||
turnAction()
|
||||
return retval
|
||||
end
|
||||
|
@ -43,15 +64,16 @@ local function fillblock()
|
|||
end
|
||||
turtle.placeDown()
|
||||
if shouldTurn then
|
||||
if turnedLeft then turnAction = turtle.TurnRight else turnAction = turtle.TurnLeft end
|
||||
if turnedLeft then turnAction = turtle.turnRight else turnAction = turtle.turnLeft end
|
||||
turnAction()
|
||||
turtle.forward()
|
||||
turnAction()
|
||||
turnedLeft = not turnedLeft
|
||||
else
|
||||
turtle.forward()
|
||||
turtle.down()
|
||||
end
|
||||
turtle.down()
|
||||
return true
|
||||
end
|
||||
|
||||
while fillblock() do end
|
||||
|
|
Reference in a new issue