Jump to content




Simple [Ender] Mining Turtle Program


2 replies to this topic

#1 Sheriff_K

  • New Members
  • 1 posts

Posted 11 July 2014 - 06:21 PM

Hi, this is my first LUA program as well as the first time I'm using ComputerCraft.

(I used to use RP2 Computers back in 1.2.5, though I haven't played since then since RP2 was my favorite mod so there was no point playing Minecraft without it given Eloraam's lack of [significant] updates since then.. But RP3 is being worked on, so rejoice! :P)

As such my programming is EXTREMELY rusty, and my long-term memory is reproachable, so if I made any mistakes feel free to let me know/correct them. ^.^


So what this program is meant to do, is have a Mining Turtle indefinitely mine and deposit it's yield into an Ender Chest in its Inventory. I'd have a Chunk Loader Module on it, or a separate Turtle with one tailing it. (I plan to start with 3 of these Turtles, for an even 9x9 mining path.)

Setup: There will be a logistics system in my base constantly keeping an Ender Chest supplied with exactly 32 pieces of Coal (half a Stack.)

Turtle Inventory (by slotNum):
1) Coal
2) Coal Ender Chest
3) Mining Deposit Ender Chest

What it does: Basically it mines up, down, and in front of it, depositing into the corresponding Ender Chest when an Item is placed into the 13th Inventory Slot (I chose that Slot because at maximum, if the Turtle was to mine 3 unique Items that wouldn't stack, or any other prior stacks of them were full, it'd get 3 Slots filled up mining up/down/front making it full.)

Once the Fuel level reaches below 10 (an arbitrary number I chose, but it should be fine, I think..) and if the Coal in Slot 1 has run out (become 1, so that there is always one there to keep the Slot occupied.) the Turtle will attempt to pull 32 Coal from the corresponding Ender Chest, and if it cannot, it will Sleep for 5 minutes (hopefully to give the Logistics system back at the base time to restock the Coal.)


And without further ado, here is the code (It will be in the startup, so that it can run/pick up where it left off after the World/Chunk comes back up):
Pastebin: http://pastebin.com/6p3fEx3L
Spoiler

Feel free to tell me what you think, and if there are any corrections or improvements you might have.

Thanks. ^.^

Edited by Sheriff_K, 11 July 2014 - 06:53 PM.


#2 BTNGaming

  • Members
  • 7 posts
  • LocationWashington, USA

Posted 18 July 2014 - 07:30 PM

So is there a way to setup so that the enderchest never gets full via the turtle(s)? Like... instead of using a ton of droppers and hoppers, is there a way to get a turtle to clear it out into a larger chest? That would be phenomenal. =]

#3 benthegameboy

  • New Members
  • 1 posts

Posted 30 July 2014 - 12:58 AM

Fantastic program! Though a thing I think would be cool is that if the turtle encountered lava, it would use a bucket (no need to worry about used space due to Ender Chest) to pick it up an refuel with it. Otherwise, this program is perfect.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users