[2.0.50] Error in data phase if item has icon with shift in struct form

Bugs that we were not able to reproduce, and/or are waiting for more detailed info.
crusybl
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri May 16, 2025 5:31 pm
Contact:

[2.0.50] Error in data phase if item has icon with shift in struct form

Post by crusybl »

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:

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)
This appears to be because the mul_shift function:

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
Is always assuming that the shift is in the array form.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15670
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [2.0.50] Error in data phase if item has icon with shift in struct form

Post by Rseding91 »

Can you provide a sample mod/piece of lua code that reproduces this error? I'm having trouble getting anything to error regardless of how I define the shift value.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Pending”