app tweaks
This commit is contained in:
@@ -9,7 +9,14 @@ local device = _G.device
|
||||
local os = _G.os
|
||||
local turtle = _G.turtle
|
||||
|
||||
local retain = Util.transpose {
|
||||
'minecraft:shears',
|
||||
'minecraft_wheat',
|
||||
'minecraft:diamond_sword',
|
||||
'plethora:module:3',
|
||||
}
|
||||
local config = {
|
||||
animal = 'Cow',
|
||||
max_cows = 15,
|
||||
}
|
||||
Config.load('cows', config)
|
||||
@@ -51,7 +58,7 @@ local function getCowCount()
|
||||
local xpCount = 0
|
||||
|
||||
Util.filterInplace(blocks, function(v)
|
||||
if v.name == 'Cow' then
|
||||
if v.name == config.animal then
|
||||
if v.y > -.5 then grown = grown + 1 end
|
||||
if v.y < -.5 then babies = babies + 1 end
|
||||
return v.y > -.5
|
||||
@@ -76,16 +83,26 @@ local function butcher()
|
||||
end
|
||||
turtle.equip('right', 'plethora:module:3')
|
||||
|
||||
turtle.dropUp('minecraft:beef')
|
||||
turtle.dropUp('minecraft:leather')
|
||||
turtle.eachFilledSlot(function(slot)
|
||||
if not retain[slot.name] then
|
||||
turtle.select(slot.index)
|
||||
turtle.dropUp()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
local function breed()
|
||||
turtle.select(1)
|
||||
|
||||
if config.animal == 'Sheep' then
|
||||
turtle.place('minecraft:shears')
|
||||
end
|
||||
turtle.place('minecraft:wheat')
|
||||
for _ = 1, 3 do
|
||||
turtle.turnRight()
|
||||
if config.animal == 'Sheep' then
|
||||
turtle.place('minecraft:shears')
|
||||
end
|
||||
turtle.place('minecraft:wheat')
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
_G.requireInjector(_ENV)
|
||||
|
||||
local Point = require('point')
|
||||
|
||||
local device = _G.device
|
||||
local turtle = _G.turtle
|
||||
|
||||
local MAX_FUEL = turtle.getFuelLimit()
|
||||
|
||||
local scanner = device['plethora:scanner'] or
|
||||
turtle.equip('right', 'plethora:module:2') and device['plethora:scanner'] or
|
||||
error('Plethora scanner required')
|
||||
|
||||
if not turtle.select('minecraft:bucket') then
|
||||
error('bucket required')
|
||||
end
|
||||
|
||||
local s, m = turtle.run(function()
|
||||
local facing = scanner.getBlockMeta(0, 0, 0).state.facing
|
||||
turtle.setPoint({ x = 0, y = 0, z = 0, heading = Point.facings[facing].heading })
|
||||
|
||||
local blocks = scanner.scan()
|
||||
local first, last = blocks[#blocks].y, blocks[1].y
|
||||
|
||||
for y = first, last, -1 do
|
||||
if turtle.getFuelLevel() >= (MAX_FUEL - 1000) then
|
||||
print('I am full')
|
||||
break
|
||||
end
|
||||
local t = { }
|
||||
for _,v in pairs(blocks) do
|
||||
if v.y == y then
|
||||
if (v.name == 'minecraft:lava' and v.metadata == 0) or
|
||||
(v.name == 'minecraft:flowing_lava' and v.metadata == 0) then
|
||||
table.insert(t, v)
|
||||
end
|
||||
end
|
||||
end
|
||||
print(y .. ': ' .. #t)
|
||||
Point.eachClosest(turtle.point, t, function(b)
|
||||
if turtle.getFuelLevel() >= (MAX_FUEL - 1000) then
|
||||
return true
|
||||
end
|
||||
turtle.placeDownAt(b)
|
||||
turtle.refuel()
|
||||
print(turtle.getFuelLevel())
|
||||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
turtle.gotoY(0)
|
||||
turtle._goto({ x = 0, y = 0, z = 0 })
|
||||
|
||||
if not s and m then
|
||||
error(m)
|
||||
end
|
||||
Reference in New Issue
Block a user