Search found 6 matches

by johnnyjigglez
Fri May 20, 2022 8:53 pm
Forum: Modding help
Topic: How to reference base Prototype fields for building other prototypes
Replies: 10
Views: 1923

Re: How to reference base Prototype fields for building other prototypes

Thank you, using the log and serpent I was able to update my script more defensively... Taking into account that fields can be nested in difficulty blocks. My issue has been resolved. I'm patching an existing mod around furnaces such that craft speed across several tiers of furnaces take into accoun...
by johnnyjigglez
Fri May 20, 2022 7:02 pm
Forum: Modding help
Topic: How to reference base Prototype fields for building other prototypes
Replies: 10
Views: 1923

Re: How to reference base Prototype fields for building other prototypes

data.raw.recipe["iron-plate"].energy_required
presents the nil
by johnnyjigglez
Fri May 20, 2022 5:56 am
Forum: Modding help
Topic: How to reference base Prototype fields for building other prototypes
Replies: 10
Views: 1923

Re: How to reference base Prototype fields for building other prototypes

I've also attempted to establish my "foo" reference in my mod's data-final-fixes.lua to no avail.
by johnnyjigglez
Fri May 20, 2022 5:54 am
Forum: Modding help
Topic: How to reference base Prototype fields for building other prototypes
Replies: 10
Views: 1923

Re: How to reference base Prototype fields for building other prototypes

energy_required is an optional field which is allowed to be nil during the data stage. If it is still nil at the end, it gets set to the default value of 0.5. This means you need to check for nil before doing math on it. local energy = data.raw.recipe["iron-plate"].energy_required or 0.5 ...
by johnnyjigglez
Fri May 20, 2022 5:53 am
Forum: Modding help
Topic: How to reference base Prototype fields for building other prototypes
Replies: 10
Views: 1923

Re: How to reference base Prototype fields for building other prototypes

according to data\base\prototypes\recipe.lua: { type = "recipe", name = "iron-plate", category = "smelting", energy_required = 3.2, ingredients = {{"iron-ore", 1}}, result = "iron-plate" }, I'm attempting to refer to this prototype and specifically t...
by johnnyjigglez
Fri May 20, 2022 3:27 am
Forum: Modding help
Topic: How to reference base Prototype fields for building other prototypes
Replies: 10
Views: 1923

How to reference base Prototype fields for building other prototypes

How does one go about referencing the fields of prototypes found in the base game during the Data stage? Sample: local foo = 5 * data.raw.recipe["iron-plate"].energy_required data.raw.recipe["my-bar"].energy_required = foo + 16 The game errors on bootup stating that i cannot use ...

Go to advanced search