stockflow: Simplify calculation

See #1046

Use math.floor() for now until we can get Lua 5.3 working on Travis
develop
Lethosor 2016-12-16 14:22:00 -05:00 committed by GitHub
parent 05f5b6bcf2
commit ba48afe908
1 changed files with 1 additions and 2 deletions

@ -1135,8 +1135,7 @@ function check_stockpiles(verbose)
if trigger and trigger.divisor then if trigger and trigger.divisor then
local reaction = spec.entry.ints[entry_ints.order_number] local reaction = spec.entry.ints[entry_ints.order_number]
local filled, empty = check_pile(spec.stockpile, verbose) local filled, empty = check_pile(spec.stockpile, verbose)
local amount = trigger.filled and filled or empty local amount = math.floor((trigger.filled and filled or empty) / trigger.divisor)
amount = (amount - (amount % trigger.divisor)) // trigger.divisor
result[reaction] = (result[reaction] or 0) + amount result[reaction] = (result[reaction] or 0) + amount
end end
end end