Last active
December 27, 2016 21:07
-
-
Save canassa/3d6426869cdf32ab6e8335ec1b9b46d0 to your computer and use it in GitHub Desktop.
Automate Reinforced Stone creation using a ComputerCraft Turtle.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local POLLING = 2 | |
local Sand = 'minecraft:sand' | |
local CFSpray = 'IC2:itemFoamSprayer' | |
local Scaffold = 'IC2:blockIronScaffold' | |
local Reinforced = 'IC2:blockAlloy' | |
local function SelectByName(name) | |
for i=1,16 do | |
local detail = turtle.getItemDetail(i) | |
if detail and detail.name == name then | |
turtle.select(i) | |
return true | |
end | |
end | |
return false | |
end | |
local function SelectByNameRobust(name) | |
while not SelectByName(name) do | |
print("Looking for ", name) | |
sleep(POLLING) | |
end | |
end | |
while true do | |
SelectByNameRobust(Scaffold) | |
turtle.place() | |
SelectByNameRobust(CFSpray) | |
if not turtle.place() then | |
-- Reload | |
turtle.dropDown() | |
sleep(10) | |
turtle.suckDown() | |
SelectByNameRobust(CFSpray) | |
turtle.place() | |
end | |
SelectByNameRobust(Sand) | |
turtle.dropUp(1) | |
while true do | |
local success, data = turtle.inspect() | |
if success and data.name == Reinforced then | |
break | |
end | |
sleep(1) | |
end | |
turtle.dig() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment