farm chorus fruit

This commit is contained in:
kepler155c
2018-11-29 15:13:36 -05:00
parent a2a87db49c
commit 7b17e756f9
2 changed files with 48 additions and 28 deletions

View File

@@ -9,7 +9,8 @@ local os = _G.os
local peripheral = _G.peripheral
local turtle = _G.turtle
local CONFIG_FILE = 'usr/config/farm'
local CONFIG_FILE = 'usr/config/farmer'
local STARTUP_FILE = 'usr/autorun/farmer.lua'
local scanner = device['plethora:scanner'] or
turtle.equip('right', 'plethora:module:2') and device['plethora:scanner'] or
@@ -27,16 +28,25 @@ local crops = Util.readTable(CONFIG_FILE) or {
['minecraft:cocoa'] =
{ seed = 'minecraft:dye:3', mature = 8, action = 'pick' },
['minecraft:reeds'] = { action = 'bash' },
['minecraft:chorus_flower'] = { action = 'bash' },
['minecraft:chorus_plant'] =
{ seed = 'minecraft:chorus_flower', mature = 0, action = 'bash-smash', },
['minecraft:melon_block'] = { action = 'smash' },
['minecraft:pumpkin'] = { action = 'smash' },
['minecraft:chest'] = { action = 'drop' },
['minecraft:cactus'] = { action = 'bump' },
['minecraft:cactus'] = { action = 'smash' },
}
if not fs.exists(CONFIG_FILE) then
Util.writeTable(CONFIG_FILE, crops)
end
if not fs.exists(STARTUP_FILE) then
Util.writeFile(STARTUP_FILE,
[[os.sleep(1)
shell.openForegroundTab('packages/farms/farmer.lua')]])
end
local retain = Util.transpose {
"minecraft:diamond_pickaxe",
"plethora:module:2",
@@ -70,6 +80,16 @@ local function scan()
if b.action == 'drop' then
return doDropOff and b.y == -1
end
if b.action == 'bash-smash' then
if b.y == -1 then
b.action = 'smash'
end
if b.y == 0 then
b.action = 'bash'
end
return b.action ~= 'bash-smash'
end
if b.action == 'smash' then
return b.y == -1
end
@@ -128,7 +148,12 @@ local function harvest(blocks)
end
elseif b.action == 'smash' then
turtle.digDownAt(b)
if turtle.digDownAt(b) then
if crops[b.name].seed then
turtle.placeDown(crops[b.name].seed)
turtle.select(1)
end
end
elseif b.action == 'plant' then
if turtle.digDownAt(b) then