Fluid Permutations

by spiwn

Rotate fluid inputs and outputs of buildings

Utilities
3 years ago
0.16 - 1.1
15.7K

g Skips one permutation for recipes which only permute output

8 months ago

For recipes where the inputs or outputs have 1 or 0 fluids, but 3+ fluids for the other side Fluid Permutations correctly generates all of the permutations, but then skips one in the control.lua side. There's a special case to fix up the computation for 2 fluids, and changing that to run for 2+ fluids instead seems to work fine; I've sent a PR.

8 months ago
(updated 8 months ago)

Patch is

diff --git a/src/control.lua b/src/control.lua
index 5d51dc3..653efe5 100644
--- a/src/control.lua
+++ b/src/control.lua
@@ -307,10 +307,10 @@ local function buildRegistry()
     for name, group in pairs(groups) do
         local limits = group.limits
         group.limits = nil
-        if limits.maxI == 0 and limits.maxR == 1 then
-            limits.maxR = 2
-        elseif limits.maxI == 1 and limits.maxR == 0 then
-            limits.maxI = 2
+        if limits.maxI == 0 and limits.maxR > 0 then
+            limits.maxR = limits.maxR + 1
+        elseif limits.maxI > 0 and limits.maxR == 0 then
+            limits.maxI = limits.maxI + 1
         end
a month ago

Could you tell me an example of recipe where it skips?

New response