How to add Custom Field to prototypes?
How to add Custom Field to prototypes?
Is it possible to add a new field to the prototype that can be interacted with in runtime? I have a great idea for a mod, but I'm running into this limitation. And I don't want to do everything through runtime, because it will be even more difficult to work with the implementation of new things. I have almost no plans to add new buildings. The only ideas are to add new mechanics that require intervention in the prototypes of buildings that consume electricity. Or its producer. Generators.
Re: How to add Custom Field to prototypes?
It is not. You can access prototypes values runtime through the prototypes object.
If you want to get ahold of me I'm almost always on Discord.
Re: How to add Custom Field to prototypes?
Please tell me how to do this then? For example, add a new field for the assembly machine.Rseding91 wrote: Wed Apr 30, 2025 10:53 am It is not. You can access prototypes values runtime through the prototypes object.
Basically, I just need to add a new property to buildings, display it as speed or power consumption near the mouse or under the map as information.Well, and based on this data, interact with buildings differently.
Re: How to add Custom Field to prototypes?
It is not possible to add new fields to prototypes.
If you want to get ahold of me I'm almost always on Discord.
Re: How to add Custom Field to prototypes?
The way most mods do it is create a storage.custom_fields table in control.lua that maps entities to custom fields.
You then need to update the table whenever an entity is built or destroyed.
You then need to update the table whenever an entity is built or destroyed.