Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Modding out useless seeds - am I doing it right?  (Read 1164 times)

TheBeardyMan

  • Bay Watcher
    • View Profile
Modding out useless seeds - am I doing it right?
« on: December 22, 2019, 08:42:46 am »

So. Fruit tree seeds.
  • Can't plant them.
  • Can't eat them raw.
  • Can't brew them into booze.
  • Can't cook them into prepared meals.
  • Can't mill them to paste.
So, just a useless item, and nothing to worry about then?

Wrong.

Because:
  • They clutter up the stockpile settings menu.
  • They clutter up the fortress.
  • They count against the seed limit. This feature needs to be made smarter in general - useless seeds counting against it are far from the only problem with it.
  • Excluding them from stockpiles doesn't stop dwarves wasting time and bags on gathering them. There's a strong case for this being a bug.
Those problems tip the balance in favour of modding out useless seeds.

First, we need to identify which plants need to be modified.
  • If the [PLANT] section has a [SPRING], [SUMMER], [AUTUMN], or [WINTER], the seeds can be planted - don't modify this plant.
  • If the [USE_MATERIAL_TEMPLATE:SEED:SEED_TEMPLATE] section has an [EDIBLE_COOKED], the seeds can be cooked into prepared meals - don't modify this plant.
  • If the [USE_MATERIAL_TEMPLATE:SEED:SEED_TEMPLATE] section has a [STATE_NAME_ADJ:SOLID_PASTE:*], a [STATE_NAME_ADJ:SOLID_PRESSED:*], and a [MATERIAL_REACTION_PRODUCT:PRESS_LIQUID_MAT:LOCAL_PLANT_MAT:OIL], the seeds can be milled to paste and pressed - don't modify this plant.
  • Ignore [EDIBLE_RAW] or [EDIBLE_VERMIN] in the [USE_MATERIAL_TEMPLATE:SEED:SEED_TEMPLATE] section - those aren't manageable ways of using up seeds.
  • Modify all plants not excluded by the above rules.
Having selected which plants to modify these are the changes to be made to a plant:
  • Remove the [SEED:*:*:#:#:#:LOCAL_PLANT_MAT:SEED] from the [PLANT:*] section.
  • Remove the [USE_MATERIAL_TEMPLATE:SEED:SEED_TEMPLATE] section from the [PLANT:*] section.
  • Remove any [MATERIAL_REACTION_PRODUCT:SEED_MAT:LOCAL_PLANT_MAT:SEED] from any other [USE_MATERIAL_TEMPLATE:*:*] sections.
  • Remove any [GROWTH_HAS_SEED] from any [GROWTH:*] sections.
An example - peach trees. Lines to be removed highlighted in red:

[PLANT:PEACH] prunus persica
   [NAME:peach tree][NAME_PLURAL:peach trees][ADJ:peach tree]
   [USE_MATERIAL_TEMPLATE:STRUCTURAL:STRUCTURAL_PLANT_TEMPLATE]
   [BASIC_MAT:LOCAL_PLANT_MAT:STRUCTURAL]
   [USE_MATERIAL_TEMPLATE:WOOD:WOOD_TEMPLATE]
      [STATE_NAME:ALL_SOLID:peach wood]
      [STATE_ADJ:ALL_SOLID:peach wood]
      [PREFIX:NONE]
       [SOLID_DENSITY:795] Same genus http://www.wood-database.com/plum/
       [STATE_COLOR:ALL_SOLID:DARK_TAN] *** not yet searched
   [USE_MATERIAL_TEMPLATE:DRINK:PLANT_ALCOHOL_TEMPLATE]
      [STATE_NAME_ADJ:ALL_SOLID:frozen peach cider]
      [STATE_NAME_ADJ:LIQUID:peach cider]
      [STATE_NAME_ADJ:GAS:boiling peach cider]
      [MATERIAL_VALUE:2]
      [DISPLAY_COLOR:6:0:0]
      [EDIBLE_RAW]
      [EDIBLE_COOKED]
      [PREFIX:NONE]
   [DRINK:LOCAL_PLANT_MAT:DRINK]
   [USE_MATERIAL_TEMPLATE:LEAF:LEAF_TEMPLATE]
      [STATE_COLOR:ALL:SEA_GREEN]
      [DISPLAY_COLOR:2:0:0]
   [USE_MATERIAL_TEMPLATE:FLOWER:FLOWER_TEMPLATE]
      [STATE_COLOR:ALL:PINK]
      [DISPLAY_COLOR:5:0:1]
   [USE_MATERIAL_TEMPLATE:FRUIT:FRUIT_TEMPLATE]
      [STATE_COLOR:ALL:BURNT_SIENNA]
      [DISPLAY_COLOR:4:0:1]
      [EDIBLE_VERMIN]
      [EDIBLE_RAW]
      [EDIBLE_COOKED]
      [STOCKPILE_PLANT_GROWTH]
      [MATERIAL_REACTION_PRODUCT:DRINK_MAT:LOCAL_PLANT_MAT:DRINK]
      [MATERIAL_REACTION_PRODUCT:SEED_MAT:LOCAL_PLANT_MAT:SEED]
   [USE_MATERIAL_TEMPLATE:SEED:SEED_TEMPLATE]
      [MATERIAL_VALUE:1]
      [EDIBLE_VERMIN]
   [SEED:peach pit:peach pits:6:0:0:LOCAL_PLANT_MAT:SEED]

   [TREE:LOCAL_PLANT_MAT:WOOD][TREE_TILE:5]
   [TRUNK_PERIOD:10]
   [HEAVY_BRANCH_DENSITY:25]
   [BRANCH_DENSITY:50]
   [MAX_TRUNK_HEIGHT:3]
   [HEAVY_BRANCH_RADIUS:1]
   [BRANCH_RADIUS:2]
   [TRUNK_BRANCHING:2]
   [MAX_TRUNK_DIAMETER:1]
   [TRUNK_WIDTH_PERIOD:200]
   [ROOT_DENSITY:5]
   [ROOT_RADIUS:3]
   [STANDARD_TILE_NAMES]
   [PREFSTRING:fruit]
   [DRY]
   [BIOME:ANY_TEMPERATE]
   [SAPLING]
   [GROWTH:LEAVES]
      [GROWTH_NAME:peach leaf:peach leaves]
      [GROWTH_ITEM:PLANT_GROWTH:NONE:LOCAL_PLANT_MAT:LEAF]
      [GROWTH_DENSITY:1000]
      [GROWTH_HOST_TILE:BRANCHES_AND_TWIGS]
      [GROWTH_HOST_TILE:SAPLING]
      [GROWTH_TIMING:0:300000]
      [GROWTH_PRINT:0:6:2:0:0:0:209999:1]
      [GROWTH_PRINT:0:6:6:0:1:210000:239999:1] autumn color
      [GROWTH_PRINT:0:6:4:0:1:240000:269999:1]
      [GROWTH_PRINT:0:6:4:0:0:270000:300000:1]
      [GROWTH_DROPS_OFF]
   [GROWTH:FLOWERS]
      [GROWTH_NAME:peach flower:STP]
      [GROWTH_ITEM:PLANT_GROWTH:NONE:LOCAL_PLANT_MAT:FLOWER]
      [GROWTH_DENSITY:1000]
      [GROWTH_HOST_TILE:BRANCHES_AND_TWIGS]
      [GROWTH_TIMING:60000:119999]
      [GROWTH_PRINT:5:5:5:0:1:60000:119999:2]
   [GROWTH:FRUIT]
      [GROWTH_NAME:peach:peaches]
      [GROWTH_ITEM:PLANT_GROWTH:NONE:LOCAL_PLANT_MAT:FRUIT]
      [GROWTH_DENSITY:1000]
      [GROWTH_HOST_TILE:BRANCHES_AND_TWIGS]
      [GROWTH_TIMING:120000:200000]
      [GROWTH_DROPS_OFF_NO_CLOUD]
      [GROWTH_PRINT:'%':'%':4:0:1:120000:200000:3]
      [GROWTH_HAS_SEED]

Is this the right way to remove useless seeds? Or is there another reference to a plant's seed elsewhere that I've overlooked?

Also, I'm assuming that because this modification would change the number of item types - there will be fewer types of seed - as opposed to simply changing properties of item types, I'll need to generate a new world. Is this correct?
« Last Edit: December 22, 2019, 09:20:37 am by TheBeardyMan »
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: Modding out useless seeds - am I doing it right?
« Reply #1 on: December 24, 2019, 05:52:53 pm »

Looks good to me.

Also, it will definitely require a new world to be generated, but not for the reason you're expecting - DF doesn't keep track of individual seed types like that, but instead checks each individual plant to see what it defines for a seed material. If you look at an "item_seedst" object in DFHack, you'll see it storing a plant ID (which is determined based on the order in which all plants are defined, and the names of the raw files) and a number that specifies which material within that plant to use (based on the order in which they're defined, starting at 419 and ending at 618), and removing a plant's SEED material definition will cause all of the materials after it to shift back by one position (e.g. if you removed Pig Tail seeds, then Pig Tail Thread would change from GRASS_TAIL_PIG material #3 to material #2), not to mention all existing references to that material (e.g. available trade items for each civilization) becoming invalid.
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

Hetsin

  • Bay Watcher
    • View Profile
Re: Modding out useless seeds - am I doing it right?
« Reply #2 on: January 11, 2020, 01:06:58 pm »

Stupid question, but I assume that you can't just add season tokens to make plantable trees, right?
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: Modding out useless seeds - am I doing it right?
« Reply #3 on: January 12, 2020, 08:47:47 am »

Stupid question, but I assume that you can't just add season tokens to make plantable trees, right?
I rather doubt it - farm plots work by replacing the planted SEEDS with PLANT stacks (sized based on the planter's skill level), so if you tried to plant a tree in one, you'd probably get an unusable item out of it. You could, however, add a custom reaction to transform it into WOOD logs afterwards, but that's outside the scope of this thread.
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

Wannabehero

  • Bay Watcher
    • View Profile
Re: Modding out useless seeds - am I doing it right?
« Reply #4 on: January 14, 2020, 03:43:14 pm »

Code: [Select]
   [GROWTH:FRUIT]
      [GROWTH_NAME:peach:peaches]
      [GROWTH_ITEM:PLANT_GROWTH:NONE:LOCAL_PLANT_MAT:FRUIT]
      [GROWTH_DENSITY:1000]
      [GROWTH_HOST_TILE:BRANCHES_AND_TWIGS]
      [GROWTH_TIMING:120000:200000]
      [GROWTH_DROPS_OFF_NO_CLOUD]
      [GROWTH_PRINT:'%':'%':4:0:1:120000:200000:3]
      [GROWTH_HAS_SEED]

Removing this GROWTH_HAS_SEED token from the fruit growths will prevent the seeds from dropping when dwarves eat the raw fruit.

Code: [Select]
   [USE_MATERIAL_TEMPLATE:FRUIT:FRUIT_TEMPLATE]
      [STATE_COLOR:ALL:BURNT_SIENNA]
      [DISPLAY_COLOR:4:0:1]
      [EDIBLE_VERMIN]
      [EDIBLE_RAW]
      [EDIBLE_COOKED]
      [STOCKPILE_PLANT_GROWTH]
      [MATERIAL_REACTION_PRODUCT:DRINK_MAT:LOCAL_PLANT_MAT:DRINK]
      [MATERIAL_REACTION_PRODUCT:SEED_MAT:LOCAL_PLANT_MAT:SEED]

Removing this MATERIAL_REACTION_PRODUCT:SEED_MAT:LOCAL_PLANT_MAT:SEED token will prevent the creation of the plant seeds from "Brew fruit into drink" jobs.  I haven't tried it, but I think the brew reaction will still create generic useless seeds however, because the brew reaction specifically calls out creation of seeds during the reaction, and is just looking for the material from this token. This could possibly be solved with further, slightly more complicated modding.


If you address those two tokens, you shouldn't need to futz with the actual SEED materials in the plant entry.  So the following:

Code: [Select]
   [USE_MATERIAL_TEMPLATE:SEED:SEED_TEMPLATE]
      [MATERIAL_VALUE:1]
      [EDIBLE_VERMIN]
   [SEED:peach pit:peach pits:6:0:0:LOCAL_PLANT_MAT:SEED]

Can be left intact. Although removing these probably won't cause any problems, when editing the RAWs usually the least amount of changes you can to make, the better, so I would just remove the first two tags (GROWTH_HAS_SEED and MATERIAL_REACTION_PRODUCT) and call it good.
« Last Edit: January 14, 2020, 03:49:09 pm by Wannabehero »
Logged