.
This commit is contained in:
parent
35bcf0200d
commit
36dce7eff9
@ -61,6 +61,32 @@ local function itemInInventory()
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
local function countBlocks(matrix)
|
||||
local counter = 0
|
||||
for i=1, #matrix do
|
||||
for j=1, #matrix[i] do
|
||||
if matrix[i][j] == 1 then
|
||||
counter = counter + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
return counter
|
||||
end
|
||||
|
||||
|
||||
local function confirmationDialog(input)
|
||||
if input == "y" or input == "yes" then
|
||||
return true
|
||||
elseif input == "n" or input == "no" then
|
||||
return false
|
||||
else
|
||||
print("confirmationDialogError")
|
||||
return "Error"
|
||||
end
|
||||
end
|
||||
|
||||
local function printLayer(matrix, withChest)
|
||||
--for i=1, #matrix do
|
||||
for i=#matrix, 1, -1 do
|
||||
@ -80,50 +106,22 @@ local function printLayer(matrix, withChest)
|
||||
turtle.forward()
|
||||
turtle.turnLeft()
|
||||
end
|
||||
turtle.turnLeft()
|
||||
|
||||
-- go back to start
|
||||
for i=#matrix, 1, -1 do
|
||||
turtle.back()
|
||||
end
|
||||
turtle.turnLeft()
|
||||
end
|
||||
|
||||
|
||||
local function printAwesome(matrix, withChest, height)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
local function countBlocks(matrix)
|
||||
local counter = 0
|
||||
for i=1, #matrix do
|
||||
for j=1, #matrix[i] do
|
||||
if matrix[i][j] == 1 then
|
||||
counter = counter + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
return counter
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
local function confirmationDialog(input)
|
||||
if input == "y" or input == "yes" then
|
||||
return true
|
||||
elseif input == "n" or input == "no" then
|
||||
return false
|
||||
else
|
||||
print("confirmationDialogError")
|
||||
return "Error"
|
||||
local function printLayers(matrix, withChest, height)
|
||||
for i=1, height do
|
||||
printLayer(matrix, withChest)
|
||||
turtle.up()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function main()
|
||||
print("Print with Chest? [yn]")
|
||||
local withChest = confirmationDialog(read())
|
||||
@ -136,15 +134,22 @@ function main()
|
||||
|
||||
matrix = createMatrix(filePath, dim)
|
||||
|
||||
blockCounter = countBlocks(matrix)
|
||||
local blocksPerLayer = countBlocks(matrix)
|
||||
|
||||
print("One Layer would need " .. blockCounter .. " Blocks.")
|
||||
print("How many Layers?")
|
||||
local height = read()
|
||||
|
||||
local blocksForAllLayers = blocksPerLayer * height
|
||||
|
||||
print("One Layer would need " .. blocksPerLayer .. " Blocks.")
|
||||
print(height .. " Layers would need " .. blocksForAllLayers .. " Blocks (" .. blocksForAllLayers/64 .. " Stacks)")
|
||||
print("Continue? [yn]")
|
||||
|
||||
local startPrinting = confirmationDialog(read())
|
||||
|
||||
if startPrinting then
|
||||
printLayer(matrix, withChest)
|
||||
printLayers(matrix, withChest, height)
|
||||
--printLayer(matrix, withChest)
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user