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
---Loads a locally saved table and returns it ---@param path string a valid filepath ---@return table params or empty table local function loadParams(path) local file = fs.open(path, "r") if file ~= nil then local data = file.readAll() file.close() return textutils.unserialize(data) else return {} end end ---Saves the table at the defined path ---@param path string a valid filepath ---@param table table paramtable to save local function saveParams(path, table) local file = fs.open(path, "w") file.write(textutils.serialize(table)) file.close() end local STEPSIZE = 5 local FIELDSIZE = 7 local SECONDSWAITINGONDRILL = 260 local PARAMPATH = "files/quarry" local params = loadParams(PARAMPATH) local function setRedstoneOutput(side, active) if active == nil or active then redstone.setOutput(side, true) else redstone.setOutput(side, false) end end local function stopRotation() setRedstoneOutput("top", true) setRedstoneOutput("right", true) end local function slowerSpeed(active) setRedstoneOutput("right", active) setRedstoneOutput("top", not active) end local function reverseRotation(active) setRedstoneOutput("bottom", not active) end local function activateFirstCarriage(active) setRedstoneOutput("left", active) end local function activateSecondCarriage(active) stopRotation() setRedstoneOutput("back", active) sleep(0.25) end local function skipCurrent() params = loadParams(PARAMPATH) if params.skip ~= nil then if params.skip == true then params.skip = false reverseRotation(false) saveParams(PARAMPATH, params) return true end end return false end local function skipRow() params = loadParams(PARAMPATH) if params.skiprow ~= nil then if params.skiprow == true then params.skiprow = false saveParams(PARAMPATH, params) return true end end return false end local function stopExecution() end local function drill() activateFirstCarriage() activateSecondCarriage() reverseRotation() slowerSpeed(false) if not skipCurrent() then for i = 1, SECONDSWAITINGONDRILL, 1 do sleep(1) term.clear() term.setCursorPos(1, 1) print(tostring(i) .. " seconds passed from " .. tostring(SECONDSWAITINGONDRILL)) if skipCurrent() then break end end reverseRotation(false) for i = 1, math.ceil(SECONDSWAITINGONDRILL / 15), 1 do sleep(1) end end end local function moveFirstCarriage() activateFirstCarriage(false) activateSecondCarriage(false) slowerSpeed(true) reverseRotation(false) for i = 1, STEPSIZE, 1 do sleep(0.85) end end local function callbackFirstCarriage() activateFirstCarriage(false) activateSecondCarriage(false) slowerSpeed(false) sleep(0.5) reverseRotation(true) for i = 1, FIELDSIZE, 1 do sleep(1) end end local function moveSecondCarriage() activateFirstCarriage(true) activateSecondCarriage(false) slowerSpeed(true) sleep(0.5) reverseRotation(true) for i = 1, STEPSIZE, 1 do sleep(0.85) end end local function callbackSecondCarriage() reverseRotation(false) activateFirstCarriage(true) activateSecondCarriage(false) slowerSpeed(false) sleep(0.5) reverseRotation(false) for i = 1, FIELDSIZE, 1 do sleep(1) end end local function executeAll() callbackFirstCarriage() for rows = 1, FIELDSIZE, 1 do for columns = 1, FIELDSIZE, 1 do if skipRow() then break end if not skipCurrent() then drill() end moveSecondCarriage() end callbackSecondCarriage() moveFirstCarriage() end end local function test() callbackFirstCarriage() moveSecondCarriage() callbackSecondCarriage() moveFirstCarriage() end executeAll() -- test()
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)