Progressive tech multiplier

by Mernom

An alternative to the tech cost multiplier: instead of a flat increase to all technology costs, it progressivly applies a higher and higher multiplier the deeper in the tech tree the tech is.

Tweaks
1 year, 6 months ago
1.1
549

b nil: Load Error.

1 year, 2 months ago
(updated 1 year, 2 months ago)

Heya, there's a bug. I recently updated the mods. - I'll try to find the culprit, perhaps narrow it down a bit... I, uhh... got ~300 mods in the list. :)
An excerpt from the 2000+ line log follows, for at least some limited post-mortem joy... seems to choke on a specialty ingredient, recipe, whatever.

  14.203 Loading mod LTN_Content_Reader 1.0.3 (data-final-fixes.lua)
  14.209 Script @__LTN_Content_Reader__/data-final-fixes.lua:22: [LTN Content Reader] setting combinator slots to 5267
  14.253 Loading mod miniloaders-se-techfix 1.0.1 (data-final-fixes.lua)
  14.299 Loading mod PickerPipeTools 1.1.4 (data-final-fixes.lua)
  14.345 Loading mod progressive-tech-multiplier 0.0.8 (data-final-fixes.lua)
  14.447 Error ModManager.cpp:1560: Failed to load mod "progressive-tech-multiplier": __progressive-tech-multiplier__/tech-tree.lua:99: attempt to index local 'proto' (a nil value)
stack traceback:
    __progressive-tech-multiplier__/tech-tree.lua:99: in function 'get_tech_levels'
    __progressive-tech-multiplier__/tech-tree.lua:127: in function 'evaluate_tech_recursive'
    __progressive-tech-multiplier__/tech-tree.lua:148: in main chunk
    [C]: in function 'require'
    __progressive-tech-multiplier__/data-final-fixes.lua:1: in main chunk
  14.450 Loading mod core 0.0.0 (data.lua)
  14.742 Checksum for core: 3744854889
  14.773 Error ModManager.cpp:1560: Error in assignID: recipe-category with name 'crafting' does not exist.

The first issue is that you'd need to add a check for nil wherever you work with tables, etc. when the data is foreign. Validate stuff.
Also, it would really help if you report exactly what you were trying to do, that would help a lot.
I.e. Raise a problem-flag (fill out a table) when you encounter unexpected data, then check flag and post a full report in the log.

Anyways, I'll be looking into this bug today, if I get some time.

Edit1/update:
Another mod that does post-processing (after this mod is removed) also chokes on the bad data:

  16.372 Script @__deadlock-beltboxes-loaders__/prototypes/shared.lua:17: DBL: Warning: creating layered stack icon (se-significant-specimen), this is 4x more rendering effort than a custom icon!
  16.372 Script @__deadlock_stacked_recipes__/data-final-fixes.lua:10: DSR___START,DensityOverride
  16.379 Script @__deadlock_stacked_recipes__/data-final-fixes.lua:12: DSR___END,DensityOverride
  16.379 Script @__deadlock_stacked_recipes__/data-final-fixes.lua:14: DSR___START,MakeStackedRecipes
  17.481 Error ModManager.cpp:1560: Failed to load mod "deadlock_stacked_recipes": __deadlock_stacked_recipes__/utils/deadlock.lua:795: attempt to index field '?' (a nil value)
stack traceback:
    __deadlock_stacked_recipes__/utils/deadlock.lua:795: in function 'MakeStackedRecipe'
    __deadlock_stacked_recipes__/utils/deadlock.lua:1030: in function 'MakeStackedRecipes'
    __deadlock_stacked_recipes__/data-final-fixes.lua:15: in main chunk
  17.484 Loading mod core 0.0.0 (data.lua)
  17.776 Checksum for core: 3744854889
  17.806 Error ModManager.cpp:1560: Error in assignID: recipe-category with name 'crafting' does not exist.

So that helps a bit. The log is now ~21000 lines long. :)

Edit2/update:
The game successfully loads after removing RealisticFusionPower and deadlock_stacked_recipes.
Your particular bug seems to be caused by the mod T-Zane-CarTurret v. 1.2.2 (Version 1.2.1 is working fine, however. :)

Quick "solution":
- Add mod incompatibility: "! T-Zane-CarTurret == 1.2.2" to your info.json dependencies list to signal for bad data with that mod.

The proper solution is to fix whatever is going wrong with the data processing happening in your mod.
Modders can make mistakes, so they end up causing other modders mods' to choke on bad data, so this may happen again in the future.

14.148 Error ModManager.cpp:1560: Failed to load mod "progressive-tech-multiplier": __progressive-tech-multiplier__/tech-tree.lua:99: attempt to index local 'proto' (a nil value)
stack traceback:
    __progressive-tech-multiplier__/tech-tree.lua:99: in function 'get_tech_levels'
    __progressive-tech-multiplier__/tech-tree.lua:127: in function 'evaluate_tech_recursive'
    __progressive-tech-multiplier__/tech-tree.lua:148: in main chunk
    [C]: in function 'require'
    __progressive-tech-multiplier__/data-final-fixes.lua:1: in main chunk

I think this issue has been satisfactorily resolved on my end for now, but I've got another issue to look into today :)
I spent zero time analyzing your script, so I won't be of much further help there at this time, I'm afraid.

Edit3/update:
I've analyzed the other mod which failed to access a table. That was caused by a different mod, though. But a similar issue I think.
The gist of it was that the other postprocess mod tried to access a table without iterating it, instead trying to access an element that was nil.
Some mods will put out unexpected data further up the load order. Assumptions usually hit postprocess mods fatally...
Factorio will happily cast a string to a number, or happily iterate to a non-nil element to grab the expected data. Postproc modders beware. :)

Best Regards,

1 year, 2 months ago

I'll research this when I have the time.

New response