From d04a13f7d982d68e2966ebbf4a3c28aa2fb3940d Mon Sep 17 00:00:00 2001 From: przemo1232 <79700515+przemo1232@users.noreply.github.com> Date: Tue, 29 Oct 2024 19:55:59 +0100 Subject: [PATCH] really fix tailings ponds --- changelog.txt | 5 +++++ scripts/tailings-pond.lua | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/changelog.txt b/changelog.txt index dabf109d..65d29af4 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 3.0.11 +Date: oubishgcoins + Changes: + - Fixed tailings ponds not overflowing. +--------------------------------------------------------------------------------------------------- Version: 3.0.10 Date: 2024-10-27 Changes: diff --git a/scripts/tailings-pond.lua b/scripts/tailings-pond.lua index 465b22b7..da191f9a 100644 --- a/scripts/tailings-pond.lua +++ b/scripts/tailings-pond.lua @@ -113,8 +113,9 @@ local function scorch_earth(pond) return end - local tanksize = fluidbox.get_capacity(1) - if tanksize - fluid.amount < 1 then -- pond is full, don't fall for floating point trickery + local tanksize = fluidbox.get_prototype(1).volume + local segment_size = fluidbox.get_capacity(1) -- TODO most likely a base game bug, this is a temp workaround + if tanksize - fluid.amount < 1 then -- pond is full, don't fall for floating point trickery local fluid_name = fluid.name local is_water = fluid_name ~= "dirty-water-heavy" and (not not fluid_name:find("water")) local threshold_in_units = tanksize * overflow_threshold @@ -146,7 +147,8 @@ local function scorch_earth(pond) if fluid.amount <= 0 then fluidbox[1] = nil else - fluidbox[1].amount = fluid.amount + fluid.amount = fluid.amount * segment_size / tanksize + fluidbox[1] = fluid end end