Retrieving Entity Icons. How?
Posted: Tue Jan 28, 2025 5:39 pm
Hello everyone,
I'm currently developing a mod in Factorio and I've run into an issue I haven't been able to solve for a couple of days now. I have a list of entity prototypes in an array in control.lua obtained from a selection or a blueprint object list. My goal is to count the number of entities by type and create a table where one of the cells in each row contains a button with the entity's icon (be it an entity or a tile).
Here's a snippet of my code:
I haven't found the icons in defines.prototypes. It seems that prototype classes don't have icons either. I could hard-code the paths to the icons, but that would only work with the vanilla game, and I wouldn't be able to get the modded entities' icons this way.
Does anyone know where I can obtain the entity's icon? Any help would be greatly appreciated!
Thank you!
I'm currently developing a mod in Factorio and I've run into an issue I haven't been able to solve for a couple of days now. I have a list of entity prototypes in an array in control.lua obtained from a selection or a blueprint object list. My goal is to count the number of entities by type and create a table where one of the cells in each row contains a button with the entity's icon (be it an entity or a tile).
Here's a snippet of my code:
Code: Select all
for type, count in pairs(entities) do
local prototype = defines.prototypes.entity[type]
if prototype ~= nil then
-- ...
end
end
Does anyone know where I can obtain the entity's icon? Any help would be greatly appreciated!
Thank you!