I've got a certain level of success on this so far. I have managed to produce a "patch file" from two reaction raw files.
An example follows:
The "from" reactions file (a very stripped down example of the vanilla version):
reaction_standard
[OBJECT:REACTION]
[REACTION:BITUMINOUS_COAL_TO_COKE]
[NAME:make cake from bituminous coal]
[SMELTER]
[REAGENT:1:STONE:NO_SUBTYPE:STONE:COAL_BITUMINOUS]
[PRODUCT:100:3:BAR:NO_SUBTYPE:COAL:COKE]
[FUEL]
[REACTION:LIGNITE_TO_COKE]
[NAME:make coke from lignite]
[SMELTER]
[REAGENT:1:STONE:NO_SUBTYPE:STONE:LIGNITE]
[PRODUCT:100:2:BAR:NO_SUBTYPE:COAL:COKE]
[FUEL]
The "to" reactions file:
reaction_standard
[OBJECT:REACTION]
[REACTION:BITUMINOUS_COAL_TO_COKE]
[NAME:make coke from bituminous coal]
[SMELTER]
[REAGENT:1:STONE:NO_SUBTYPE:STONE:COAL_BITUMINOUS]
[PRODUCT:100:3:BAR:NO_SUBTYPE:COAL:COKE]
[FUEL]
[REACTION:BRASS_MAKING]
[NAME:make brass bars (use ore)]
[SMELTER]
[REAGENT:1:METAL_ORE:ZINC]
[REAGENT:1:METAL_ORE:COPPER]
[PRODUCT:100:2:BAR:NO_SUBTYPE:METAL:BRASS]
[FUEL]
In plain English the changes are:
- The BITUMINOUS_COAL_TO_COKE reaction was renamed from "make cake from bituminous coal" to "make coke from bituminous coal"
- The BRASS_MAKING reaction was added.
- The LIGNITE TO COKE reaction was removed.
The resulting "patch" file follows:
[ITEM:RAW_FILE:reaction_standard]
[GROUP:objects:REMOVE]
[REACTION:LIGNITE_TO_COKE]
[NAME:make coke from lignite]
[SMELTER]
[REAGENT:1:STONE:NO_SUBTYPE:STONE:LIGNITE]
[PRODUCT:100:2:BAR:NO_SUBTYPE:COAL:COKE]
[FUEL]
[GROUP:objects:ADD]
[REACTION:BRASS_MAKING]
[NAME:make brass bars (use ore)]
[SMELTER]
[REAGENT:1:METAL_ORE:COPPER]
[REAGENT:1:METAL_ORE:ZINC]
[PRODUCT:100:2:BAR:NO_SUBTYPE:METAL:BRASS]
[FUEL]
[GROUP:objects:ALTER]
[ITEM:REACTION:BITUMINOUS_COAL_TO_COKE]
[ATTR:name:STR:make cake from bituminous coal:STR:make coke from bituminous coal]
Several more bits of work remain to make this fully useful:
- Being able to read in the patch file and apply it to a raw file.
- Being able to parse and write more types of raw file than just reactions.
Any comments on results so far? I'm pondering how readable the patch file format is. Whilst it can be generated automatically, I'd prefer it if it was readable and understandable by modders. The file format isn't fixed at this early stage, so now is the best time to refine it (and no doubt there will be changes, especially when it comes to me writing a parser for it).
Edit: I got my English description of the changes the wrong way around, oops!