fix: remove syntax errors

This commit is contained in:
Emerson Rosen-Jones 2026-01-17 17:05:01 -05:00
parent 367744fdd6
commit 76787d4283

View file

@ -56,19 +56,19 @@ local getName = {
nugget = function (item_type)
return ("%s:%s_nugget"):format(
ITEM_TYPES[item_type].nugget,
item_type,
item_type
)
end,
ingot = function (item_type)
return ("%s:%s_ingot"):format(
ITEM_TYPES[item_type].ingot,
item_type,
item_type
)
end,
block = function (item_type)
return ("%s:%s_block"):format(
ITEM_TYPES[item_type].block,
item_type,
item_type
)
end,
}
@ -90,10 +90,12 @@ function craft (requester, item_type, conversion_type)
count = NUGGET_RATIO
address = COMPACTING_ADDR
else
count = BLOCK_RATIO end
count = BLOCK_RATIO
address = UNPACKING_ADDR
end
requester.setRequest({ name, count })
requester.setAddress(address)
requester.setRequest({ name = name, count = count })
requester.request()
end
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
if num_crafts > 0 then
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
print(("Crafting %s ingots"):format(item_type))
craft_multiple(item_type, 1, -num_crafts)
craft_multiple(requester, item_type, 1, -num_crafts)
end
num_crafts = crafts.block
if num_crafts > 0 then
@ -121,7 +123,7 @@ function execute_crafts (requester, item_type, crafts)
craft_multiple(requester, item_type, 2, num_crafts)
elseif num_crafts < 0 then
print(("Crafting %s ingots"):format(item_type))
craft_multiple(item_type, 3, -num_crafts)
craft_multiple(requester, item_type, 3, -num_crafts)
end
end
@ -141,15 +143,13 @@ function sum_items (inv_f)
end
function dist_to_num (dist)
return dist.nugget + dist.ingot * INGOTS + dist.block * BLOCKS
return dist.nugget + (dist.ingot * INGOTS) + (dist.block * BLOCKS)
end
function get_dist (item_type, items)
-- TODO change plurals to singulars to match mc
local dist = { nugget = 0, ingot = 0, block = 0 }
for item, count in pairs(items) do
local type, form = item:match":(%l-)_(%l*)"
form = string.format("%ss", form)
if type == item_type and dist[form] ~= nil then
dist[form] = dist[form] + count
end