compacting-storage.lua: more bugfixes and logic work
This commit is contained in:
parent
8981badcf9
commit
add0ad1400
1 changed files with 7 additions and 7 deletions
|
|
@ -108,7 +108,7 @@ function set_production (item_type, produce)
|
|||
)
|
||||
local periph = string.format("redstone_relay_%d", relay_num)
|
||||
-- ON is disable production
|
||||
if produce then print(("Producing %s"):format(item_type))
|
||||
if produce then print(("Producing %s"):format(item_type)) end
|
||||
peripheral.call(periph, "setOutput", face, not produce)
|
||||
end
|
||||
|
||||
|
|
@ -163,20 +163,20 @@ 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 }
|
||||
if diff.blocks > 0 then
|
||||
new_diff.blocks = math.min(
|
||||
diff.blocks,
|
||||
diff.blocks = math.min(
|
||||
diff.blocks - (diff.blocks % BLOCK_RATIO),
|
||||
math.floor(current_dist.ingots / 9)
|
||||
)
|
||||
end
|
||||
if diff.nuggets > 0 then
|
||||
new_diff.nuggets = math.min(
|
||||
diff.nuggets,
|
||||
diff.nuggets = math.min(
|
||||
diff.nuggets - (diff.nuggets % NUGGET_RATIO),
|
||||
current_dist.ingots * 9
|
||||
)
|
||||
end
|
||||
new_diff.ingots = (new_diff.nuggets / 9) + (new_diff.blocks * 9)
|
||||
diff.ingots = (-diff.nuggets / 9) + (-diff.blocks * 9)
|
||||
return diff
|
||||
end
|
||||
|
||||
function diff_to_crafts (diff)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue