v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

40d:Reactions

From Dwarf Fortress Wiki
Jump to navigation Jump to search

Reactions currently control the actions of the smelter building. They consist of at least one reagent and one product. Eventually the goal is to include all buildings and their actions within the raws.

You may have multiple reagents and products within a reaction. By including a product that replaces a consumed reagent, you could create things like tools and catalytic reactions.

Anatomy of a Reaction

[REACTION:BITUMINOUS_COAL_TO_COKE] <-- The name of the reaction. Not referenced elsewhere yet, but must be unique.

NAME

[NAME:make coke from bituminous coal] <-- What appears in the game when the necessary reagents are available.

SMELTER

[SMELTER] <-- Says the reaction is performed in the smelter. There are currently no other building tokens.

REAGENT

Reagents come in two main types.

Type 1

[REAGENT:1:STONE:NO_SUBTYPE:STONE:COAL_BITUMINOUS] <-- First parameter after REAGENT is the number of this item the reaction needs. The second is an Item Token, for instance BAR for metal bars. The third is the subtype, if applicable. Fourth is the matgloss class - probably only PLANT, STONE, METAL, COAL, and WOOD, although there may be more lurking. The last is the name of the material in the matgloss files.

Type 2

[REAGENT:1:REACTION_CLASS:FLUX] <-- Reaction_class can be replaced with METAL_ORE and possibly STONE_NAME and THREAD_METAL though those aren't used in the basic reaction types. Those are special cases that identify items that use the tags like [STONE_NAME:platinum nuggets] or [THREAD_METAL:ADAMANTINE:100] [Verify]


PRODUCT

[PRODUCT:100:3:BAR:NO_SUBTYPE:COAL:COKE] <-- The end product(s) of the reaction. The first parameter might be probability of success. The rest is the same as in REAGENT.

FUEL

[FUEL] <-- Says the reaction uses fuel.

Notes

There are some pitfalls to reaction modding, and other odd behaviour that should be noted.

Certain item tokens, notably LEAVES and PLANT use the MATERIAL and MATGLOSS tokens in an unexpected way. Rather than interpreting these tokens in the usual way, the game takes the numerical value of the MATERIAL token (as listed on the Item tokens page, and picks the plant that is that number of places in the raws. The MATGLOSS token appears to be ignored. For example, using the token [PRODUCT:100:1:PLANT:NO_SUBTYPE:BONE:DWARF] would result in the creation of one sweet pod plant, because BONE is material token number 4, and sweet pod is the fourth plant in the matgloss_plant.txt raw file.

Secondly, it does not seem possible to use extracts as reagents at this time. Attempting to do so will behave as if the reagent is not available, even if it is in plentiful supply. Queueing up the reaction from the manager will result in the job being cancelled, telling you that your dwarf needs some of the relevant extract. Extracts can still be created as reaction products, using the normal MATERIAL and MATGLOSS rules. However, since extracts need to go in a container (bag, barrel, or vial), any extract produced in a reaction is treated as 'spilled', and if placed in a stockpile it will be swiftly cleaned up by a dwarf.