[boskid][2.0.28] Technologies with a finite max_level sometimes not displaying correctly

This subforum contains all the issues which we already resolved.
User avatar
IsaacOscar
Filter Inserter
Filter Inserter
Posts: 843
Joined: Sat Nov 09, 2024 2:36 pm
Contact:

[boskid][2.0.28] Technologies with a finite max_level sometimes not displaying correctly

Post by IsaacOscar »

Consider the Steel Plate Productivity technology, and suppose we haven't research it yet.
  • In Vanilla, we have:

    Code: Select all

    data.raw["technology"]["steel-plate-productivity"].max_level == "infinite"
    
    Which gives you:
    Screenshot 2024-12-30 224428.png
    Screenshot 2024-12-30 224428.png (161.8 KiB) Viewed 432 times
  • Now I want to change it to only have 2 levels (instead of infinite):

    Code: Select all

    data.raw["technology"]["steel-plate-productivity"].max_level = 2
    
    It does not however display correctly:
    Screenshot 2024-12-30 224310.png
    Screenshot 2024-12-30 224310.png (147.36 KiB) Viewed 432 times
  • In contrast, if I rename the technology to end with a -<number>, it works as expected:
    data.raw["technology"]["steel-plate-productivity"].name = "steel-plate-productivity-1"
    data.raw["technology"]["steel-plate-productivity"].max_level = 2
    data:extend{data.raw["technology"]["steel-plate-productivity"]}
    data.raw["technology"]["steel-plate-productivity"] = nil
    Which displays correctly:
    Screenshot 2024-12-30 224624.png
    Screenshot 2024-12-30 224624.png (147.62 KiB) Viewed 432 times
Unfortunately, option #3 is not a good solution for my case, as I want to use it for my mod https://mods.factorio.com/mod/no-infinite-technology, however that will prevent people from later removing the mod from their save (anyone who's researched the renamed technology will loose it).

Note that whether or not the upgrade field is true has no affect on the above, neither does researching the technology (the text above the coloured square changes appropriately, but the coloured square itself doesn't change).
Moreover, technologies that already have a number in their name (e.g. artillery-shell-range-1) do not have this problem (I.e. when setting their max_level to a finite value, they display like #3 above),
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3645
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: [2.0.28] Technologies with a finite max_level sometimes not displaying correctly

Post by boskid »

Thanks for the report. Assuming i did not make any mistakes that would cause my changes to get reverted, this should be fixed for 2.0.42.

Up to 2.0.41, only technologies that were marked as finite or ones that had -N suffix were showing levels info. For 2.0.42 i expanded this condition to also apply if technology is marked as upgrade or if it defines more than 1 level. In case i would forget something or cover too much, i also added an override on the prototype to explicitly enable or disable this if this 4-part default would not handle some custom case.

When fixing this i had to also do some other tiny tweaks, for example "bulk-inserter" technology will no longer be marked as `upgrade` because it had no technologies replacing it in the technologies gui. By including the upgrade technologies, i also fixed one tiny issue that was kind of related to your bug report but that was itching me for a quite longer: first levels of modules, given their technology name does not contain -N suffix, they only specify one level and are finite, they were not showing they are only level 1 while the speed-module-2 technology was showing it is a level-2.
Post Reply

Return to “Resolved Problems and Bugs”