Page 1 of 1

Prototype modification and extension syntax

Posted: Sat Aug 29, 2015 9:25 pm
by Ranakastrasz
I want to be able to, for all existing prototypes matching some validator, alter some particular trait. I am uncertain how to form a loop for this.

One of the values I want to alter is the power field, which are strings with something like "50kW". I need to be able to multiply that values, meaning I need to be able to separate it from the text part. How can I go about doing this?

I want to be able to quickly alter/overwrite some parts of a prototype, but not have to have a long string of alterations like this. Also, I don't want to just entirely overwrite the whole original prototype. Is it possible to only overwrite particular parts of it?

Code: Select all

data.raw["recipe"]["basic-bullet-magazine"].ingredients = 
	{
		{"iron-plate", 2}, -- 2
		{"copper-plate", 1},
		{"coal", 1}
	}
data.raw["recipe"]["basic-bullet-magazine"].energy_required = 2 -- 2
data.raw["recipe"]["basic-bullet-magazine"].result_count = 1

Re: Prototype modification and extension syntax

Posted: Sat Aug 29, 2015 9:40 pm
by orzelek
I'd recommend looking at the big mods - bob's ones are doing a lot of this for sure.
Long syntax might be needed th - you can make it easier by using local variables if you want to change more then one attribute of item.