Jump to content

[WIP] Simple mining Drill


2 replies to this topic

#1 HNO3

  • New Members
  • 2 posts

Posted 16 March 2016 - 08:06 AM

- This Program is not ready! -

A simple mining Drill, that drills down, collects the whitelisted Ores, goes up again and drops its Inventory in a Chest.

(This is my first Lua Project, so i apologize if my code is bad, and i'm not using Feature xyz)




Compatible (Ore) mods:

Edited by HNO3, 18 March 2016 - 04:49 PM.

#2 Mirodin

  • Members
  • 33 posts

Posted 18 May 2016 - 09:26 PM

This sounds like something I made as one of my first programs too. But this hugh if monster kills me, I would advise you to use a table for the whitelisting stuff and maybe also switching to a blacklist since in most cases there are only a few blocks you do not want like dirt and stone.

Maybe something along the lines of:
local blackist = {
  -- and so on
local _blist = {}

-- Inverse blacklist for fast hashmap lookup
for i = 1, #blacklist do
  _blist[blacklist[i]] = true

-- Then you only need to check if the block is in the blacklist
temp, block = turtle.inspect()
if _blist[block["name"]] then
  -- do the mining


Edited by Mirodin, 18 May 2016 - 09:34 PM.

#3 Sayinore

  • Members
  • 7 posts

Posted 26 May 2016 - 11:22 AM

Thanks to your idea :)! That helps me a lot. I use your idea to improve my program and it gets better now.
See my program at https://github.com/S...ster/Miner.lua.
Thank you again! :P

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users