Fluid Permutations Fixed

by 123499

Rotate fluid inputs and outputs of buildings

Utilities
28 days ago
1.1 - 2.0
4.47K
Fluids

g 2.0 is out!

29 days ago

hope this will eventually be updated..

29 days ago

is it not native to 2.0? Sorry. I haven't played for a while now.

29 days ago
(updated 29 days ago)

May just need the version info updated in the json file. Though, there is a change to the Global table in the new api (now called Storage). So that's worth mentioning.

https://lua-api.factorio.com/latest/auxiliary/storage.html

----- Edit -----

Since I'm in desperate need of a mod to flip recipes, i tried making a local copy with the updated json and changing global to storage but this lead me to finding another change in the api. In your control.lua on line 263, you make a call to the game script to get the recipe difficulty:

local difficulty = game.difficulty_settings.recipe_difficulty

This attribute of the difficulty_settings does not exist in 2.0

https://lua-api.factorio.com/2.0.10/concepts/DifficultySettings.html

I tried quickly checking if there was a replacement or if the function could be quickly modified, but nothing i could see immediately without potentially bigger changes.

Here is the full stacktrace:

Error while running event fluid_permutations_fixed::on_init()
LuaDifficultySettings: unknown path recipe_difficulty
stack traceback:
[C]: in function 'index'
__fluid_permutations_fixed
/control.lua:263: in function 'buildRegistry'
fluid_permutations_fixed/control.lua:445: in function <fluid_permutations_fixed/control.lua:444>

----- Edit 2 -----

After some annoyance of finding all the little changes, i believe i have a working version. I'm testing in my playthrough but so far recipe switching is working. Not very far in my run so no idea about any Space Age compatibility yet.

Here is a brief overview of the changes (i can make a PR on GitHub if desired):
1 - Updated the json file to Factorio 2.0
2 - Updated the calls to "global." in control.lua to "storage."
3 - In control.lua line 150, updated technology.effects to technology.prototype.effects
4 - In control.lua line 263, updated game.difficulty_settings.recipe_difficulty to 0 (bandaid fix, couldn't find the new attribute to get recipe difficulty)
5 - In control.lua line 272, updated game.recipe_prototypes to prototypes.recipe

----- Edit 3 -----

Found another after finishing research:
1 - control.lua line 143, update local effects = event.research.effects to local effects = event.research.prototype.effects

This seemed to fix the crash after research completed.

28 days ago
(updated 28 days ago)

Thank you Mattias! I didn't have the time to read through the new documentation yet, and since there is a way to rotate the fluids, it will double the number of new recipes for now. When I have time, I'll looking into make it better, but probably not as soon as you would like.

For a quick test, it seems to be working now. So, if something happens, just tell me that I'll investigate.

28 days ago

oh wow, thnx guys.. I'll try to report back if something's up on my end..

New response