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.

v0.34 Talk:Entity token

From Dwarf Fortress Wiki
Jump to navigation Jump to search

How entities decide what materials they have available for use:

  • If they have STONE_PREF, all nearby inorganic materials with IS_STONE are usable
  • If they have GEM_PREF, all nearby inorganic materials with IS_GEM are usable
  • All nearby inorganic materials with SOIL_SAND are usable as sand
  • All nearby inorganic materials with SOIL_ANY and a FIRED_MAT reaction product are usable as clay
  • If they have OCEAN_PRODUCTS, they get Amber and Coral.
  • Each type of wood is available for general use, restricted as appropriate (using INDOOR_WOOD, OUTDOOR_WOOD, USE_GOOD_WOOD, and USE_EVIL_WOOD).
    • Wood will be used for barrels, buckets, and will be brought as logs
    • If the civ does not have METAL_PREF, wood will be used for cages
    • If the civ has WOOD_WEAPONS, wood will be used for melee weapons, ranged weapons, and ammo
    • If the civ has WOOD_ARMOR, wood will be used for armor
  • Each type of plant is available for general use, restricted as appropriate (using INDOOR_FARMING, OUTDOOR_FARMING, USE_GOOD_PLANTS, and USE_EVIL_PLANTS).
    • If the plant is edible raw or cooked, it will be brought in trade
    • Seeds, thread, drink, mill powders, and extracts will also be available if they exist
  • Every creature with COMMON_DOMESTIC will be made available to the civilization if the proper conditions are met
    • Civ has COMMON_DOMESTIC_PACK and creature has PACK_ANIMAL
    • Civ has COMMON_DOMESTIC_PULL and creature has WAGON_PULLER
    • Civ has COMMON_DOMESTIC_MOUNT and creature has MOUNT
    • Civ has COMMON_DOMESTIC_PET and creature has PET
  • Every creature with EQUIPMENT_WAGON is available to the civilization
  • Each creature is available for general use, restricted as appropriate (using USE_CAVE_ANIMALS, USE_GOOD_ANIMALS, USE_EVIL_ANIMALS, and OCEAN_PRODUCTS; creatures with SUBTERRANEAN_LAVA or FANCIFUL are not allowed)
    • If the entity's ethic for KILL_PLANT is appropriate, wagons will be available for trade
    • If the entity has USE_ANIMAL_PRODUCTS, then animal products are available for trade
      • Certain materials are not available if the creature has CAN_LEARN and the ethic for EAT_SAPIENT_OTHER is inappropriate (not ACCEPTABLE, REQUIRED, or PERSONAL_MATTER)
        • Caught fish (FISHITEM)
        • Eggs (LAYS_EGGS)
        • Appropriate creature materials having the proper tokens:
          • MEAT
          • LEATHER, or MATERIAL_REACTION_PRODUCT:FOO_MAT where a permitted reaction has [PRODUCT:*:*:SKIN_TANNED:NONE:GET_MATERIAL_FROM_REAGENT:*:FOO_MAT]
          • BONE
          • SHELL
          • PEARL
          • HORN
          • TOOTH
      • Extract materials
      • Milk
      • Shearable tissue layers, if both SHEARER and SPINNER are permitted jobs
      • Blood
      • Webber material, if it has SILK
      • All extracts used in SPECIALATTACK_INJECT_EXTRACT (and "liquid" if the creature has a SUCK_BLOOD or INTERACTION special attack)
      • All non-gaseous SECRETIONs
    • If the civ has COMMON_DOMESTIC_PACK, creatures with PET and PACK_ANIMAL are good for pack animals (oddly, it does not check for COMMON_DOMESTIC here)
    • If the civ has COMMON_DOMESTIC_PULL, creatures with PET and WAGON_PULLER are good for pulling wagons (ditto)
    • If the civ has COMMON_DOMESTIC_MOUNT, creatures with PET and MOUNT are good for mounts (ditto)
    • If the civ has COMMON_DOMESTIC_PET, creatures with PET are good for pets (ditto)
    • If the civ has USE_CAVE_ANIMALS and the creature is subterranean
      • Creatures with PET are good for pets
      • Creatures with PET and PACK_ANIMAL are good for pack animals
      • Creatures with PET and WAGON_PULLER are good for pulling wagons
      • Creatures with PET and either MOUNT or MOUNT_EXOTIC are good for mounts
      • Creatures with PET and TRAINABLE_WAR and not CAN_LEARN are good for siege minions
      • Creatures with PET_EXOTIC are good for exotic pets
    • If the civ has USE_ANY_PET_RACE and the creature has either PET or PET_EXOTIC
      • Creatures are good for pets
      • Creatures with PACK_ANIMAL are good for pack animals
      • Creatures with WAGON_PULLER are good for pulling wagons
      • Creatures with MOUNT or MOUNT_EXOTIC are good for mounts
      • Creatures with TRAINABLE_WAR and not CAN_LEARN are good for siege minions
    • If the civ has USE_EVIL_ANIMALS and the creature is EVIL and either lacks CAN_LEARN or has SLOW_LEARNER (which includes CAN_LEARN)
      • Creatures with PACK_ANIMAL are good for pack animals
      • Creatures with WAGON_PULLER are good for pulling wagons
      • Creatures with either MOUNT or MOUNT_EXOTIC are good for mounts
      • Creatures with PET are good for pets
      • Creatures with TRAINABLE_WAR or CAN_LEARN (i.e. with SLOW_LEARNER) are good for siege minions
      • Creatures with PET_EXOTIC are good for exotic pets
    • If the civ has USE_GOOD_ANIMALS and the creature is GOOD and lacks CAN_LEARN
      • Creatures with PACK_ANIMAL are good for pack animals
      • Creatures with WAGON_PULLER are good for pulling wagons
      • Creatures with either MOUNT or MOUNT_EXOTIC are good for mounts
      • Creatures with PET are good for pets
      • Creatures with TRAINABLE_WAR are good for siege minions
      • Creatures with PET_EXOTIC are good for exotic pets
  • For each extract that has a CHEESE_MAT reaction product, that cheese material is also available


  • If the civ has USE_MISC_PROCESSED_WOOD_PRODUCTS
    • If the LYE_MAKING labor is permitted (seemingly indirectly via PERMITTED_JOB), Lye is available
    • If the BURN_WOOD labor is permitted (seemingly indirectly via PERMITTED_JOB), Charcoal is available
    • If the POTASH_MAKING labor is permitted (seemingly indirectly via PERMITTED_JOB), Potash is available
  • If the job GLASSMAKER is permitted and the civ has at least one type of sand, then all 3 glass types (green, clear, and crystal) are available
  • If the job FURNACE_OPERATOR is permitted, all non-SPECIAL stones with METAL_ORE can be smelted by the civilization to provide metal, provided the products have IS_METAL and don't have SPECIAL.


  • For each permitted reaction that produces items of specific materials (i.e. no GET_MATERIAL_FROM_REAGENT)
    • If it produces a BAR made of an INORGANIC material that has IS_METAL but not SPECIAL (e.g. everything but adamantine wafers), the material is available as a metal (regardless of reagent availability)
    • If it produces a BAR made of a non-INORGANIC material, the item is available along with other misc. processed wood items
    • If it produces a POWDER_MISC, the civ can trade it as a powder
  • For each metal available
    • If the material has ITEMS_WEAPON, it can be used for melee weapons
    • If it has ITEMS_AMMO, it can be used for ammo
    • If it has ITEMS_ARMOR, it can be used for armor
    • If it has ITEMS_WEAPON_RANGED, it can be used for ranged weapons
    • If it has ITEMS_DIGGER, it can be used for picks
    • If it has ITEMS_ANVIL, it can be used for anvils
    • Whatever the cheapest metal is, all metals with that value (e.g. copper, tin, zinc, nickel, and lead) can be used for cages
  • All metals with ITEMS_HARD can be used to make flasks
  • All types of leather can be used to make waterskins, quivers, and backpacks

And that's how it all works. The function in question is located at address 0x5E9AA0 in Win32 0.34.11 SDL, in case you want to cross-check my findings. --Quietust (talk) 21:56, 4 June 2014 (UTC)

When core metals are missing, i've seen some types of metal cages replaced by alloys - generally nickel silver and lay pewter. I suspect that the game tries to make a cage from the normal metal, can't find it and then replaces it with the cheapest alloy containing the metal in question - nickel silver contains zinc and nickel (and copper, but lay pewter's cheaper), lay pewter contains lead, tin and copper, so those two already cover all five standard "cage metals". I have a very mineral-poor world where the only pure metals available to humans and dwarfs are tin and lead, and consequently, the imported cages are all made of tin, lead, nickel silver and lay pewter. --Larix (talk) 12:52, 5 June 2014 (UTC)
It's possible that the parent civilization didn't have access to any metal ores and thus was stuck with the cheapest alloys (which are provided by the reactions), namely nickel silver and lay pewter. Child civilizations, however, managed to get access to tin and lead from metal ores, and presumably they then inherited the ability to use nickel silver and lay pewter from the parent civilization. --Quietust (talk) 14:45, 5 June 2014 (UTC)