SHOW:
|
|
- or go back to the newest paste.
| 1 | --Shadow_Assailant's Dark Iron Forge-- | |
| 2 | --v2.0-- | |
| 3 | - | local function checkInv() -- Searches for a slot with items and bypasses empty inventory slots |
| 3 | + | |
| 4 | local function checkInv(b) -- Searches for a slot with items and bypasses empty inventory slots | |
| 5 | - | if turtle.getItemCount(b)==0 then |
| 5 | + | |
| 6 | - | -- It makes sense to me to use this because if there are multiple stacks of blocks, the first stack of dark iron |
| 6 | + | if turtle.getItemCount(b)==0 then |
| 7 | - | -- will go into the first empty slot. Seeing as the code defaults at slot 1, as soon as slot 1 is empty of regular |
| 7 | + | |
| 8 | - | -- iron, this code will disregard slot 1 until all of the iron has changed. |
| 8 | + | |
| 9 | - | -- As you can see below, the turtle will stop checking this function once i (the original amount of iron) has dropped |
| 9 | + | |
| 10 | - | -- to 0 signalling all iron has been converted. |
| 10 | + | until turtle.getItemCount(b)>0 or b==16 |
| 11 | end | |
| 12 | end | |
| 13 | ||
| 14 | - | until turtle.getItemCount(b)>0 |
| 14 | + | local function transfering() |
| 15 | local z = 1 | |
| 16 | - | end |
| 16 | + | local l = turtle.getItemCount(16) |
| 17 | repeat | |
| 18 | - | while true do |
| 18 | + | if turtle.getItemCount(z)<64 then |
| 19 | - | local b = 1 -- So the above function defaults at 1 |
| 19 | + | local s = turtle.getItemSpace(z) |
| 20 | - | for t = 1,16 do |
| 20 | + | turtle.select(16) |
| 21 | - | local i = turtle.getItemCount(t) -- Should(?) count items in each slot |
| 21 | + | turtle.transferTo(z,s) |
| 22 | - | if i>0 then |
| 22 | + | l = l - s |
| 23 | - | if turtle.getItemCount(16)>0 then -- If the inventory is FULL of Iron, there needs to be space for the Dark Iron, so it creates 1 slot for space |
| 23 | + | z = z + 1 |
| 24 | - | -- While checking this over before posting it, I did realize that should I choose to just put iron in slot 16, it will never do as it should. I will fix this. |
| 24 | + | |
| 25 | - | turtle.select(16) |
| 25 | + | z = z + 1 |
| 26 | end | |
| 27 | - | turtle.select(1) |
| 27 | + | until l<=0 |
| 28 | - | i = i - turtle.getItemCount(16) -- Seeing as these blocks are gone, the count needs to be recaculated |
| 28 | + | end |
| 29 | - | end |
| 29 | + | |
| 30 | - | turtle.turnRight() |
| 30 | + | local function wait(m) |
| 31 | - | turtle.turnRight() |
| 31 | + | m = m + 1 |
| 32 | - | while i>0 do |
| 32 | + | if m >= 10 then |
| 33 | - | checkInv() |
| 33 | + | term.clear() |
| 34 | - | turtle.place() |
| 34 | + | term.setCursorPos(1,1) |
| 35 | - | sleep(0.5) |
| 35 | + | print("Must let Wrath Fire regrow!")
|
| 36 | - | turtle.dig() |
| 36 | + | print("Sleeping...")
|
| 37 | - | i = i - 1 -- Once less block of regular iron, so must take that into account |
| 37 | + | sleep(90) |
| 38 | term.clear() | |
| 39 | - | turtle.turnRight() |
| 39 | + | term.setCursorPos(1,1) |
| 40 | - | turtle.turnRight() |
| 40 | + | print("Resuming work!")
|
| 41 | - | turtle.select(t) |
| 41 | + | term.setCursorPos(1,1) |
| 42 | - | turtle.drop() |
| 42 | + | m = 0 |
| 43 | end | |
| 44 | - | sleep(0.5) -- Will wait until I give it iron |
| 44 | + | end |
| 45 | ||
| 46 | for t = 1, 16 do | |
| 47 | for f = 1, 15 do | |
| 48 | while 2 > 1 do | |
| 49 | term.clear() | |
| 50 | term.setCursorPos(1,1) | |
| 51 | local b = 1 -- So the above function defaults at 1 | |
| 52 | local m = 0 | |
| 53 | local i = 0 -- Inventory 1 - 16 | |
| 54 | local q = 0 -- Inventory 1 - 15 | |
| 55 | i = turtle.getItemCount(t) -- Should(?) count items in each slot | |
| 56 | q = turtle.getItemCount(f) | |
| 57 | if i>0 then | |
| 58 | term.setCursorPos(1,1) | |
| 59 | print("Creating Dark Iron!")
| |
| 60 | term.setCursorPos(1,1) | |
| 61 | if turtle.getItemCount(16)>0 and q>=897 then -- If the inventory is FULL of Iron, there needs to be space for the Dark Iron, so it creates 1 slot for space | |
| 62 | turtle.select(16) | |
| 63 | turtle.drop() | |
| 64 | turtle.select(1) | |
| 65 | i = i - turtle.getItemCount(16) -- Seeing as these blocks are gone, the count needs to be recaculated | |
| 66 | elseif turtle.getItemCount(16)>0 and q<897 then | |
| 67 | transfering() | |
| 68 | turtle.select(1) | |
| 69 | end | |
| 70 | turtle.turnRight() | |
| 71 | turtle.turnRight() | |
| 72 | while i>0 and turtle.getItemCount(t)>0 do | |
| 73 | checkInv(b) | |
| 74 | turtle.place() | |
| 75 | sleep(3) | |
| 76 | turtle.dig() | |
| 77 | wait(m) | |
| 78 | i = i - 1 -- One less block of regular iron, so must take that into account | |
| 79 | end | |
| 80 | turtle.turnRight() | |
| 81 | turtle.turnRight() | |
| 82 | turtle.select(t) | |
| 83 | turtle.drop() | |
| 84 | turtle.select(1) | |
| 85 | else | |
| 86 | term.clear() | |
| 87 | sleep(1) -- Will wait until I give it iron | |
| 88 | ||
| 89 | print("Waiting!")
| |
| 90 | sleep(1) | |
| 91 | term.setCursorPos(1,1) | |
| 92 | i = turtle.getItemCount(t) | |
| 93 | q = turtle.getItemCount(f) | |
| 94 | end | |
| 95 | end | |
| 96 | end | |
| 97 | end |