feat: use getName to find names of items
This commit is contained in:
parent
94dfe3c2b8
commit
4c7eaf14e9
1 changed files with 8 additions and 8 deletions
|
|
@ -82,7 +82,13 @@ local getName = {
|
||||||
function craft (requester, item_type, conversion_type)
|
function craft (requester, item_type, conversion_type)
|
||||||
-- conversion_type key: 1, nuggets to ingots; 2, ingots to blocks;
|
-- conversion_type key: 1, nuggets to ingots; 2, ingots to blocks;
|
||||||
-- 3, blocks to ingots; 4, ingots to nuggets
|
-- 3, blocks to ingots; 4, ingots to nuggets
|
||||||
-- TODO find name
|
local convert = {
|
||||||
|
getName.nugget,
|
||||||
|
getName.ingot,
|
||||||
|
getName.block,
|
||||||
|
getName.ingot,
|
||||||
|
}
|
||||||
|
local name = convert[conversion_type](item_type)
|
||||||
local compacting = conversion_type <= 2
|
local compacting = conversion_type <= 2
|
||||||
local count, address
|
local count, address
|
||||||
if compacting then
|
if compacting then
|
||||||
|
|
@ -125,13 +131,7 @@ function execute_crafts (requester, item_type, crafts)
|
||||||
end
|
end
|
||||||
|
|
||||||
function request_more (ticker, item_type)
|
function request_more (ticker, item_type)
|
||||||
local request = {
|
ticker.requestFiltered(STORAGE_ADDR, { name = getName.nugget(item_type) })
|
||||||
name = {
|
|
||||||
_op = "regex",
|
|
||||||
value = ".*:" .. item_type .. "_nugget"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ticker.requestFiltered(STORAGE_ADDR, request)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- logic
|
-- logic
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue