Progressive Productivity


As you craft things, you get better at crafting them

Tweaks
a month ago
2.0
2.69K
Manufacturing

b crash because item names has been changed but are still in the statistics cache

2 months ago
(updated 2 months ago)

The mod Progressive Productivity (1.1.2) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event progressive-productivity::on_nth_tick(300)
Unknown item name: rock-big-aubergine-rh-cut
stack traceback:
[C]: in function 'get_input_count'
progressive-productivity/utility/production_cache.lua:50: in function 'refresh_production_statistics_cache'
progressive-productivity/utility/production_cache.lua:76: in function <progressive-productivity/utility/production_cache.lua:74>

Alien biomes has changed rock names. My currently not yet on the portal available mod RockHarvester derives items from those rocks, so the old names still exist in the statistics cache and when trying to get current statistics it crashes.
Best to check if the item still exists when iterating over the cache. this may also fix another reported bug, where the removal of a mod leads to crashes as well.

The same crash would happen if i remove Alien Biomes from my current game or any other mod introducing items to be crafted.

a month ago

Hmm, I'll take a look into fixing this. If you could send me a beta or give me a quick and dirty way to reproduce, that'd be very helpful!

a month ago

this is my current code in "progressive-productivity_1.1.2/utility/production_cache.lua", i added two if clauses to just ignore items not longer existing, and removed them from the progressive_productivity table.

        for item_name, item in pairs(storage.progressive_productivity.items) do
          if prototypes[item.type] then
            if prototypes[item.type][item_name] then
              if item.type == "item" then
                item_statistics[item_name] = (item_statistics[item_name] or 0) + force_surface_item_statistics.get_input_count(item_name)
              end
              if item.type == "fluid" then
                item_statistics[item_name] = (item_statistics[item_name] or 0) + force_surface_fluid_statistics.get_input_count(item_name)
              end
            else
              storage.progressive_productivity.items[item_name]=nil
              log("item " .. item_name .. " has vanished")
            end
          else
            log("no prototypes[" .. item.type .. "] found")
          end
        end
a month ago

to provoke the crash you just need to disable a mod introducing items/fluids and you have produced some to bring them into the progressive_productivity table since it relies on the item/fluid statistic.

New response