Page 1 of 1

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

Posted: Mon Dec 30, 2024 1:07 pm
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 213 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 213 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 213 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),