Page 1 of 1

Equipment grid trouble

Posted: Thu Apr 23, 2020 7:14 am
by Pi-C
I'm meddling with equipment grids now. According to this, entities may have a "grid" property of type LuaEquipmentGrid. However, when I run this code:

Code: Select all

for k, v in pairs(data.raw["car"]) do
log(k .. " has grid: " .. tostring(v.grid))
log(k .. " has equipment grid: " .. tostring(v.equipment_grid))
end
I get this output:

Code: Select all

   2.306 Script @__autodrive__/grid.lua:37: car has grid: nil
   2.306 Script @__autodrive__/grid.lua:38: car has equipment grid: vtk-car-equipment-grid
   2.306 Script @__autodrive__/grid.lua:37: tank has grid: nil
   2.306 Script @__autodrive__/grid.lua:38: tank has equipment grid: vtk-tank-equipment-grid
   2.306 Script @__autodrive__/grid.lua:37: crawler has grid: nil
   2.306 Script @__autodrive__/grid.lua:38: crawler has equipment grid: autodrive-sensor-grid
   2.306 Script @__autodrive__/grid.lua:37: Dodge-Challenger has grid: nil
   2.306 Script @__autodrive__/grid.lua:38: Dodge-Challenger has equipment grid: challenger-equipment-grid
   2.306 Script @__autodrive__/grid.lua:37: Hauling-Truck has grid: nil
   2.306 Script @__autodrive__/grid.lua:38: Hauling-Truck has equipment grid: vtk-ljd-heavy-truck-equipment-grid
Is that a bug in the Lua API description, do I misunderstand something here?

Re: Equipment grid trouble

Posted: Thu Apr 23, 2020 8:14 am
by Bilka
You linked the runtime doc, but your code suggests you're doing data stage stuff. In data stage, for vehicles, you need to look at https://wiki.factorio.com/Prototype/Veh ... pment_grid, as your code shows.

Re: Equipment grid trouble

Posted: Thu Apr 23, 2020 8:20 am
by Pi-C
Bilka wrote: Thu Apr 23, 2020 8:14 am You linked the runtime doc, but your code suggests you're doing data stage stuff. In data stage, for vehicles, you need to look at https://wiki.factorio.com/Prototype/Veh ... pment_grid, as your code shows.
Ooops, of course you're right! Happens with too little sleep and no coffee yet. :-D