Long range delivery drones

by Klonan

They deliver things far far away

Content
5 months ago
1.1 - 2.1
37.4K
Logistics

b attempt to perform arithmetic on field '?' (a nil value)

14 days ago
(updated 13 days ago)

126.135 Error ModManager.cpp:1786: Failed to load mod "Long_Range_Delivery_Drones": Long_Range_Delivery_Drones/data-final-fixes.lua:32: attempt to perform arithmetic on field '?' (a nil value)
stack traceback:
Long_Range_Delivery_Drones/data-final-fixes.lua:32: in function 'make_delivery_particle'
Long_Range_Delivery_Drones/data-final-fixes.lua:79: in main chunk

Did a bit of logging, that's the culprit:

 126.127 Script @__Long_Range_Delivery_Drones__/data-final-fixes.lua:22: {
  {
    filename = "__base__/graphics/icons/iron-ore.png",
    height = 64,
    scale = 0.375,
    shift = {
      0,
      0
    },
    tint = {
      1,
      0.65,
      1,
      1
    },
    width = 64
  },
//...
  {
    filename = "__corrundum-the-acid-planet__/graphics/icon/enriched-iron.png",
    height = 64,
    scale = 0.1125,
    shift = {
      x = 9,
      y = 9
    },
    width = 64
  }
}

Corrundrum adds this thing I believe in their data_updates.lua#68 (no source online). I believe the x/y syntax is fair game reading this: https://lua-api.factorio.com/latest/types/IconData.html#shift, where Vector can be this: https://lua-api.factorio.com/latest/types/Vector.html. might come up some time, found something sounding like a similar problem e.g. here https://forums.factorio.com/viewtopic.php?t=128854

So I guess your code at data-final-fixes.lua#32 (no source online) would have to handle that case. I hacked this into it, the error is gone then, but I'm not sure if I'm LUAing right:

local picturex=picture.shift.x or picture.shift[1]
local picturey=picture.shift.y or picture.shift[2]
picture.shift = {picturex + shift[1], picturey + shift[2]}

Thanks for looking into it and thanks for lifting the mod to 2.1! :-)

New response