I was thinking of an idea.
I thought it would be neat to mod in a workshop that acted like a smelter, but instead of using a fuel (like magma or coke) it would use power. The idea was it used two grindstones to heat up a boulder into magma and use that to smelt. It would require Power and an extra stone, but gives a slightly different way of smelting.
This idea is actually pretty simple to implement (the stone turning to magma wouldn't actually happen in-game, but is simply the theory behind the thing), except when it comes to the reactions. I would need to copy and paste every single reaction and edit them to work with my new smelter.
I would need to make this:
[REACTION:BRASS_MAKING]
[NAME:make brass bars (use ore)]
[BUILDING:SMELTER:NONE]
[REAGENT:A:1:METAL_ORE:ZINC]
[REAGENT:B:1:METAL_ORE:COPPER]
[PRODUCT:100:2:BAR:NO_SUBTYPE:METAL:BRASS][PRODUCT_DIMENSION:150]
[FUEL]
[SKILL:SMELT]
Into this:
[REACTION:BRASS_MAKING_GRIND]
[NAME:make brass bars (use ore)]
[BUILDING:GRIND_SMELTER:NONE]
[REAGENT:A:1:METAL_ORE:ZINC]
[REAGENT:B:1:METAL_ORE:COPPER]
[REAGENT:F:1:BOULDER:NO_SUBTYPE:INORGANIC]
[PRODUCT:100:2:BAR:NO_SUBTYPE:METAL:BRASS][PRODUCT_DIMENSION:150]
[SKILL:SMELT]
Now what if, I could simplify this a bit. Now notice these two key points:
First: All the regular smelter reactions share certain lines of info. All my reactions share certain lines of info.
Second: All my reactions are nearly identical to the original smelter reactions except for the lines that the first point mentions.
What I propose is a template system similar to what is used for other objects. If you separate, all the lines that stay the same between the two reactions, but differ between similar reactions I get:
[REACTION:BRASS_MAKING]
[NAME:make brass bars (use ore)]
[REAGENT:A:1:METAL_ORE:ZINC]
[REAGENT:B:1:METAL_ORE:COPPER]
[PRODUCT:100:2:BAR:NO_SUBTYPE:METAL:BRASS][PRODUCT_DIMENSION:150]
So I end up with just the formula minus some components. Now I take the parts that differ between the two reactions, but stay that same with-in similar reactions I get:
[REACTION:SMELT]
[BUILDING:SMELTER:NONE]
[FUEL]
[SKILL:SMELT]
[REACTION:GRIND_SMELT]
[BUILDING:GRIND_SMELTER:NONE]
[REAGENT:F:1:BOULDER:NO_SUBTYPE:INORGANIC]
[SKILL:SMELT]
Now I have all the reaction code from the two building separated. Next I would add two lines to the REACTION_BRASS_MAKING:
[USE_TEMPLATE_REACTION:SMELT]
[USE_TEMPLATE_REACTION:GRIND_SMELT]
Doing this would allow reactions to be used at multiple workshops with slightly differing requirements.
The recipe part of the reaction is reusable if someone wanted to add a fourth smelter type for whatever reason. There is also the added bonus of being able to make it so certain reactions can only be done at one building (like in this case I would make it so coke couldn't be produced from a grind smelter) simply by leaving out the template line for the undesirable building.
It also adds some flexibility for modding in general. If someone wants to use my grind smelter with metals from another mod they would have to only add one line to each metal, instead of coping and pasting, adding two lines, editing another line, and deleting another. And the reaction itself wouldn't need to be added to the civilization either (the building would still need permitted though). Overall it would greatly reduce the number of changes a modder would need to make when involved with reactions.
Also reactions would still work they way they currently do, because the current system is still versatile in other ways. You can have one building do a bunch of unrelated reactions without templates. Templates are there to add more versatility not take away from what is there.
Granted, my system isn't perfect and could probably use some other thoughts. Like I wonder if linking the concrete reactions to the templates the way I did is the best way of doing that. I would guess since the game would have to check the templates to find the building types the reaction is linked to it might cause some problems. There would also need to be a way for the reaction to ignore anything in a template linked to a different building (IE: We wouldn't want it asking for the fuel and the extra rock.). Though, most of what I put here would be superficial. It wouldn't change how the game sees things, it just makes it easier for the modders to deal with.
I imagine this has already been put up here somewhere, but I'm not so good at searching since I tend to think in off-the-wall terms. I went through three subject titles for this topic, Polymorphic Reactions and Virtual Reactions were up there before I settled on Reaction Templates.
If this has already been suggested could you point me in the right direction, as I would like to see what others might have come up with. Plus I'd really like to see what they called it so I could find the info easier.