Skip to content

Commit

Permalink
really fix tailings ponds
Browse files Browse the repository at this point in the history
  • Loading branch information
przemo1232 committed Oct 29, 2024
1 parent c5be4ef commit d04a13f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
8 changes: 5 additions & 3 deletions scripts/tailings-pond.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit d04a13f

Please sign in to comment.