From 73fd5ac8287a729a225fdcb6ecc642c5ae61c243 Mon Sep 17 00:00:00 2001 From: Johannes Lundberg Date: Thu, 15 Oct 2020 21:10:34 -0700 Subject: [PATCH] Ceil values instead of floor when converting from percent to get better accuracy for low percentages --- mesecons_scanner/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesecons_scanner/init.lua b/mesecons_scanner/init.lua index cbdd4eb..d0a6e43 100644 --- a/mesecons_scanner/init.lua +++ b/mesecons_scanner/init.lua @@ -104,8 +104,8 @@ local function update_watermarks(pos, meta) local low_pct = meta:get_int("low_pct") local high_pct = meta:get_int("high_pct") - local low = math.floor(i_size * (low_pct / 100.0)) - local high = math.floor(i_size * (high_pct / 100.0)) + local low = math.ceil(i_size * (low_pct / 100.0)) + local high = math.ceil(i_size * (high_pct / 100.0)) -- We want watermark % > 0 to enable output if a single slot has items -- regardless of inventory size so add 1 here if needed.