Keniras Random Recipes

by Kenira

Randomizes recipes (amount of ingredients and products, crafting time) as well as many other things that can be toggled individually like belt speed, crafting speeds, energy consumption, weapon damage...

4 days ago
0.15 - 2.0
1.34K

b Failed to load mod - compare nil with number

2 years ago

Happened just after adding the mod.

15.783 Error ModManager.cpp:1578: Failed to load mod "zKenirasRandomRecipes": zKenirasRandomRecipes/functions.lua:253: attempt to compare nil with number
stack traceback:
zKenirasRandomRecipes/functions.lua:253: in function 'randomize_products'
zKenirasRandomRecipes/data-final-fixes.lua:148: in main chunk

2 years ago

Do you use any other mods? Are you using the latest factorio version?
Works fine here.

2 years ago

Thanks for the response! I am on latest Factorio stable (1.1.57). I do have a lot of mods, principally K2+SE and a bunch of QoL mods with a few small content mods (add combinators, that sort of thing). I'm happy to send a save file with mod configs if that helps you. Or I can help you debug if you can help me with what is interesting to look for. LMK!

2 years ago

Ok, I did a bit of debugging. There are three issues:

  • Space Exploration sets a nil probability on some recipes. This is allowed, per the Factorio API probability can be nil. I worked around it by setting it to 1 if I found a null value.
    64.756 Script @zKenirasRandomRecipes/functions.lua:254: se-experimental-specimen : se-contaminated-bio-sludge - null probability
    64.756 Script @zKenirasRandomRecipes/functions.lua:254: se-experimental-specimen : se-contaminated-space-water - null probability

  • Space Exploration sets a nil output_flow_limit on their spaceship consoles. This is technically not allowed per the API spec but given the popularity of the mod, it doesn't seem otherwise harmful..
    74.124 Script @zKenirasRandomRecipes/data-final-fixes.lua:583: se-spaceship-console has nil output_flow_limit
    74.124 Script @zKenirasRandomRecipes/data-final-fixes.lua:583: se-spaceship-console-alt has nil output_flow_limit

I worked around this by detecting and setting the output_flow_limit to a very high value (1000GW)

  • One recipe output has it's probability set to NaN after processing
    44.691 Error ModManager.cpp:1578: Error while loading recipe prototype "rsc-construction-stage6-sesprs" (recipe): Difficulty normal: Value can't be NaN. in property tree at ROOT.recipe.rsc-construction-stage6-sesprs.results[0].probability
    Modifications: Rocket-Silo Construction › Keniras Random Recipes > ...

I didn't work around the last one yet.

2 years ago

A save file would be the most useful for debugging; i'd appreciate sending one over.

2 years ago
2 years ago

Finally had time to look at it; sorry it took a while. Fixed all the issues to the point where it loads here and new version is up.
Let me know if you experience any other issues.

2 years ago

Awesome, thank you! I'll check it out when I get some time.

New response