EarendelDevelopers / factorio-mods

This is a public repository for tracking issues with Earendel's factorio mods.
18 stars 3 forks source link

Bug with Robot Attrition recipe generation (suggested fix included) #173

Closed nicolas-lang closed 2 years ago

nicolas-lang commented 2 years ago

Robot Attrition has an issue if the icon definition is slightly uncommon but valid (see wiki.factorio.com):

icon_size = 64,
icons = {
    {
        icon = "__base__/graphics/icons/logistic-robot.png",
        tint = {r = 1, g = 0.3, b = 0.3}
    }
},

If the item has the icons (ending with s) array defined, but does not specify an individual icon_size in every member, the game will crash because Robot Attrition will only copy the contents of the icons node and not the (in this case mandatory) fallback icon_size on the root level.

SE-Err

The crash can be reproduced by installing SE and the slightly outdated mod "creative-mod".

Suggested Fix: The fix would be to also copy the icon_size property to the recipes root node in data-updates.lua between lines 34 and 35

existing code

      table.insert(item.icons, {icon="__core__/graphics/icons/alerts/destroyed-icon.png", icon_size = 64, scale = 0.25})
      table.insert(recipe_repair.icons, {icon="__core__/graphics/icons/alerts/destroyed-icon.png", icon_size = 64, scale = 0.25})
      table.insert(recipe_recombine.icons, {icon="__core__/graphics/icons/alerts/destroyed-icon.png", icon_size = 64, scale = 0.25})
      -->insert the following fragment here
    else

new additional code

      item.icon_size = o_item.icon_size
      recipe_repair.icon_size = o_item.icon_size
      recipe_recombine.icon_size = o_item.icon_size
EarendelGames commented 2 years ago

Thanks, implemented.