compacting-storage.lua: I forgot how table constructors work
This commit is contained in:
parent
d3f03632e2
commit
cce18737d2
1 changed files with 5 additions and 5 deletions
|
|
@ -122,7 +122,7 @@ function dist_to_num (dist)
|
|||
end
|
||||
|
||||
function get_dist (item_type, items)
|
||||
local dist = { nuggets: 0, ingots: 0, blocks: 0 }
|
||||
local dist = { nuggets = 0, ingots = 0, blocks = 0 }
|
||||
for _, item in pairs(items) do
|
||||
local type, form = item.name:match".-:(%l-)_(%l*)"
|
||||
if type == item_type and dist[form] ~= nil then
|
||||
|
|
@ -134,15 +134,15 @@ end
|
|||
|
||||
function get_diff (dist1, dist2)
|
||||
return {
|
||||
nuggets: dist1.nuggets - dist2.nuggets,
|
||||
ingots: dist1.ingots - dist2.ingots,
|
||||
blocks: dist1.blocks - dist2.blocks
|
||||
nuggets = dist1.nuggets - dist2.nuggets,
|
||||
ingots = dist1.ingots - dist2.ingots,
|
||||
blocks = dist1.blocks - dist2.blocks
|
||||
}
|
||||
end
|
||||
|
||||
function filter_clamp (diff, current_dist)
|
||||
-- reduce diff numbers to what can be crafted using current resources
|
||||
local new_diff = { nuggets: 0, ingots: 0, blocks: 0 }
|
||||
local new_diff = { nuggets = 0, ingots = 0, blocks = 0 }
|
||||
if diff.blocks > 0 then
|
||||
new_diff.blocks = math.min(
|
||||
diff.blocks,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue