Prototype modification and extension syntax

Place to get help with not working mods / modding interface.
User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2179
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Prototype modification and extension syntax

Post 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
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
orzelek
Smart Inserter
Smart Inserter
Posts: 3928
Joined: Fri Apr 03, 2015 10:20 am
Contact:

Re: Prototype modification and extension syntax

Post 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.
Post Reply

Return to “Modding help”