Roachy 0 Posted September 30, 2017 Share Posted September 30, 2017 So yall are some crazy people... making APIs, full OSes and compilers, etc. I'm just a ComputerCraft noob who likes controlling turtles and robots to do my dirty work. When I came over from ComputerCraft I was a bit surprised at the lack of excavation programs for robots. So, starting with the default OC dig.lua program, I overhauled it to be more robust, reliable, and flexible, and to mimic what I used to use for my Turtles. There's still a lot of cool features I'd like to add but in my experience it is infinitely more reliable now. The major changes and plans are below. Because I'm devoid of imagination I named it dig2.lua. It can be found on GitHub here. Usage and a diagram of how it functions can be found in the file. Changes from original dig.lua - Now accepts 3 arguments by default for <depth (forward/back)>, <width (left to right)>, and <height (y axis)> Previously it accepted one argument for depth/width and dug as far down as it could -S option for original "Square" behavior, with one dimension given -C option for perfect cube, with one dimension given - New -j option allows you to skip down to any layer in the intended excavation Useful for when the excavation fails for whatever reason So you can reposition the robot at the start and have it skip all the layers already excavated - Added energy monitoring Robot will calculate a reasonable energy reserve based on the size of the excavation and return to origin point when approaching that reserve - Overhauled logic, functionized and optimized code reuse and readability, and added reasonable commenting debug console output - Overhauled failure logic flow Robot will return to origin point after fully failing out of the logic layers With the debug output this allows for much easier identifications of what's going wrong with your dig Plans for the future if I get around to them - Add option to discard cobble/stone - Add failure recovery techniques (e.g. can't hover high enough so move to wall) - Add ability to specify where on the outskirts of the dig the chest and/or charger station are located - Re-implement logic to continue next layer without returning to origin corner (temporarily removed for simplicity) - Add/overhaul argument parsing logic - Add ability to refuel via generator upgrade if present - Add more compatibility checks for various components and upgrades - Improve usage message formatting or font size to better fit screen Known isssues - On deep digs robot gets stuck climbing up to return home without the tier2 hover upgrade Could easily be resolved for most cases by making him return to a wall/corner BEFORE moving up The "up-first then side" behavior also causes annoying swiss cheese effect in digs where you skip a bunch of unexcavated layers - Script was designed for using Tinker's Construct tools with nearly infinite-durability/mending There's no real logic to deal with loss of tools, but the failure code should cause robot to return home once it can no longer dig Cheers, == Roachy Quote Link to post Share on other sites
BrisingrAerowing 12 Posted October 5, 2017 Share Posted October 5, 2017 I'm digging this! :cheesy_grin: Quote Link to post Share on other sites