Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Program: autoTurtle.loa
- Description: A turtle automation program for farming, mining, and wood harvesting
- GitHub Repository: https://github.com/dwightdurmon/ccTweaked
- Pastbin Command: pastebin get U7TSCfnE autoTurtle
- License: MIT
- Version: 1.0
- Command Line Options
- -action [farm,mine,wood]
- -
- ]]
- ---------------------------------------
- -- DEFAULTS --
- ---------------------------------------
- variables = {
- ["offset"] = {
- ["x"] = 0,
- ["y"] = 0,
- ["z"] = 0,
- ["moves"] = 0
- },
- ["resourceLocation"] = {
- ["fuel"] = 'left',
- ["items"] = 'right',
- ["furnace"] = 'top',
- ["craftingTable"] = 'back',
- },
- ["defaultSlots"] = {
- ["barrier"] = 15,
- ["fuel"] = 16,
- },
- ["miningSlots"] = {
- ['normalTorches'] = 13,
- ['redstoneTorches'] = 14
- },
- ["miningSettings"] = {
- ['mainTunnelWidth'] = 3,
- ['mainTunnelHeight'] = 3,
- ['mainTunnelLength'] = 30,
- ['sideTunnelWidth'] = 3,
- ['sideTunnelHeight'] = 3,
- ['sideTunnelLength'] = 10
- },
- ["farmingSlots"] = {
- ['boneMeal'] = 13,
- ['seeds'] = 14
- },
- ["treeSlots"] = {
- ['seeds'] = 14
- },
- ["treeSettings"] = {
- ['spaceBetweenTrees'] = 2
- },
- ["autoRefuel"] = true,
- ['rednetChannel'] = 4,
- ['isRemoteDisplay'] = false,
- ['stumpCrops'] = {'minecraft:sugar_cane','minecraft:cactus','minecraft:bamboo'}
- }
- ---------------------------------------
- -- OS DEFAULTS (Do Not Change) --
- ---------------------------------------
- osDefaults = {
- ["turtleScreenSize"] = {
- ["width"] = 51,
- ["height"] = 19,
- },
- ["monitorScreenSize"] = {
- ["width"] = 39,
- ["height"] = 13,
- },
- ['version'] = '1.0'
- }
- ---------------------------------------
- -- VARIABLES --
- ---------------------------------------
- running=true
- ---------------------------------------
- -- BASIC FUNCTIONS FOR TURTLE CONTROL -
- ---------------------------------------
- local function goForward(n)
- if n==nil then n=1 end
- for i=1,n,1 do while not turtle.forward() do end end
- end
- local function goBack(n)
- if n==nil then n=1 end
- for i=1,n,1 do while not turtle.back() do end end
- end
- local function goUp(n)
- if n==nil then n=1 end
- for i=1,n,1 do while not turtle.up() do end end
- end
- local function goDown(n)
- if n==nil then n=1 end
- for i=1,n,1 do while not turtle.down() do end end
- end
- local function turnLeft(n)
- if n==nil then n=1 end
- for i=1,n,1 do while not turtle.turnLeft() do end end
- end
- local function turnRight(n)
- if n==nil then n=1 end
- for i=1,n,1 do while not turtle.turnRight() do end end
- end
- local function placeForward(n)
- -- moves backwards if n>1
- if n==nil then n=1 end
- for i=1,n,1 do if i~=1 then goBack() end turtle.place() end
- end
- local function placeUp() turtle.placeUp() end
- local function placeDown() turtle.placeDown() end
- local function digForward() return turtle.dig() end
- local function digUp() turtle.digUp() end
- local function digDown() turtle.digDown() end
- local function suckForward() turtle.suck() end
- local function suckUp() turtle.suckUp() end
- local function suckDown(n)
- if n==nil then
- while turtle.suckDown() do end
- else
- for i=1,n do
- turtle.suckDown()
- end
- end
- end
- local function dropForward() turtle.drop() end
- local function dropUp(n) if n==nil then n=64 end turtle.dropUp(n) end
- local function dropDown(n) if n==nil then n=64 end turtle.dropDown(n) end
- local function termPrint(x,y,text)
- term.setCursorPos(x,y)
- term.write(text)
- end
- local function printTestTurtleScreen()
- termPrint(1,1," 1 2 3 ")
- termPrint(1,2,"123456789012345678901234567890123456789")
- end
- local function printSeparator(x,y)
- termPrint(x,y,'+-------------------------------------+')
- end
- local function printBorder(x,y)
- termPrint(x,y,'+ +')
- end
- local function printHeader()
- termPrint(3,2,'AutoTurtle ver. ' .. osDefaults['version'])
- end
- local function screenTemplate()
- term.clear()
- -- SCREEN LOOKS LIKE THIS:
- printSeparator(1,1) -- line 1 +-------------------------------------+
- printBorder(1,2) -- line 2 + +
- printSeparator(1,3) -- line 3 +-------------------------------------+
- printBorder(1,4) -- line 4 + +
- printBorder(1,5) -- line 5 + +
- printBorder(1,6) -- line 6 + +
- printBorder(1,7) -- line 7 + +
- printBorder(1,8) -- line 8 + +
- printBorder(1,9) -- line 9 + +
- printBorder(1,10) -- line 10 + +
- printBorder(1,11) -- line 11 + +
- printBorder(1,12) -- line 12 + +
- printSeparator(1,13) -- line 13 +-------------------------------------+
- end
- local function printKeyPress()
- local event, key, is_held = os.pullEvent("key")
- termPrint(3,4,'Key: ' .. ("%s held=%s"):format(keys.getName(key), is_held))
- end
- local function getKey()
- local event, key, is_held = os.pullEvent("key")
- return keys.getName(key)
- end
- local function keyTest ()
- while true do
- screenTemplate()
- printHeader()
- printKeyPress()
- sleep(1)
- end
- end
- local function setupScreen1()
- -- Lets find out the task
- screenTemplate()
- printHeader()
- printSeparator(1,11) -- line 13 +-------------------------------------+
- termPrint(3,4,'Select a task from the items below:')
- keyPressed = getKey()
- while true do
- if keyPressed == 'space' then
- running=false
- end
- end
- termPrint(3,12,'Press <space> to continue')
- end
- --[[
- Main Function Loop
- ]]--
- function main()
- printTestTurtleScreen()
- sleep(2)
- while running do
- setupScreen1()
- end
- end
- --[[
- Run the program!
- ]]--
- main()
Add Comment
Please, Sign In to add comment