Oil Outpost Planner


Automatically blueprint pumpjacks, pipes, and power poles for an oil outpost. Also supports adding heat pipes on Aquilo and beacons. Install Module Inserter Extended for modules support. Inspired by, and using some code from, Mining patch planner, by Rimbas

Utilities
21 days ago
2.0
8.23K
Mining Fluids Blueprints

b [FIXED] Too many parameters for localised string

21 days ago

When trying to open Oil Outpost Planner (button or CRTL-O), Factorio (2.0.39) crashes with this:


The mod Oil Outpost Planner (1.6.5) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event OilOutpostPlanner::on_player_cursor_stack_changed (ID 35)
Too many parameters for localised string: 23 > 20 (limit). in property tree at ROOT.caption[1]
stack traceback:
[C]: in function 'add'
OilOutpostPlanner/gui.lua:18: in function 'create_setting_section'
OilOutpostPlanner/gui.lua:246: in function 'create_interface'
OilOutpostPlanner/gui.lua:483: in function 'show_interface'
OilOutpostPlanner/control.lua:97: in function <OilOutpostPlanner/control.lua:85>


I dug a bit in your code, but I guess the root cause is because I've got a lot of additional mods added (tons of planets with all their shenanigans), and found that "entities_by_resource_type" in gui.lua, after it's been populated (after line 232), contains this:


{
["basic-fluid"] = {
"[LuaEntityPrototype: crude-oil (resource)]",
"[LuaEntityPrototype: crude-slush (resource)]",
"[LuaEntityPrototype: heavy-water-vent (resource)]",
"[LuaEntityPrototype: helium (resource)]",
"[LuaEntityPrototype: lithium-brine (resource)]",
"[LuaEntityPrototype: natrocarbonatite (resource)]",
"[LuaEntityPrototype: steam-geyser (resource)]",
"[LuaEntityPrototype: sulfuric-acid-geyser (resource)]",
"[LuaEntityPrototype: thermal-lake (resource)]",
"[LuaEntityPrototype: dark-matter-vent (resource)]",
"[LuaEntityPrototype: fluorine-vent (resource)]",
"[LuaEntityPrototype: hydrogen-sulfide-vent (resource)]"
},
["gas-giant"] = {
"[LuaEntityPrototype: ammonia-wind (resource)]",
"[LuaEntityPrototype: fluorine-wind (resource)]",
"[LuaEntityPrototype: gas-wind (resource)]",
"[LuaEntityPrototype: holmium-wind (resource)]",
"[LuaEntityPrototype: lithium-wind (resource)]"
},
["raw-data"] = {
"[LuaEntityPrototype: fulgoran-data-source (resource)]"
}
}


So yes, basic-fluid contains 12 entries, which sum to about those 23 reported in the crash log, since you add an additional ", " element for each item when you populate "list" starting at about line 234 in gui.lua. Apparently, the scroll_pane-add cannot handle more than 20 entries for its caption, which seems to be in accordance to the API specs: https://lua-api.factorio.com/latest/concepts/LocalisedString.html:

"Localised strings can not be recursed deeper than 20 levels and can not have more than 20 parameters."

As expected, if I hack this in your gui.lua when populating list, Factorio doesn't crash and displays the Oil Outpost Planner GUI correctly:


if #list == 20
then
break
end


Don't really know what you would do here (besides telling people to not install too many mods ;-)... maybe you would have to localize the strings before passing them as array to set the caption of the label, or shorten the caption with "... and others"... or design the GUI some other way...

Thank you!

21 days ago

Thanks. I'll probably just make it "and others" when it gets beyond a certain point. Probably even 5-10 entries is enough.

21 days ago

Should be fixed in 1.6.6

New response