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
|
if args[1] == "rightturn" or args[1] == "leftturn" then
|
||||||
local turnedLeft = args[1] == "rightturn"
|
turnedLeft = (args[1] == "rightturn")
|
||||||
else
|
else
|
||||||
print("usage: \"makefloor [leftturn|rightturn] whatever the first turn may be")
|
print("usage: \"makefloor [leftturn|rightturn]\" whatever the first turn may be")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
print(turnedLeft)
|
||||||
|
|
||||||
local curContainer = 1
|
local curContainer = 1
|
||||||
|
turtle.select(curContainer)
|
||||||
|
|
||||||
local function selectMatStack()
|
local function selectMatStack()
|
||||||
itemCount = turtle.getItemCount(curContainer)
|
itemCount = turtle.getItemCount(curContainer)
|
||||||
while itemCount == 0 do
|
while itemCount == 0 do
|
||||||
if curContainer == 10 then
|
if curContainer == 9 then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
curContainer = curContainer + 1
|
curContainer = curContainer + 1
|
||||||
turtle.select(curContainer)
|
turtle.select(curContainer)
|
||||||
|
itemCount = turtle.getItemCount(curContainer)
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
local function checkIfNextTurn()
|
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()
|
turnAction()
|
||||||
retval = not turtle.detect()
|
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()
|
turnAction()
|
||||||
return retval
|
return retval
|
||||||
end
|
end
|
||||||
|
@ -43,15 +64,16 @@ local function fillblock()
|
||||||
end
|
end
|
||||||
turtle.placeDown()
|
turtle.placeDown()
|
||||||
if shouldTurn then
|
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()
|
turnAction()
|
||||||
turtle.forward()
|
turtle.forward()
|
||||||
turnAction()
|
turnAction()
|
||||||
turnedLeft = not turnedLeft
|
turnedLeft = not turnedLeft
|
||||||
else
|
else
|
||||||
turtle.forward()
|
turtle.forward()
|
||||||
turtle.down()
|
|
||||||
end
|
end
|
||||||
|
turtle.down()
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
while fillblock() do end
|
while fillblock() do end
|
||||||
|
|
Reference in a new issue