Equipment grid trouble

Place to get help with not working mods / modding interface.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1759
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Equipment grid trouble

Post 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?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Bilka
Factorio Staff
Factorio Staff
Posts: 3464
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Equipment grid trouble

Post 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.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1759
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Equipment grid trouble

Post 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
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Post Reply

Return to “Modding help”