Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
-- Strip Mining Program V1.6.1 -- -- Includes anti-gravel protocol -- -- tunnels are always two wide, 3 high in current version -- -- Planned features -- -- Mine until full -- -- Mine until full then deposit -- -- Defining tables and variables -- local ores = { ["minecraft:diamond_ore"]=true, ["minecraft:emerald_ore"]=true, ["minecraft:emerald_ore"]=true, ["minecraft:gold_ore"]=true, ["minecraft:iron_ore"]=true, ["minecraft:redstone_ore"]=true, ["minecraft:lapis_ore"]=true, ["minecraft:coal_ore"]=true, ["ic2:blockmetal"]=true, ["galacticraftcore:basic_block_core"] = true } local gravel = { ["minecraft:gravel"]=true } local inv = {} local Cscan = {} local logFile = fs.open("minelog", "a") -- Assinging functions -- function log(data) -- function to write data into minelog file logFile.writeLine(data) end function minenup(repeats) -- turtle moving up then mining cl() print("Mining...") for i = 1,repeats do turtle.up() turtle.dig() scan() cl() print("Mining...") end end function minend(repeats) -- turtle moving down then mining cl() print("Mining...") for l = 1,repeats do turtle.down() turtle.dig() scan() cl() print("Mining...") end end function scan() -- scanning blocks around turtle cl() print("Scanning surroundings...") success, Cscan = turtle.inspectUp() if ores[Cscan.name] then turtle.digUp() log(Cscan.name) end success, Cscan = turtle.inspectDown() if ores[Cscan.name] then turtle.digDown() log(Cscan.name) end for i = 1,4 do success, Cscan = turtle.inspect() if ores[Cscan.name] then log(Cscan.name) turtle.dig() turtle.turnRight() elseif gravel[Cscan.name] then while gravel[Cscan.name] do turtle.dig() success, Cscan = turtle.inspect() end turtle.turnRight() else turtle.turnRight() end end end function mineLayer(reps) cl() print("Mining...") for k = 1,reps do scan() turtle.dig() minenup(2) turtle.turnLeft() turtle.forward() turtle.turnRight() turtle.dig() scan() minend(2) turtle.forward() turtle.turnRight() scan() turtle.forward() turtle.turnLeft() end end function cl() term.clear() term.setCursorPos(1,1) end function writeFull () file.open("full", w) full.writeLine("term.clear()") full.writeLine("term.setCursorPos(1,1)") full.writeLine("print("_G.printError("Inventory full, terminating program...")) full.close() end function readInv() -- no use atm cl() print("Reading inventory...") sleep(0.5) table.insert(inv, {"Slot", "Name", "Count"}) turtle.select(1) for i = 1,16 do turtle.select(i) local detail = turtle.getItemDetail(i, true) if detail then table.insert (inv, {tostring(i), detail.name, tostring(detail.count)}) end end textutils.tabulate(table.unpack(inv)) turtle.select(1) if inv["1","2","3","4","5","6","7,","8","9","10","11","12","13","14","15","16"] then cl() _G.printError("Inventory full, terminating program...") logFile.close() writeFull() shell.run("full") end -- Start of program, obtaining parameters with human friendly interface -- cl() print("Initialising strip mining program...") sleep(1) cl() print("Enter length of desired tunnel: ") term.setCursorPos(33,1) local length = read() sleep(0.5) cl() print("Calculating.") sleep(0.5) cl() print("Calculating..") sleep(0.5) cl() print("Calculating...") sleep(0.5) cl() -- main body of mining procress -- --while true do --end -- TESTING AREA -- mineLayer(length) logFile.close() -- closing log file
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)