mirror of
https://github.com/kepler155c/opus
synced 2025-01-12 16:51:05 +00:00
upgrade item keys
This commit is contained in:
parent
9aca96cc3e
commit
b5ee5db16b
@ -3,7 +3,7 @@ local Util = require('util')
|
||||
local itemDB = require('itemDB')
|
||||
local Peripheral = require('peripheral')
|
||||
|
||||
local ChestProvider = class()
|
||||
local ChestAdapter = class()
|
||||
|
||||
local keys = Util.transpose({
|
||||
'damage',
|
||||
@ -14,7 +14,7 @@ local keys = Util.transpose({
|
||||
'nbtHash',
|
||||
})
|
||||
|
||||
function ChestProvider:init(args)
|
||||
function ChestAdapter:init(args)
|
||||
local defaults = {
|
||||
items = { },
|
||||
name = 'chest',
|
||||
@ -33,11 +33,11 @@ function ChestProvider:init(args)
|
||||
end
|
||||
end
|
||||
|
||||
function ChestProvider:isValid()
|
||||
function ChestAdapter:isValid()
|
||||
return not not self.list
|
||||
end
|
||||
|
||||
function ChestProvider:getCachedItemDetails(item, k)
|
||||
function ChestAdapter:getCachedItemDetails(item, k)
|
||||
local key = { item.name, item.damage, item.nbtHash }
|
||||
|
||||
local detail = itemDB:get(key)
|
||||
@ -64,12 +64,12 @@ function ChestProvider:getCachedItemDetails(item, k)
|
||||
end
|
||||
end
|
||||
|
||||
function ChestProvider:refresh(throttle)
|
||||
function ChestAdapter:refresh(throttle)
|
||||
return self:listItems(throttle)
|
||||
end
|
||||
|
||||
-- provide a consolidated list of items
|
||||
function ChestProvider:listItems(throttle)
|
||||
function ChestAdapter:listItems(throttle)
|
||||
self.cache = { }
|
||||
local items = { }
|
||||
|
||||
@ -82,13 +82,7 @@ function ChestProvider:listItems(throttle)
|
||||
if not entry then
|
||||
entry = self:getCachedItemDetails(v, k)
|
||||
if entry then
|
||||
entry.dmg = entry.damage
|
||||
entry.id = entry.name
|
||||
entry.count = 0
|
||||
entry.display_name = entry.displayName
|
||||
entry.max_size = entry.maxCount
|
||||
entry.nbt_hash = entry.nbtHash
|
||||
entry.lname = entry.displayName:lower()
|
||||
self.cache[key] = entry
|
||||
table.insert(items, entry)
|
||||
end
|
||||
@ -96,7 +90,6 @@ function ChestProvider:listItems(throttle)
|
||||
|
||||
if entry then
|
||||
entry.count = entry.count + v.count
|
||||
entry.qty = entry.count
|
||||
end
|
||||
throttle()
|
||||
end
|
||||
@ -106,24 +99,24 @@ function ChestProvider:listItems(throttle)
|
||||
return items
|
||||
end
|
||||
|
||||
function ChestProvider:getItemInfo(id, dmg, nbtHash)
|
||||
function ChestAdapter:getItemInfo(name, damage, nbtHash)
|
||||
if not self.cache then
|
||||
self:listItems()
|
||||
end
|
||||
local key = table.concat({ id, dmg, nbtHash }, ':')
|
||||
local key = table.concat({ name, damage, nbtHash }, ':')
|
||||
return self.cache[key]
|
||||
end
|
||||
|
||||
function ChestProvider:craft(id, dmg, qty)
|
||||
function ChestAdapter:craft(name, damage, qty)
|
||||
end
|
||||
|
||||
function ChestProvider:craftItems(items)
|
||||
function ChestAdapter:craftItems(items)
|
||||
end
|
||||
|
||||
function ChestProvider:provide(item, qty, slot, direction)
|
||||
function ChestAdapter:provide(item, qty, slot, direction)
|
||||
local stacks = self.list()
|
||||
for key,stack in pairs(stacks) do
|
||||
if stack.name == item.id and stack.damage == item.dmg then
|
||||
if stack.name == item.name and stack.damage == item.damage then
|
||||
local amount = math.min(qty, stack.count)
|
||||
if amount > 0 then
|
||||
self.pushItems(direction or self.direction, key, amount, slot)
|
||||
@ -136,12 +129,12 @@ function ChestProvider:provide(item, qty, slot, direction)
|
||||
end
|
||||
end
|
||||
|
||||
function ChestProvider:extract(slot, qty, toSlot)
|
||||
function ChestAdapter:extract(slot, qty, toSlot)
|
||||
self.pushItems(self.direction, slot, qty, toSlot)
|
||||
end
|
||||
|
||||
function ChestProvider:insert(slot, qty)
|
||||
function ChestAdapter:insert(slot, qty)
|
||||
self.pullItems(self.direction, slot, qty)
|
||||
end
|
||||
|
||||
return ChestProvider
|
||||
return ChestAdapter
|
@ -1,6 +1,5 @@
|
||||
local class = require('class')
|
||||
local Util = require('util')
|
||||
local Logger = require('logger')
|
||||
local Peripheral = require('peripheral')
|
||||
|
||||
local MEProvider = class()
|
||||
@ -58,11 +57,28 @@ local function safeString(text)
|
||||
return text
|
||||
end
|
||||
|
||||
local convertNames = {
|
||||
name = 'id',
|
||||
damage = 'dmg',
|
||||
maxCount = 'max_size',
|
||||
count = 'qty',
|
||||
displayName = 'display_name',
|
||||
maxDamage = 'max_dmg',
|
||||
}
|
||||
|
||||
local function convertItem(item)
|
||||
for k,v in pairs(convertNames) do
|
||||
item[k] = item[v]
|
||||
item[v] = nil
|
||||
end
|
||||
item.displayName = safeString(item.displayName)
|
||||
end
|
||||
|
||||
function MEProvider:refresh()
|
||||
self.items = self.getAvailableItems('all')
|
||||
for _,v in pairs(self.items) do
|
||||
Util.merge(v, v.item)
|
||||
v.name = safeString(v.display_name)
|
||||
convertItem(v)
|
||||
end
|
||||
return self.items
|
||||
end
|
||||
@ -72,25 +88,24 @@ function MEProvider:listItems()
|
||||
return self.items
|
||||
end
|
||||
|
||||
function MEProvider:getItemInfo(id, dmg)
|
||||
function MEProvider:getItemInfo(name, damage)
|
||||
|
||||
for key,item in pairs(self.items) do
|
||||
if item.id == id and item.dmg == dmg then
|
||||
if item.name == name and item.damage == damage then
|
||||
return item
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function MEProvider:craft(id, dmg, qty)
|
||||
function MEProvider:craft(name, damage, count)
|
||||
|
||||
self:refresh()
|
||||
|
||||
local item = self:getItemInfo(id, dmg)
|
||||
local item = self:getItemInfo(name, damage)
|
||||
|
||||
if item and item.is_craftable then
|
||||
|
||||
Logger.log('MEProvider', 'requested crafting for: ' .. id .. ':' .. dmg .. ' qty: ' .. qty)
|
||||
self.requestCrafting({ id = id, dmg = dmg }, qty)
|
||||
self.requestCrafting({ id = name, dmg = damage }, count)
|
||||
return true
|
||||
end
|
||||
end
|
||||
@ -109,36 +124,32 @@ function MEProvider:craftItems(items)
|
||||
if count >= #cpus then
|
||||
break
|
||||
end
|
||||
if self:craft(item.id, item.dmg, item.qty) then
|
||||
if self:craft(item.name, item.damage, item.count) then
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function MEProvider:provide(item, qty, slot)
|
||||
function MEProvider:provide(item, count, slot)
|
||||
return pcall(function()
|
||||
self.exportItem({
|
||||
id = item.id,
|
||||
dmg = item.dmg
|
||||
}, self.oside, qty, slot)
|
||||
id = item.name,
|
||||
dmg = item.damage
|
||||
}, self.oside, count, slot)
|
||||
end)
|
||||
end
|
||||
|
||||
function MEProvider:insert(slot, qty)
|
||||
local s, m = pcall(function() self.pullItem(self.oside, slot, qty) end)
|
||||
function MEProvider:insert(slot, count)
|
||||
local s, m = pcall(function() self.pullItem(self.oside, slot, count) end)
|
||||
if not s and m then
|
||||
print('MEProvider:pullItem')
|
||||
print(m)
|
||||
Logger.log('MEProvider', 'Insert failed, trying again')
|
||||
sleep(1)
|
||||
s, m = pcall(function() self.pullItem(self.oside, slot, qty) end)
|
||||
s, m = pcall(function() self.pullItem(self.oside, slot, count) end)
|
||||
if not s and m then
|
||||
print('MEProvider:pullItem')
|
||||
print(m)
|
||||
Logger.log('MEProvider', 'Insert failed again')
|
||||
read()
|
||||
else
|
||||
Logger.log('MEProvider', 'Insert successful')
|
||||
end
|
||||
end
|
||||
end
|
@ -3,7 +3,7 @@ local Util = require('util')
|
||||
local Peripheral = require('peripheral')
|
||||
local itemDB = require('itemDB')
|
||||
|
||||
local RefinedProvider = class()
|
||||
local RefinedAdapter = class()
|
||||
|
||||
local keys = {
|
||||
'damage',
|
||||
@ -14,7 +14,7 @@ local keys = {
|
||||
'nbtHash',
|
||||
}
|
||||
|
||||
function RefinedProvider:init(args)
|
||||
function RefinedAdapter:init(args)
|
||||
local defaults = {
|
||||
items = { },
|
||||
name = 'refinedStorage',
|
||||
@ -28,15 +28,15 @@ function RefinedProvider:init(args)
|
||||
end
|
||||
end
|
||||
|
||||
function RefinedProvider:isValid()
|
||||
function RefinedAdapter:isValid()
|
||||
return not not self.listAvailableItems
|
||||
end
|
||||
|
||||
function RefinedProvider:isOnline()
|
||||
function RefinedAdapter:isOnline()
|
||||
return self.getNetworkEnergyStored() > 0
|
||||
end
|
||||
|
||||
function RefinedProvider:getCachedItemDetails(item)
|
||||
function RefinedAdapter:getCachedItemDetails(item)
|
||||
local key = { item.name, item.damage, item.nbtHash }
|
||||
|
||||
local detail = itemDB:get(key)
|
||||
@ -49,7 +49,6 @@ function RefinedProvider:getCachedItemDetails(item)
|
||||
return
|
||||
end
|
||||
Util.merge(detail, meta)
|
||||
detail.lname = detail.displayName:lower()
|
||||
|
||||
local t = { }
|
||||
for _,k in pairs(keys) do
|
||||
@ -65,7 +64,7 @@ function RefinedProvider:getCachedItemDetails(item)
|
||||
end
|
||||
end
|
||||
|
||||
function RefinedProvider:listItems()
|
||||
function RefinedAdapter:listItems()
|
||||
local items = { }
|
||||
local list
|
||||
|
||||
@ -80,10 +79,7 @@ function RefinedProvider:listItems()
|
||||
for _,v in pairs(list) do
|
||||
local item = self:getCachedItemDetails(v)
|
||||
if item then
|
||||
item.display_name = item.displayName
|
||||
item.id = v.name
|
||||
item.count = v.count
|
||||
item.qty = v.count
|
||||
table.insert(items, item)
|
||||
end
|
||||
throttle()
|
||||
@ -94,7 +90,7 @@ function RefinedProvider:listItems()
|
||||
return items
|
||||
end
|
||||
|
||||
function RefinedProvider:getItemInfo(fingerprint)
|
||||
function RefinedAdapter:getItemInfo(fingerprint)
|
||||
|
||||
local key = { fingerprint.name, fingerprint.damage, fingerprint.nbtHash }
|
||||
|
||||
@ -106,12 +102,11 @@ function RefinedProvider:getItemInfo(fingerprint)
|
||||
local detail = self.findItem(item)
|
||||
if detail then
|
||||
item.count = detail.count
|
||||
item.qty = detail.count
|
||||
return item
|
||||
end
|
||||
end
|
||||
|
||||
function RefinedProvider:isCrafting(item)
|
||||
function RefinedAdapter:isCrafting(item)
|
||||
for _,task in pairs(self.getCraftingTasks()) do
|
||||
local output = task.getPattern().outputs[1]
|
||||
if output.name == item.name and
|
||||
@ -123,26 +118,26 @@ function RefinedProvider:isCrafting(item)
|
||||
return false
|
||||
end
|
||||
|
||||
function RefinedProvider:craft(item, qty)
|
||||
function RefinedAdapter:craft(item, qty)
|
||||
local detail = self.findItem(item)
|
||||
if detail then
|
||||
return detail.craft(qty)
|
||||
end
|
||||
end
|
||||
|
||||
function RefinedProvider:craftItems(items)
|
||||
function RefinedAdapter:craftItems(items)
|
||||
return false
|
||||
end
|
||||
|
||||
function RefinedProvider:provide(item, qty, slot)
|
||||
function RefinedAdapter:provide(item, qty, slot)
|
||||
end
|
||||
|
||||
function RefinedProvider:extract(slot, qty)
|
||||
function RefinedAdapter:extract(slot, qty)
|
||||
-- self.pushItems(self.direction, slot, qty)
|
||||
end
|
||||
|
||||
function RefinedProvider:insert(slot, qty)
|
||||
function RefinedAdapter:insert(slot, qty)
|
||||
-- self.pullItems(self.direction, slot, qty)
|
||||
end
|
||||
|
||||
return RefinedProvider
|
||||
return RefinedAdapter
|
@ -3,11 +3,11 @@ local Util = require('util')
|
||||
|
||||
local Craft = { }
|
||||
|
||||
local function clearGrid(chestProvider)
|
||||
local function clearGrid(chestAdapter)
|
||||
for i = 1, 16 do
|
||||
local count = turtle.getItemCount(i)
|
||||
if count > 0 then
|
||||
chestProvider:insert(i, count)
|
||||
chestAdapter:insert(i, count)
|
||||
if turtle.getItemCount(i) ~= 0 then
|
||||
return false
|
||||
end
|
||||
@ -39,13 +39,13 @@ local function getItemCount(items, key)
|
||||
return 0
|
||||
end
|
||||
|
||||
local function turtleCraft(recipe, qty, chestProvider)
|
||||
local function turtleCraft(recipe, qty, chestAdapter)
|
||||
|
||||
clearGrid(chestProvider)
|
||||
clearGrid(chestAdapter)
|
||||
|
||||
for k,v in pairs(recipe.ingredients) do
|
||||
local item = splitKey(v)
|
||||
chestProvider:provide({ id = item.name, dmg = item.damage, nbt_hash = item.nbtHash }, qty, k)
|
||||
chestAdapter:provide(item, qty, k)
|
||||
if turtle.getItemCount(k) == 0 then -- ~= qty then
|
||||
-- FIX: ingredients cannot be stacked
|
||||
return false
|
||||
@ -55,9 +55,9 @@ local function turtleCraft(recipe, qty, chestProvider)
|
||||
return turtle.craft()
|
||||
end
|
||||
|
||||
function Craft.craftRecipe(recipe, count, chestProvider)
|
||||
function Craft.craftRecipe(recipe, count, chestAdapter)
|
||||
|
||||
local items = chestProvider:listItems()
|
||||
local items = chestAdapter:listItems()
|
||||
|
||||
local function sumItems(items)
|
||||
-- produces { ['minecraft:planks:0'] = 8 }
|
||||
@ -81,7 +81,7 @@ function Craft.craftRecipe(recipe, count, chestProvider)
|
||||
Util.print('Crafting %d %s', icount * count - itemCount, key)
|
||||
if not Craft.craftRecipe(irecipe,
|
||||
icount * count - itemCount,
|
||||
chestProvider) then
|
||||
chestAdapter) then
|
||||
turtle.select(1)
|
||||
return
|
||||
end
|
||||
@ -89,7 +89,7 @@ Util.print('Crafting %d %s', icount * count - itemCount, key)
|
||||
end
|
||||
end
|
||||
repeat
|
||||
if not turtleCraft(recipe, math.min(count, maxCount), chestProvider) then
|
||||
if not turtleCraft(recipe, math.min(count, maxCount), chestAdapter) then
|
||||
turtle.select(1)
|
||||
return false
|
||||
end
|
||||
@ -157,10 +157,10 @@ function Craft.getCraftableAmountTest()
|
||||
end
|
||||
|
||||
function Craft.craftRecipeTest(name, count)
|
||||
local ChestProvider = require('chestProvider18')
|
||||
local chestProvider = ChestProvider({ wrapSide = 'top', direction = 'down' })
|
||||
local ChestAdapter = require('chestAdapter18')
|
||||
local chestAdapter = ChestAdapter({ wrapSide = 'top', direction = 'down' })
|
||||
Craft.setRecipes(Util.readTable('usr/etc/recipes.db'))
|
||||
return { Craft.craftRecipe(Craft.recipes[name], count, chestProvider) }
|
||||
return { Craft.craftRecipe(Craft.recipes[name], count, chestAdapter) }
|
||||
end
|
||||
|
||||
return Craft
|
||||
|
@ -38,6 +38,7 @@ local function dig(action)
|
||||
|
||||
local hi = turtle.getHeadingInfo(direction)
|
||||
local node = { x = turtle.point.x + hi.xd, y = turtle.point.y + hi.yd, z = turtle.point.z + hi.zd }
|
||||
|
||||
if Point.inBox(node, box) then
|
||||
|
||||
local key = toKey(node)
|
||||
@ -57,8 +58,10 @@ local function move(action)
|
||||
dig(turtle.getAction('forward'))
|
||||
elseif action == 'up' then
|
||||
dig(turtle.getAction('up'))
|
||||
dig(turtle.getAction('forward'))
|
||||
elseif action == 'down' then
|
||||
dig(turtle.getAction('down'))
|
||||
dig(turtle.getAction('forward'))
|
||||
elseif action == 'back' then
|
||||
dig(turtle.getAction('up'))
|
||||
dig(turtle.getAction('down'))
|
||||
@ -123,7 +126,9 @@ return function(startPt, endPt, firstPt, verbose)
|
||||
box.ey = math.max(startPt.y, endPt.y)
|
||||
box.ez = math.max(startPt.z, endPt.z)
|
||||
|
||||
turtle.pathfind(firstPt)
|
||||
if not turtle.pathfind(firstPt) then
|
||||
error('failed to reach starting point')
|
||||
end
|
||||
|
||||
turtle.setPolicy("attack", { dig = dig }, "assuredMove")
|
||||
|
||||
|
@ -4,20 +4,20 @@ end
|
||||
|
||||
requireInjector(getfenv(1))
|
||||
|
||||
local Blocks = require('blocks')
|
||||
local class = require('class')
|
||||
local Event = require('event')
|
||||
local MEProvider = require('meProvider')
|
||||
local Message = require('message')
|
||||
local Point = require('point')
|
||||
local Schematic = require('schematic')
|
||||
local TableDB = require('tableDB')
|
||||
local UI = require('ui')
|
||||
local Util = require('util')
|
||||
local Blocks = require('blocks')
|
||||
local class = require('class')
|
||||
local Event = require('event')
|
||||
local MEAdapter = require('meAdapter')
|
||||
local Message = require('message')
|
||||
local Point = require('point')
|
||||
local Schematic = require('schematic')
|
||||
local TableDB = require('tableDB')
|
||||
local UI = require('ui')
|
||||
local Util = require('util')
|
||||
|
||||
local ChestProvider = require('chestProvider')
|
||||
local ChestAdapter = require('chestAdapter')
|
||||
if Util.getVersion() == 1.8 then
|
||||
ChestProvider = require('chestProvider18')
|
||||
ChestAdapter = require('chestAdapter18')
|
||||
end
|
||||
|
||||
if not _G.device then
|
||||
@ -45,6 +45,40 @@ local Builder = {
|
||||
|
||||
local pistonFacings
|
||||
|
||||
-- Temp functions until conversion to new adapters is complete
|
||||
local function convertSingleForward(item)
|
||||
item.name = item.id
|
||||
item.damage = item.dmg
|
||||
item.count = item.count
|
||||
item.maxCount = item.max_size
|
||||
return item
|
||||
end
|
||||
|
||||
local function convertForward(t)
|
||||
for _,v in pairs(t) do
|
||||
convertSingleForward(v)
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
local function convertSingleBack(item)
|
||||
if item then
|
||||
item.id = item.name
|
||||
item.dmg = item.damage
|
||||
item.qty = item.count
|
||||
item.max_size = item.maxCount
|
||||
item.display_name = item.displayName
|
||||
end
|
||||
return item
|
||||
end
|
||||
|
||||
local function convertBack(t)
|
||||
for _,v in pairs(t) do
|
||||
convertSingleBack(v)
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
--[[-- SubDB --]]--
|
||||
subDB = TableDB({
|
||||
fileName = fs.combine(BUILDER_DIR, 'sub.db'),
|
||||
@ -397,7 +431,7 @@ function Builder:dumpInventory()
|
||||
for i = 1, 16 do
|
||||
local qty = turtle.getItemCount(i)
|
||||
if qty > 0 then
|
||||
self.itemProvider:insert(i, qty)
|
||||
self.itemAdapter:insert(i, qty)
|
||||
end
|
||||
if turtle.getItemCount(i) ~= 0 then
|
||||
success = false
|
||||
@ -411,7 +445,7 @@ end
|
||||
function Builder:dumpInventoryWithCheck()
|
||||
|
||||
while not self:dumpInventory() do
|
||||
print('Provider is full or missing - make space or replace')
|
||||
print('Storage is full or missing - make space or replace')
|
||||
print('Press enter to continue')
|
||||
turtle.setHeading(0)
|
||||
read()
|
||||
@ -435,17 +469,17 @@ function Builder:autocraft(supplies)
|
||||
item.qty = item.qty + (s.need - s.qty)
|
||||
end
|
||||
|
||||
Builder.itemProvider:craftItems(t)
|
||||
Builder.itemAdapter:craftItems(convertForward(t))
|
||||
end
|
||||
|
||||
function Builder:getSupplies()
|
||||
|
||||
self.itemProvider:refresh()
|
||||
self.itemAdapter:refresh()
|
||||
|
||||
local t = { }
|
||||
for _,s in ipairs(self.slots) do
|
||||
if s.need > 0 then
|
||||
local item = self.itemProvider:getItemInfo(s.id, s.dmg)
|
||||
local item = convertSingleBack(self.itemAdapter:getItemInfo(s.id, s.dmg))
|
||||
if item then
|
||||
s.name = item.display_name
|
||||
|
||||
@ -459,7 +493,7 @@ function Builder:getSupplies()
|
||||
s.need = qty
|
||||
end
|
||||
if qty > 0 then
|
||||
self.itemProvider:provide(item, qty, s.index)
|
||||
self.itemAdapter:provide(convertSingleForward(item), qty, s.index)
|
||||
s.qty = turtle.getItemCount(s.index)
|
||||
end
|
||||
else
|
||||
@ -485,7 +519,7 @@ function Builder:refuel()
|
||||
|
||||
local fuel = subDB:getSubstitutedItem(self.fuelItem.id, self.fuelItem.dmg)
|
||||
|
||||
self.itemProvider:provide(fuel, 64, 1)
|
||||
self.itemAdapter:provide(convertSingleForward(fuel), 64, 1)
|
||||
if turtle.getItemCount(1) == 0 then
|
||||
print('Out of fuel, add fuel to chest/ME system')
|
||||
turtle.setHeading(0)
|
||||
@ -523,23 +557,23 @@ function Builder:inAirDropoff()
|
||||
turtle.goto(pt.x, pt.z, pt.y)
|
||||
os.sleep(.1) -- random computer is not connected error
|
||||
|
||||
local chestProvider = ChestProvider({ direction = 'down', wrapSide = 'top' })
|
||||
local chestAdapter = ChestAdapter({ direction = 'down', wrapSide = 'top' })
|
||||
|
||||
if not chestProvider:isValid() then
|
||||
if not chestAdapter:isValid() then
|
||||
self:log('Chests above is not valid')
|
||||
return false
|
||||
end
|
||||
|
||||
local oldProvider = self.itemProvider
|
||||
self.itemProvider = chestProvider
|
||||
local oldAdapter = self.itemAdapter
|
||||
self.itemAdapter = chestAdapter
|
||||
|
||||
if not self:dumpInventory() then
|
||||
self:log('Unable to dump inventory')
|
||||
self.itemProvider = oldProvider
|
||||
self.itemAdapter = oldAdapter
|
||||
return false
|
||||
end
|
||||
|
||||
self.itemProvider = oldProvider
|
||||
self.itemAdapter = oldAdapter
|
||||
|
||||
Message.broadcast('thanks', { })
|
||||
|
||||
@ -563,7 +597,7 @@ function Builder:inAirResupply()
|
||||
return false
|
||||
end
|
||||
|
||||
local oldProvider = self.itemProvider
|
||||
local oldAdapter = self.itemAdapter
|
||||
|
||||
self:log('Requesting air supply drop for supply #: ' .. self.slotUid)
|
||||
while true do
|
||||
@ -571,7 +605,7 @@ function Builder:inAirResupply()
|
||||
local _, id, msg, _ = Message.waitForMessage('gotSupplies', 1)
|
||||
|
||||
if not msg or not msg.contents then
|
||||
self.itemProvider = oldProvider
|
||||
self.itemAdapter = oldAdapter
|
||||
return false
|
||||
end
|
||||
|
||||
@ -586,17 +620,17 @@ function Builder:inAirResupply()
|
||||
turtle.goto(pt.x, pt.z, pt.y)
|
||||
os.sleep(.1) -- random computer is not connected error
|
||||
|
||||
local chestProvider = ChestProvider({ direction = 'down', wrapSide = 'top' })
|
||||
local chestAdapter = ChestAdapter({ direction = 'down', wrapSide = 'top' })
|
||||
|
||||
if not chestProvider:isValid() then
|
||||
if not chestAdapter:isValid() then
|
||||
Util.print('not valid')
|
||||
read()
|
||||
end
|
||||
|
||||
self.itemProvider = chestProvider
|
||||
self.itemAdapter = chestAdapter
|
||||
|
||||
if not self:dumpInventory() then
|
||||
self.itemProvider = oldProvider
|
||||
self.itemAdapter = oldAdapter
|
||||
return false
|
||||
end
|
||||
self:refuel()
|
||||
@ -606,7 +640,7 @@ function Builder:inAirResupply()
|
||||
|
||||
Message.broadcast('thanks', { })
|
||||
|
||||
self.itemProvider = oldProvider
|
||||
self.itemAdapter = oldAdapter
|
||||
|
||||
if #supplies == 0 then
|
||||
|
||||
@ -1449,7 +1483,7 @@ end
|
||||
|
||||
function substitutionPage:enable()
|
||||
|
||||
self.allItems = Builder.itemProvider:refresh()
|
||||
self.allItems = convertBack(Builder.itemAdapter:refresh())
|
||||
self.grid.values = self.allItems
|
||||
for _,item in pairs(self.grid.values) do
|
||||
item.key = item.id .. ':' .. item.dmg
|
||||
@ -1583,7 +1617,7 @@ function supplyPage:eventHandler(event)
|
||||
|
||||
if event.type == 'craft' then
|
||||
local s = self.grid:getSelected()
|
||||
if Builder.itemProvider:craft(s.id, s.dmg, s.need-s.qty) then
|
||||
if Builder.itemAdapter:craft(s.id, s.dmg, s.need-s.qty) then
|
||||
local name = s.name or ''
|
||||
self.statusBar:timedStatus('Requested ' .. s.need-s.qty .. ' ' .. name, 3)
|
||||
else
|
||||
@ -1708,12 +1742,12 @@ function listingPage:eventHandler(event)
|
||||
|
||||
if event.type == 'craft' then
|
||||
local s = self.grid:getSelected()
|
||||
local item = Builder.itemProvider:getItemInfo(s.id, s.dmg)
|
||||
local item = convertSingleBack(Builder.itemAdapter:getItemInfo(s.id, s.dmg))
|
||||
if item and item.is_craftable then
|
||||
local qty = math.max(0, s.need - item.qty)
|
||||
|
||||
if item then
|
||||
Builder.itemProvider:craft(s.id, s.dmg, qty)
|
||||
Builder.itemAdapter:craft(s.id, s.dmg, qty)
|
||||
local name = s.name or s.key
|
||||
self.statusBar:timedStatus('Requested ' .. qty .. ' ' .. name, 3)
|
||||
end
|
||||
@ -1768,11 +1802,11 @@ function listingPage:refresh(throttle)
|
||||
|
||||
local supplyList = Builder:getBlockCounts()
|
||||
|
||||
Builder.itemProvider:refresh(throttle)
|
||||
Builder.itemAdapter:refresh(throttle)
|
||||
|
||||
for _,b in pairs(supplyList) do
|
||||
if b.need > 0 then
|
||||
local item = Builder.itemProvider:getItemInfo(b.id, b.dmg)
|
||||
local item = convertSingleBack(Builder.itemAdapter:getItemInfo(b.id, b.dmg))
|
||||
|
||||
if item then
|
||||
local block = blocks.blockDB:lookup(b.id, b.dmg)
|
||||
@ -2054,10 +2088,10 @@ if #args < 1 then
|
||||
error('supply file name')
|
||||
end
|
||||
|
||||
Builder.itemProvider = MEProvider()
|
||||
if not Builder.itemProvider:isValid() then
|
||||
Builder.itemProvider = ChestProvider()
|
||||
if not Builder.itemProvider:isValid() then
|
||||
Builder.itemAdapter = MEAdapter()
|
||||
if not Builder.itemAdapter:isValid() then
|
||||
Builder.itemAdapter = ChestAdapter()
|
||||
if not Builder.itemAdapter:isValid() then
|
||||
error('A chest or ME interface must be below turtle')
|
||||
end
|
||||
end
|
||||
|
@ -1,15 +1,15 @@
|
||||
requireInjector(getfenv(1))
|
||||
|
||||
local ChestProvider = require('chestProvider18')
|
||||
local Config = require('config')
|
||||
local Craft = require('turtle.craft')
|
||||
local Event = require('event')
|
||||
local itemDB = require('itemDB')
|
||||
local Peripheral = require('peripheral')
|
||||
local RefinedProvider = require('refinedProvider')
|
||||
local Terminal = require('terminal')
|
||||
local UI = require('ui')
|
||||
local Util = require('util')
|
||||
local ChestAdapter = require('chestAdapter18')
|
||||
local Config = require('config')
|
||||
local Craft = require('turtle.craft')
|
||||
local Event = require('event')
|
||||
local itemDB = require('itemDB')
|
||||
local Peripheral = require('peripheral')
|
||||
local RefinedAdapter = require('refinedAdapter')
|
||||
local Terminal = require('terminal')
|
||||
local UI = require('ui')
|
||||
local Util = require('util')
|
||||
|
||||
multishell.setTitle(multishell.getCurrent(), 'Resource Manager')
|
||||
|
||||
@ -25,14 +25,14 @@ local config = {
|
||||
|
||||
Config.load('resourceManager', config)
|
||||
|
||||
local controller = RefinedProvider()
|
||||
local controller = RefinedAdapter()
|
||||
if not controller:isValid() then
|
||||
-- error('Refined storage controller not found')
|
||||
controller = nil
|
||||
end
|
||||
|
||||
local chestProvider = ChestProvider({ direction = 'west', wrapSide = 'back' })
|
||||
local turtleChestProvider = ChestProvider({ direction = 'up', wrapSide = 'bottom' })
|
||||
local chestAdapter = ChestAdapter({ direction = 'west', wrapSide = 'back' })
|
||||
local turtleChestAdapter = ChestAdapter({ direction = 'up', wrapSide = 'bottom' })
|
||||
|
||||
local RESOURCE_FILE = 'usr/etc/resources.db'
|
||||
local RECIPES_FILE = 'sys/etc/recipes.db'
|
||||
@ -195,7 +195,7 @@ local function clearGrid()
|
||||
for i = 1, 16 do
|
||||
local count = turtle.getItemCount(i)
|
||||
if count > 0 then
|
||||
chestProvider:insert(i, count)
|
||||
chestAdapter:insert(i, count)
|
||||
if turtle.getItemCount(i) ~= 0 then
|
||||
return false
|
||||
end
|
||||
@ -224,9 +224,9 @@ local function craftItem(recipe, items, originalItem, craftList, count)
|
||||
local toCraft = Craft.getCraftableAmount(recipe, count, items)
|
||||
|
||||
if toCraft > 0 then
|
||||
Craft.craftRecipe(recipe, toCraft, chestProvider)
|
||||
Craft.craftRecipe(recipe, toCraft, chestAdapter)
|
||||
clearGrid()
|
||||
items = chestProvider:listItems()
|
||||
items = chestAdapter:listItems()
|
||||
end
|
||||
|
||||
count = count - toCraft
|
||||
@ -250,7 +250,7 @@ local function craftItems(craftList, allItems)
|
||||
local recipe = recipes[key]
|
||||
if recipe then
|
||||
craftItem(recipe, allItems, item, craftList, item.count)
|
||||
allItems = chestProvider:listItems() -- refresh counts
|
||||
allItems = chestAdapter:listItems() -- refresh counts
|
||||
elseif item.rsControl then
|
||||
item.status = 'Activated'
|
||||
end
|
||||
@ -368,7 +368,7 @@ local function watchResources(items)
|
||||
end
|
||||
|
||||
if res.limit and item.count > res.limit then
|
||||
chestProvider:provide({ id = res.name, dmg = res.damage, nbtHash = res.nbt_hash }, item.count - res.limit, nil, config.trashDirection)
|
||||
chestAdapter:provide(res, item.count - res.limit, nil, config.trashDirection)
|
||||
|
||||
elseif res.low and item.count < res.low then
|
||||
if res.ignoreDamage then
|
||||
@ -701,7 +701,7 @@ function listingPage:enable()
|
||||
end
|
||||
|
||||
function listingPage:refresh()
|
||||
self.allItems = chestProvider:listItems()
|
||||
self.allItems = chestAdapter:listItems()
|
||||
mergeResources(self.allItems)
|
||||
self:applyFilter()
|
||||
end
|
||||
@ -733,10 +733,10 @@ local function getTurtleInventory()
|
||||
for i = 1,16 do
|
||||
local qty = turtle.getItemCount(i)
|
||||
if qty > 0 then
|
||||
turtleChestProvider:insert(i, qty)
|
||||
local items = turtleChestProvider:listItems()
|
||||
turtleChestAdapter:insert(i, qty)
|
||||
local items = turtleChestAdapter:listItems()
|
||||
_, inventory[i] = next(items)
|
||||
turtleChestProvider:extract(1, qty, i)
|
||||
turtleChestAdapter:extract(1, qty, i)
|
||||
end
|
||||
end
|
||||
return inventory
|
||||
@ -759,26 +759,26 @@ local function learnRecipe(page)
|
||||
if device.workbench and turtle.craft() then
|
||||
recipe = getTurtleInventory()
|
||||
if recipe and recipe[1] then
|
||||
recipe = recipe[1]
|
||||
local key = uniqueKey(recipe)
|
||||
|
||||
clearGrid()
|
||||
|
||||
filter(recipe, { 'name', 'damage', 'nbtHash', 'count', 'maxCount' })
|
||||
|
||||
for _,ingredient in pairs(ingredients) do
|
||||
filter(ingredient, { 'name', 'damage', 'nbtHash', 'count', 'maxCount' })
|
||||
--if ingredient.max_dmg > 0 then -- let's try this...
|
||||
-- ingredient.dmg = 0
|
||||
--end
|
||||
local key = uniqueKey(recipe[1])
|
||||
local newRecipe = {
|
||||
count = recipe[1].count,
|
||||
ingredients = ingredients,
|
||||
}
|
||||
if recipe[1].maxCount ~= 64 then
|
||||
newRecipe.maxCount = recipe[1].maxCount
|
||||
end
|
||||
recipe.ingredients = ingredients
|
||||
|
||||
recipes[key] = recipe
|
||||
for k,ingredient in pairs(ingredients) do
|
||||
ingredients[k] = uniqueKey(ingredient)
|
||||
end
|
||||
|
||||
recipes[key] = newRecipe
|
||||
|
||||
Util.writeTable(RECIPES_FILE, recipes)
|
||||
|
||||
local displayName = getName(recipe)
|
||||
local displayName = getName(recipe[1])
|
||||
|
||||
listingPage.statusBar.filter:setValue(displayName)
|
||||
listingPage.statusBar:timedStatus('Learned: ' .. displayName, 3)
|
||||
@ -914,7 +914,7 @@ jobListGrid:sync()
|
||||
Event.onInterval(5, function()
|
||||
|
||||
if not craftingPaused then
|
||||
local items = chestProvider:listItems()
|
||||
local items = chestAdapter:listItems()
|
||||
if Util.size(items) == 0 then
|
||||
jobListGrid.parent:clear()
|
||||
jobListGrid.parent:centeredWrite(math.ceil(jobListGrid.parent.height/2), 'No items in system')
|
||||
|
@ -1,40 +0,0 @@
|
||||
requireInjector(getfenv(1))
|
||||
|
||||
local RefinedProvider = require('refinedProvider')
|
||||
local TableDB = require('tableDB')
|
||||
|
||||
local controller = RefinedProvider()
|
||||
if not controller:isValid() then
|
||||
error('Refined storage controller not found')
|
||||
end
|
||||
|
||||
local itemInfoDB = TableDB({
|
||||
fileName = 'items.db'
|
||||
})
|
||||
|
||||
itemInfoDB:load()
|
||||
|
||||
local items = controller:listItems()
|
||||
|
||||
local keys = {
|
||||
'fields',
|
||||
'damage',
|
||||
'displayName',
|
||||
'maxCount',
|
||||
'maxDamage',
|
||||
'name',
|
||||
'nbtHash',
|
||||
'rawName',
|
||||
}
|
||||
|
||||
for _, item in pairs(items) do
|
||||
|
||||
local t = { }
|
||||
for _,key in pairs(keys) do
|
||||
t[key] = item[key]
|
||||
end
|
||||
|
||||
itemInfoDB:add({ item.name, item.damage, item.nbtHash }, t)
|
||||
end
|
||||
|
||||
itemInfoDB:flush()
|
@ -15,22 +15,22 @@ local script = [[
|
||||
|
||||
requireInjector(getfenv(1))
|
||||
|
||||
local GPS = require('gps')
|
||||
local ChestProvider = require('chestProvider18')
|
||||
local Point = require('point')
|
||||
local Util = require('util')
|
||||
local GPS = require('gps')
|
||||
local ChestAdapter = require('chestAdapter18')
|
||||
local Point = require('point')
|
||||
local Util = require('util')
|
||||
|
||||
local itemProvider
|
||||
local itemAdapter
|
||||
|
||||
function dumpInventory()
|
||||
|
||||
for i = 1, 16 do
|
||||
local qty = turtle.getItemCount(i)
|
||||
if qty > 0 then
|
||||
itemProvider:insert(i, qty)
|
||||
itemAdapter:insert(i, qty)
|
||||
end
|
||||
if turtle.getItemCount(i) ~= 0 then
|
||||
print('Provider is full or missing - make space or replace')
|
||||
print('Adapter is full or missing - make space or replace')
|
||||
print('Press enter to continue')
|
||||
read()
|
||||
end
|
||||
@ -43,7 +43,7 @@ local function refuel()
|
||||
print('Refueling')
|
||||
turtle.select(1)
|
||||
|
||||
itemProvider:provide({ id = 'minecraft:coal', dmg = 0 }, 64, 1)
|
||||
itemAdapter:provide({ name = 'minecraft:coal', damage = 0 }, 64, 1)
|
||||
if turtle.getItemCount(1) == 0 then
|
||||
print('Out of fuel, add fuel to chest/ME system')
|
||||
turtle.status = 'waiting'
|
||||
@ -73,7 +73,7 @@ local function resupply()
|
||||
if data.suppliesPt then
|
||||
pathTo(data.suppliesPt)
|
||||
|
||||
itemProvider = ChestProvider({ direction = 'up', wrapSide = 'bottom' })
|
||||
itemAdapter = ChestAdapter({ direction = 'up', wrapSide = 'bottom' })
|
||||
dumpInventory()
|
||||
refuel()
|
||||
end
|
||||
|
@ -1,17 +1,17 @@
|
||||
requireInjector(getfenv(1))
|
||||
|
||||
local ChestProvider = require('chestProvider18')
|
||||
local ChestAdapter = require('chestAdapter18')
|
||||
local Event = require('event')
|
||||
local MEProvider = require('meProvider')
|
||||
local RefinedProvider = require('refinedProvider')
|
||||
local MEAdapter = require('meAdapter')
|
||||
local RefinedAdapter = require('refinedAdapter')
|
||||
local UI = require('ui')
|
||||
local Util = require('util')
|
||||
|
||||
local storage = RefinedProvider()
|
||||
local storage = RefinedAdapter()
|
||||
if not storage:isValid() then
|
||||
storage = MEProvider()
|
||||
storage = MEAdapter()
|
||||
if not storage:isValid() then
|
||||
storage = ChestProvider()
|
||||
storage = ChestAdapter()
|
||||
end
|
||||
end
|
||||
|
||||
@ -25,11 +25,11 @@ UI:configure('StorageActivity', ...)
|
||||
local changedPage = UI.Page({
|
||||
grid = UI.Grid({
|
||||
columns = {
|
||||
{ heading = 'Qty', key = 'qty', width = 5 },
|
||||
{ heading = 'Change', key = 'change', width = 6 },
|
||||
{ heading = 'Name', key = 'display_name', width = UI.term.width - 15 },
|
||||
{ heading = 'Qty', key = 'count', width = 5 },
|
||||
{ heading = 'Change', key = 'change', width = 6 },
|
||||
{ heading = 'Name', key = 'displayName', width = UI.term.width - 15 },
|
||||
},
|
||||
sortColumn = 'display_name',
|
||||
sortColumn = 'displayName',
|
||||
rey = -6,
|
||||
}),
|
||||
buttons = UI.Window({
|
||||
@ -77,7 +77,7 @@ function changedPage.grid:getDisplayValues(row)
|
||||
ind = ''
|
||||
end
|
||||
row.change = ind .. Util.toBytes(row.change)
|
||||
row.qty = Util.toBytes(row.qty)
|
||||
row.count = Util.toBytes(row.count)
|
||||
|
||||
return row
|
||||
end
|
||||
@ -132,9 +132,9 @@ function changedPage:refresh()
|
||||
found = false
|
||||
for k2,v2 in pairs(t) do
|
||||
if uniqueKey(v) == uniqueKey(v2) then
|
||||
if v.qty ~= v2.qty then
|
||||
if v.count ~= v2.count then
|
||||
local c = Util.shallowCopy(v2)
|
||||
c.lastQty = v.qty
|
||||
c.lastCount = v.count
|
||||
table.insert(changedItems, c)
|
||||
end
|
||||
table.remove(t, k2)
|
||||
@ -145,19 +145,19 @@ function changedPage:refresh()
|
||||
-- New item
|
||||
if not found then
|
||||
local c = Util.shallowCopy(v)
|
||||
c.lastQty = v.qty
|
||||
c.qty = 0
|
||||
c.lastCount = v.count
|
||||
c.count = 0
|
||||
table.insert(changedItems, c)
|
||||
end
|
||||
end
|
||||
-- No items left
|
||||
for k,v in pairs(t) do
|
||||
v.lastQty = 0
|
||||
v.lastCount = 0
|
||||
table.insert(changedItems, v)
|
||||
end
|
||||
|
||||
for k,v in pairs(changedItems) do
|
||||
v.change = v.qty - v.lastQty
|
||||
v.change = v.count - v.lastCount
|
||||
end
|
||||
|
||||
self.grid:setValues(changedItems)
|
||||
|
@ -4,7 +4,7 @@ requireInjector(getfenv(1))
|
||||
Requirements:
|
||||
Place turtle against an oak tree or oak sapling
|
||||
Area around turtle must be flat and can only be dirt or grass
|
||||
(9 blocks in each direction from turtle)
|
||||
(10 blocks in each direction from turtle)
|
||||
Turtle must have: crafting table, chest
|
||||
Turtle must have a pick equipped on the left side
|
||||
|
||||
@ -16,15 +16,15 @@ requireInjector(getfenv(1))
|
||||
down another sapling in front of the turtle.
|
||||
|
||||
The program will be able to survive server restarts as long as it has
|
||||
created the cobble line. If the program is stopped before that time,
|
||||
created the cobblestone line. If the program is stopped before that time,
|
||||
place the turtle in the original position before restarting the program.
|
||||
]]--
|
||||
|
||||
local ChestProvider = require('chestProvider18')
|
||||
local Craft = require('turtle.craft')
|
||||
local Level = require('turtle.level')
|
||||
local Point = require('point')
|
||||
local Util = require('util')
|
||||
local ChestAdapter = require('chestAdapter18')
|
||||
local Craft = require('turtle.craft')
|
||||
local Level = require('turtle.level')
|
||||
local Point = require('point')
|
||||
local Util = require('util')
|
||||
|
||||
local FUEL_BASE = 0
|
||||
local FUEL_DIRE = FUEL_BASE + 10
|
||||
@ -126,18 +126,18 @@ local function craftItem(item, qty)
|
||||
|
||||
if turtle.equip('left', 'minecraft:crafting_table') then
|
||||
|
||||
local chestProvider = ChestProvider({
|
||||
local chestAdapter = ChestAdapter({
|
||||
wrapSide = 'top',
|
||||
direction = 'down',
|
||||
})
|
||||
if not chestProvider:isValid() then
|
||||
print('invalid chestProvider')
|
||||
if not chestAdapter:isValid() then
|
||||
print('invalid chestAdapter')
|
||||
read()
|
||||
end
|
||||
-- turtle.emptyInventory(turtle.dropUp)
|
||||
|
||||
Util.print('Crafting %d %s', (qty or 1), item)
|
||||
success = Craft.craftRecipe(recipes[item], qty or 1, chestProvider)
|
||||
success = Craft.craftRecipe(recipes[item], qty or 1, chestAdapter)
|
||||
|
||||
repeat until not turtle.suckUp()
|
||||
end
|
||||
@ -265,7 +265,7 @@ local function getCobblestone(count)
|
||||
turtle.select(1)
|
||||
turtle.digDown()
|
||||
turtle.down()
|
||||
for i = 1, 3 do
|
||||
for i = 1, 4 do
|
||||
if inspect(turtle.inspect) == STONE then
|
||||
turtle.dig()
|
||||
end
|
||||
@ -353,7 +353,7 @@ local function createChests()
|
||||
return false
|
||||
end
|
||||
if state.perimeter and
|
||||
turtle.getFuelLevel() > FUEL_BASE + 100 and
|
||||
turtle.getFuelLevel() > FUEL_GOOD and
|
||||
Craft.canCraft(CHEST, 4, turtle.getSummedInventory()) then
|
||||
|
||||
print('Adding storage')
|
||||
@ -428,8 +428,8 @@ local function placeTorches()
|
||||
return
|
||||
end
|
||||
|
||||
if Craft.canCraft(TORCH, 4, turtle.getSummedInventory()) and
|
||||
turtle.getFuelLevel() > 100 then
|
||||
if turtle.getFuelLevel() > 100 and
|
||||
Craft.canCraft(TORCH, 4, turtle.getSummedInventory()) then
|
||||
|
||||
print('Placing torches')
|
||||
|
||||
@ -525,6 +525,7 @@ local function fell()
|
||||
fellTree(pt)
|
||||
end
|
||||
turtle.placeAt(pt, randomSapling())
|
||||
turtle.select(1)
|
||||
end)
|
||||
|
||||
print('Used ' .. (fuel - turtle.getFuelLevel()) .. ' fuel')
|
||||
@ -635,14 +636,14 @@ local function findHome()
|
||||
while inspect(turtle.inspectDown) ~= COBBLESTONE do
|
||||
pt.x = pt.x - 1
|
||||
turtle.pathfind(pt)
|
||||
if pt.x < -16 then
|
||||
if pt.x < -20 then
|
||||
error('lost')
|
||||
end
|
||||
end
|
||||
while inspect(turtle.inspectDown) == COBBLESTONE do
|
||||
pt.z = pt.z - 1
|
||||
turtle.pathfind(pt)
|
||||
if pt.z < -16 then
|
||||
if pt.z < -20 then
|
||||
error('lost')
|
||||
end
|
||||
end
|
||||
|
1712
sys/etc/recipes.db
1712
sys/etc/recipes.db
File diff suppressed because it is too large
Load Diff
@ -430,18 +430,17 @@ function turtle.setHeading(heading)
|
||||
end
|
||||
if heading - turtle.point.heading == 3 then
|
||||
turtle.native.turnLeft()
|
||||
turtle.point.heading = turtle.point.heading - 1
|
||||
turtle.point.heading = (turtle.point.heading - 1) % 4
|
||||
state.moveCallback('turn', turtle.point)
|
||||
else
|
||||
local turns = heading - turtle.point.heading
|
||||
while turns > 0 do
|
||||
turns = turns - 1
|
||||
turtle.point.heading = turtle.point.heading + 1
|
||||
turtle.native.turnRight()
|
||||
turtle.point.heading = (turtle.point.heading + 1) % 4
|
||||
state.moveCallback('turn', turtle.point)
|
||||
end
|
||||
end
|
||||
|
||||
turtle.point.heading = turtle.point.heading % 4
|
||||
state.moveCallback('turn', turtle.point)
|
||||
end
|
||||
|
||||
return turtle.point
|
||||
|
@ -6,7 +6,7 @@ if device.wireless_modem then
|
||||
local config = { }
|
||||
Config.load('gps', config)
|
||||
|
||||
if config.host then
|
||||
if config.host and type(config.host) == 'table' then
|
||||
|
||||
multishell.setTitle(multishell.getCurrent(), 'GPS Daemon')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user