fix: remove syntax errors
This commit is contained in:
parent
367744fdd6
commit
76787d4283
1 changed files with 11 additions and 11 deletions
|
|
@ -56,19 +56,19 @@ local getName = {
|
||||||
nugget = function (item_type)
|
nugget = function (item_type)
|
||||||
return ("%s:%s_nugget"):format(
|
return ("%s:%s_nugget"):format(
|
||||||
ITEM_TYPES[item_type].nugget,
|
ITEM_TYPES[item_type].nugget,
|
||||||
item_type,
|
item_type
|
||||||
)
|
)
|
||||||
end,
|
end,
|
||||||
ingot = function (item_type)
|
ingot = function (item_type)
|
||||||
return ("%s:%s_ingot"):format(
|
return ("%s:%s_ingot"):format(
|
||||||
ITEM_TYPES[item_type].ingot,
|
ITEM_TYPES[item_type].ingot,
|
||||||
item_type,
|
item_type
|
||||||
)
|
)
|
||||||
end,
|
end,
|
||||||
block = function (item_type)
|
block = function (item_type)
|
||||||
return ("%s:%s_block"):format(
|
return ("%s:%s_block"):format(
|
||||||
ITEM_TYPES[item_type].block,
|
ITEM_TYPES[item_type].block,
|
||||||
item_type,
|
item_type
|
||||||
)
|
)
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
@ -90,10 +90,12 @@ function craft (requester, item_type, conversion_type)
|
||||||
count = NUGGET_RATIO
|
count = NUGGET_RATIO
|
||||||
address = COMPACTING_ADDR
|
address = COMPACTING_ADDR
|
||||||
else
|
else
|
||||||
count = BLOCK_RATIO end
|
count = BLOCK_RATIO
|
||||||
address = UNPACKING_ADDR
|
address = UNPACKING_ADDR
|
||||||
end
|
end
|
||||||
requester.setRequest({ name, count })
|
requester.setAddress(address)
|
||||||
|
requester.setRequest({ name = name, count = count })
|
||||||
|
requester.request()
|
||||||
end
|
end
|
||||||
|
|
||||||
function craft_multiple (requester, item_type, conversion_type, count)
|
function craft_multiple (requester, item_type, conversion_type, count)
|
||||||
|
|
@ -110,10 +112,10 @@ function execute_crafts (requester, item_type, crafts)
|
||||||
local num_crafts = crafts.nugget
|
local num_crafts = crafts.nugget
|
||||||
if num_crafts > 0 then
|
if num_crafts > 0 then
|
||||||
print(("Crafting %s nuggets"):format(item_type))
|
print(("Crafting %s nuggets"):format(item_type))
|
||||||
craft_multiple(item_type, 4, num_crafts)
|
craft_multiple(requester, item_type, 4, num_crafts)
|
||||||
elseif num_crafts < 0 then
|
elseif num_crafts < 0 then
|
||||||
print(("Crafting %s ingots"):format(item_type))
|
print(("Crafting %s ingots"):format(item_type))
|
||||||
craft_multiple(item_type, 1, -num_crafts)
|
craft_multiple(requester, item_type, 1, -num_crafts)
|
||||||
end
|
end
|
||||||
num_crafts = crafts.block
|
num_crafts = crafts.block
|
||||||
if num_crafts > 0 then
|
if num_crafts > 0 then
|
||||||
|
|
@ -121,7 +123,7 @@ function execute_crafts (requester, item_type, crafts)
|
||||||
craft_multiple(requester, item_type, 2, num_crafts)
|
craft_multiple(requester, item_type, 2, num_crafts)
|
||||||
elseif num_crafts < 0 then
|
elseif num_crafts < 0 then
|
||||||
print(("Crafting %s ingots"):format(item_type))
|
print(("Crafting %s ingots"):format(item_type))
|
||||||
craft_multiple(item_type, 3, -num_crafts)
|
craft_multiple(requester, item_type, 3, -num_crafts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -141,15 +143,13 @@ function sum_items (inv_f)
|
||||||
end
|
end
|
||||||
|
|
||||||
function dist_to_num (dist)
|
function dist_to_num (dist)
|
||||||
return dist.nugget + dist.ingot * INGOTS + dist.block * BLOCKS
|
return dist.nugget + (dist.ingot * INGOTS) + (dist.block * BLOCKS)
|
||||||
end
|
end
|
||||||
|
|
||||||
function get_dist (item_type, items)
|
function get_dist (item_type, items)
|
||||||
-- TODO change plurals to singulars to match mc
|
|
||||||
local dist = { nugget = 0, ingot = 0, block = 0 }
|
local dist = { nugget = 0, ingot = 0, block = 0 }
|
||||||
for item, count in pairs(items) do
|
for item, count in pairs(items) do
|
||||||
local type, form = item:match":(%l-)_(%l*)"
|
local type, form = item:match":(%l-)_(%l*)"
|
||||||
form = string.format("%ss", form)
|
|
||||||
if type == item_type and dist[form] ~= nil then
|
if type == item_type and dist[form] ~= nil then
|
||||||
dist[form] = dist[form] + count
|
dist[form] = dist[form] + count
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue