How to pass custom data-phase attribute to control-phase?

Place to get help with not working mods / modding interface.
meifray
Long Handed Inserter
Long Handed Inserter
Posts: 61
Joined: Sat May 29, 2021 6:12 pm
Contact:

How to pass custom data-phase attribute to control-phase?

Post by meifray »

like,the only way I currently thought of is encode them into a json string as a name,then try to find it and decode it in control phase...
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3729
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: How to pass custom data-phase attribute to control-phase?

Post by DaveMcW »

The devs discourage this by limiting string length, removing unused strings, and expanding the official api.

If you are setting constant values, try defining them in a separate file. Then include that file in data.lua and control.lua.

If you are reacting to the existence of other entity prototypes, you can do that in control.lua too. See game.entity_prototypes.
Post Reply

Return to “Modding help”