Jump to content




[1.4] The lazy man's way to clear a chunk


  • This topic is locked This topic is locked
31 replies to this topic

#1 Pooslice

  • New Members
  • 10 posts

Posted 20 October 2012 - 08:14 PM

Development on this program has been suspended. If anyone wants to continue this project feel free to copy the code and make a new thread.



Too lazy to mine yourself? Want to see others doing all the work? You have no problems with letting innocent baby turtles work in the mines day and night? Then this is for you!

http://pastebin.com/pdMZ17KV

What does it do?
  • Clears a whole chunk (16x16 blocks) down to bedrock.
Features:
  • Automatically refuels from drone inventory or refuel station.
  • Usually clears a chunk in less than 20 minutes using a total of 17 wireless mining turtles.
  • User interaction is required only at setup.
  • Immune against lava, water, mobs and any combination of those.
  • All collected blocks are placed in chests at the top.
  • Has some cleverness to save on fuel.
Restrictions:
  • Uses commands added in 1.4. Will not run on earlier CC versions.
  • Will leave out blocks that are located in a vertical gap between bedrock blocks.
  • Will leave some cobblestone blocks if lava and water merge after a drone has already passed by.
  • Needs a clear starting area of 16x16x1 blocks.
  • Will only work with iron chests or any other inventory that can be placed next to each other in a direct horizontal line.
  • Does not check for full chests on drop.
  • Not logoff- and server-shutdown-proof
  • My first real lua project. So the coding style is kind of sloppy and there are redundancies. Feel free to refactor and edit.
Usage:
  • Place a wireless mining turtle somewhere. The area that will be digged out will be 15 blocks forward and to the right of this turtle. There should be no blocks on the turtle's level (y coordinate) in this area.
  • Start the program with 'drone setup'
  • Follow the instructions. You will need 16 wireless mining turtles, 16 iron (or better) chests, one disk drive, one floppy disk and some fuel. I recommend at least three stacks of coal for one chunk.
  • Grab a coffee and watch the magic.
The code is published with no rights reserved. If and how you make use of it is your own decision and I will not be held responsible. Also note that I do not have the time to make a lot of updates or regularly check the forums for comments. It was a fun little project to get used to some lua and I am releasing this to the community with the hope that it might be of use to someone.

Changelog:
Spoiler


#2 dustpuppy

  • New Members
  • 16 posts
  • LocationWexford, Ireland

Posted 20 October 2012 - 08:23 PM

You don't need user to right click every turtle.
turtle = peripheral.wrap("bottom")
turtle.turnOn()


#3 jag

  • Members
  • 533 posts
  • LocationStockholm, Sweden

Posted 20 October 2012 - 09:04 PM

View Postdustpuppy, on 20 October 2012 - 08:23 PM, said:

You don't need user to right click every turtle.
turtle = peripheral.wrap("bottom")
turtle.turnOn()
It's not a good idea to name the new peripheral to turtle!
If you do this you wont after be able to use for example turtle.turnLeft().

#4 Pooslice

  • New Members
  • 10 posts

Posted 20 October 2012 - 09:10 PM

View Postjag_e_nummer_ett, on 20 October 2012 - 09:04 PM, said:

View Postdustpuppy, on 20 October 2012 - 08:23 PM, said:

You don't need user to right click every turtle.
turtle = peripheral.wrap("bottom")
turtle.turnOn()
It's not a good idea to name the new peripheral to turtle!
If you do this you wont after be able to use for example turtle.turnLeft().

Thanks for the suggestions. I totally forgot about the peripheral API. New version here. I will change the link as soon as a test run is through.

New Code:
print("Placing drone " .. i + 1 .. " of 16.")
  print()
  -- place the drone
  turtle.select(1)
  while turtle.detectDown() do sleep(1) end
  turtle.placeDown()
  -- boot the drone, thanks to dustpuppy for reminding me about the peripheral API
  peripheral.call("bottom", "turnOn")


#5 ChunLing

  • Members
  • 2,027 posts

Posted 20 October 2012 - 09:16 PM

World destruction using baby turtle soldiers. You monster, you.

Looks adorable. Why does water slow down the mining...oh, I see, it's because you detect before trying to move. For a project like this, it's actually a pretty good idea to put source water on top, so that it fills the hole (preventing horrible accidents and hostile mob spawning) and turns any lava you uncover into obsidian. If you have the turtles move before detecting, this doesn't slow them down. It I ever get around to writing a specialized excavation program, it will definitely include watering the hole.

#6 Pooslice

  • New Members
  • 10 posts

Posted 20 October 2012 - 09:27 PM

View PostChunLing, on 20 October 2012 - 09:16 PM, said:

World destruction using baby turtle soldiers. You monster, you.

Next goal: Self-replicating turtles :)/>

Yes, covering with water works. However, there will be some cobble blocks left occassionally. Most of the time that's because of lava flowing in from the outside after a turtle has already passed the spot.

#7 ChunLing

  • Members
  • 2,027 posts

Posted 20 October 2012 - 09:46 PM

Replicators...that can't possibly go wrong.

#8 jag

  • Members
  • 533 posts
  • LocationStockholm, Sweden

Posted 20 October 2012 - 10:08 PM

I guess it pretty simple to just make the main control turtle pick up the disk drive and the turtle minions when they'r done

#9 lewanator1

  • Members
  • 34 posts

Posted 21 October 2012 - 11:47 AM

when i type drone setup i get "no such program" although i copyed and pasted into my turtle file and called it mine did i do somthing wrong?

#10 Pooslice

  • New Members
  • 10 posts

Posted 21 October 2012 - 12:47 PM

View Postjag_e_nummer_ett, on 20 October 2012 - 10:08 PM, said:

I guess it pretty simple to just make the main control turtle pick up the disk drive and the turtle minions when they'r done

Hm, I don't think that they will stack in the inventory anymore. Will have to test it, though. The program is altering files on the turtles' storage for logging (if enabled).

View Postlewanator1, on 21 October 2012 - 11:47 AM, said:

when i type drone setup i get "no such program" although i copyed and pasted into my turtle file and called it mine did i do somthing wrong?

Sorry, you cannot simply rename it. The script uses some commands like shell.run("drone", ...) to call itself. I originally wrote this as separate programs and joined them together later on.

#11 lewanator1

  • Members
  • 34 posts

Posted 21 October 2012 - 12:49 PM

how would i fix it and how do i use it sorry im a noob

#12 Apothecarian

  • New Members
  • 4 posts
  • LocationIn a remote bunker, waiting...

Posted 21 October 2012 - 02:20 PM

This is AWESOME! Thank you for sharing!

#13 Pooslice

  • New Members
  • 10 posts

Posted 21 October 2012 - 09:59 PM

View Postlewanator1, on 21 October 2012 - 12:49 PM, said:

how would i fix it and how do i use it sorry im a noob

I just posted a new version. This should solve your problem. I did not have time to test everything thoroughly. Let me know if there are any problems.

View Postjag_e_nummer_ett, on 20 October 2012 - 10:08 PM, said:

I guess it pretty simple to just make the main control turtle pick up the disk drive and the turtle minions when they'r done

Did quick short test. They do not stack in the inventory. But the disk drive is now removed after all turtles have been launched.

Something else. Has anyone a better solution for getting the current script name? This is what I came up with on the fly:
SCRIPTPATH = shell.getRunningProgram()
if string.find(SCRIPTPATH, "/") then
SCRIPTNAME = string.reverse(SCRIPTPATH)
SCRIPTNAME = string.reverse(string.sub(SCRIPTNAME, 0, string.find(SCRIPTNAME, "/")-1))
else
SCRIPTNAME = SCRIPTPATH
end
I also tried
tArgs = { ... }
SCRIPTNAME = tArgs[0]
but that does not seem to work.

#14 jag

  • Members
  • 533 posts
  • LocationStockholm, Sweden

Posted 21 October 2012 - 10:38 PM

View PostPooslice, on 21 October 2012 - 09:59 PM, said:

View Postjag_e_nummer_ett, on 20 October 2012 - 10:08 PM, said:

I guess it pretty simple to just make the main control turtle pick up the disk drive and the turtle minions when they'r done

Did quick short test. They do not stack in the inventory. But the disk drive is now removed after all turtles have been launched.
You could let the main turtle pick up the "minions" and place them in their chests.

#15 Silent

  • New Members
  • 3 posts

Posted 22 October 2012 - 09:27 AM

The whole thing fails because I have fuel disabled haha, it deploys the first turtle then it just sits there dropping slot 5 all day XD

#16 Pooslice

  • New Members
  • 10 posts

Posted 22 October 2012 - 11:13 AM

View PostSilent, on 22 October 2012 - 09:27 AM, said:

The whole thing fails because I have fuel disabled haha, it deploys the first turtle then it just sits there dropping slot 5 all day XD

That issue has been fixed since v2 and I've tested it many times. You shouldn't have that problem after updating.

#17 Silent

  • New Members
  • 3 posts

Posted 24 October 2012 - 05:28 AM

Ok it works now duno what I did before ^_^/>

#18 oryor

  • New Members
  • 2 posts

Posted 24 October 2012 - 07:29 PM

will this program work on 1.3?

#19 ChunLing

  • Members
  • 2,027 posts

Posted 24 October 2012 - 11:26 PM

Nope, it uses commands added since then.

#20 oryor

  • New Members
  • 2 posts

Posted 24 October 2012 - 11:29 PM

ah thats why i was having issues thanks





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users