[2.0.50] Error in data phase if item has icon with shift in struct form
Posted: Fri May 16, 2025 5:43 pm
The documentation for the Icon.shift field says that the value should be a Vector. The documentation for Vector says it can be either a struct of {x,y}, or an array with 2 entries, where the first is x, and the latter is y.
However if you define an item with an icons array, and one of the elements has an shift in the {x = 1, y = 2} form, the quality mod crashes during data-updates:
This appears to be because the mul_shift function:
Is always assuming that the shift is in the array form.
However if you define an item with an icons array, and one of the elements has an shift in the {x = 1, y = 2} form, the quality mod crashes during data-updates:
Code: Select all
Failed to load mods: __core__/lualib/util.lua:207: attempt to perform arithmetic on field '?' (a nil value)
stack traceback:
__core__/lualib/util.lua:207: in function 'mul_shift'
__quality__/prototypes/recycling.lua:64: in function 'generate_recycling_recipe_icons_from_item'
__quality__/prototypes/recycling.lua:147: in function 'add_recipe_values'
__quality__/prototypes/recycling.lua:208: in function 'generate_recycling_recipe'
__quality__/data-updates.lua:5: in main chunk
Mods to be disabled:
• quality (2.0.47)
Code: Select all
function util.mul_shift(shift, scale)
if not (shift and scale) then
return shift
end
return {shift[1] * scale, shift[2] * scale}
end