Page 1 of 1

Expose entities' status diode_color and label even for non-custom states

Posted: Mon Apr 14, 2025 7:56 pm
by petrathekat
Hello,

Right now the only interface modders have to get information about an entity's status is LuaEntity::status, which is just an enum. This means that if you want to render your own diode+label combination, say in a custom GUI for an entity, you have to write a lot of code to figure out the localisation of that status and what sprite to draw.

The code for getting the localisation key has already been posted on the forums: viewtopic.php?p=538298. However it will still be a lot of manual code to associate each status with its correct color sprite, and it's a bunch of unnecessary and error-prone mapping for a value the game already knows.

I suggest adding LuaEntity::status_diode of type defines.entity_status_diode and LuaEntity::status_label of type LocalisedString. But of course you are free to implement whatever interface you wish :)