tip for graphics

Place to get help with not working mods / modding interface.
User avatar
ArderBlackard
Long Handed Inserter
Long Handed Inserter
Posts: 74
Joined: Thu May 05, 2016 12:41 pm
Contact:

Re: tip for graphics

Post by ArderBlackard »

Sean Mirrsen wrote:I wasn't aware there was even a need to pass info from data to control. Isn't data just a hub for all the things you've got spread around the mod's folders, with some final fixes thrown in? Could you describe a use case, I'm actually curious. :)
Actually the 'data.lua' (and it's siblings) define all the prototypes with all their properties. But later starting from 'control.lua' you have an access only to a small subset of these properties.
A very simple example: imagine you want to get the movement speed of all the enemies in the game (including those defined in other mods, not only from the 'base'). These values are defined in data.lua prototypes like this:

Code: Select all

{ type="unit", ..., movement_speed = "1.5", ... }
But there is no way to get these speed values from 'control.lua' and later in the game. LuaEntityPrototype simply does not have such a field. Currently you will have to go to the "Modding interface requests" subforum and ask the developers to add the 'movement_speed' field to the LuaEntityPrototype with relevant values from 'data.lua' The next day you will need another value from enemies and so on.
Compare with the ability to read the values from 'data.row' table in 'data.lua', store them in some file, then read back in 'control.lua'.
Gib dich hin bis du Glück bist
Post Reply

Return to “Modding help”