View Issue Details

IDProjectCategoryView StatusLast Update
0009106Dwarf FortressAdventure Mode -- Reactionspublic2020-08-24 17:55
ReporterDarthAgnan Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
OSWindows 
Product Version0.40.24 
Summary0009106: Reactions in adventure mode are very broken.
DescriptionIt seems that reactions for adventure mode that use stacks of items or items with size, such as thread, bars, cloth, etc. either consume the entire stacks of items or subtract wrong amount of dimension and demand extra item/stack (sometimes a negative part of it!).

If in REAGENT ([REAGENT:coal:150:BAR:NO_SUBTYPE:COAL:NO_MATGLOSS]) you specify 150 amount (which is one full bar), reaction will ask for a bar and 0/150 of second bar to proceed. If in REAGENT ([REAGENT:coal:2:BAR:NO_SUBTYPE:COAL:NO_MATGLOSS]) you specify 2 amount of bars, and use full 150 bar, reaction will ask for -148/150 of second bar to proceed.

If in REAGENT ([REAGENT:bone:10:NONE:NONE:NONE:NONE][ANY_BONE_MATERIAL]) you specify that you want 10 bones then reaction will take one bone from the stack and will ask you for 9(!) more stacks to proceed. That is if you used [ANY_BONE_MATERIAL] to identify bones; if you use REACTION_CLASS to identify bones - reaction will consume 10 full stacks.
Steps To ReproduceThe following example will demonstrate 4 bugs:

add [REACTION_CLASS:ADV_BONE] to bone material and then the rest into the reactions:

[REACTION:DECORATE_BONE_BANDS1]
    [NAME:decorate item with bone (bands) eating up stacks]
    [ADVENTURE_MODE_ENABLED]
    [REAGENT:target:1:NONE:NONE:NONE:NONE][PRESERVE_REAGENT]
    [REAGENT:bone:1:NONE:NONE:NONE:NONE][REACTION_CLASS:ADV_BONE]
    [IMPROVEMENT:100:target:BANDS:GET_MATERIAL_FROM_REAGENT:bone:NONE]
    [SKILL:BONECARVE]

[REACTION:DECORATE_BONE_BANDS2]
    [NAME:decorate item with bone (bands) working fine with stacks]
    [ADVENTURE_MODE_ENABLED]
    [REAGENT:target:1:NONE:NONE:NONE:NONE][PRESERVE_REAGENT]
    [REAGENT:bone:2:NONE:NONE:NONE:NONE][ANY_BONE_MATERIAL]
    [IMPROVEMENT:100:target:BANDS:GET_MATERIAL_FROM_REAGENT:bone:NONE]
    [SKILL:BONECARVE]

Now if you use this reactions, the first one will use the entire stack of bones (1), while the second one will use only one bone out of the stack and then demand for another bone from another stack (2). Both reactions seem to ignore the skill for both quality and training purposes (3). Also, the first one consumes skulls all right, while the second - does not consume skulls (4)... I have no idea why; it might be because skulls have dimensions like bars and this reaction consumes only a fraction of the skull?
Additional InformationAnother observation rather than bug: GET_MATERIAL_FROM_REAGENT will use the material of the first item of many. Say, you are making a bone breastplate out of 10 bones (using 10 stacks of bones is the only way to make it work) and pick first bone to be a cat bone and the rest of 9 - human bones, the reaction will result in cat bone breastplate.
Another observation which probably is a bug: partial bars either leftover from reactions or result of a reaction always weigh the same as a full 150 dimension bar. How I know they are partial? Reactions will take what is left in the bar and then demand the leftover of the other bar, so from how much it demand the second time I can tell how much the first one had in it.
Tagsadventurer mode, long-standing bug, modding, reactions

Activities

user8971

2015-10-26 12:26

  ~0033133

Can be connected to 0003712, "Product dimensions act weird".

Also note http://www.bay12games.com/dwarves/ on 2015-10-21: "I also added a numbered tag to reactions so that they won't use up entire bone stacks making multiple products if you don't want them to (the dwarves were making giant piles of bone plectrums out of a single yak skeleton all at once)." The fix may be on the way.

DarthAgnan

2015-10-27 08:41

reporter   ~0033136

"I also added a numbered tag to reactions so that they won't use up entire bone stacks making multiple products if you don't want them to (the dwarves were making giant piles of bone plectrums out of a single yak skeleton all at once)."
I understood it as there will be a tag for a number of products. So, now, if you use the following reaction:
[REACTION:CARVE_BONE_ARROWS_ADV]
[NAME:carve a stack of bones into arrows]
[ADVENTURE_MODE_ENABLED]
[REAGENT:bone:1:NONE:NONE:NONE:NONE][USE_BODY_COMPONENT][ANY_BONE_MATERIAL]
[PRODUCT:100:5:AMMO:ITEM_AMMO_ARROWS:GET_MATERIAL_FROM_REAGENT:bone:NONE]
[SKILL:BONECARVE]
the result will be the full stack of bones turning into a full stack of N*5 arrows. Now with a new tag you will be able to use only one bone of the stack to get only 5 arrows. While it is nice that there will be another tag which will make reactions better it is still not a fix to multiple issues with reactions in adventure mode.

user8971

2015-10-27 12:39

  ~0033137

OK, but how are you getting to those reactions in adventure mode, after all? IIRC one can't do much crafting in vanilla ADV mode. Are you using 3rd party mods then, something like Genesis maybe (http://df-genesis.wikidot.com/adventure-crafting)?

chaosvolt

2015-10-28 07:29

reporter   ~0033138

Reaction mods for adventure mode are trivial to implement. >_>

I recall encountering this issue, yes. I've mentioned it and people are claiming this has been fixed, but I'd seen no sign of it actually working right. In .40.24 at least, you need to juggle the tags and only make a reaction consume a single STACK of bone, or things break alarmingly fast.

DarthAgnan

2015-10-28 08:48

reporter   ~0033140

"OK, but how are you getting to those reactions in adventure mode, after all? IIRC one can't do much crafting in vanilla ADV mode."
True, you can't do much crafting in vanilla ADV mode yet, but with raws and examples available it doesn't take much to figure out how to expand the crafting in ADV mode. The problem, however, is not in my modding attempts, but in the fact that reactions (edited through raws) do not work the way intended in ADV mode, which actually indicates that there might be several problems with the fort mode reactions as well (also indicated by recent "fix" by Toady that you mentioned).

chaosvolt

2015-10-29 21:15

reporter   ~0033146

As I've mentioned, yeah. Reaction mods are as common as elves.

Even I've done a WF-derivative, so me being able to not fuck it up is pretty much the benchmark for easy coding.

chaosvolt

2016-02-13 09:29

reporter   ~0034656

Bwahahahah. And now, DF has bonecarving reactions in vanilla.

However, they're restricted to very basic, small things that logically wouldn't take more than 1 at a time. So it doesn't run into this bug at all.

chaosvolt

2020-02-13 22:26

reporter   ~0040054

Thought: [MIN_DIMENSION:X] is a valid reagent modifier now, any idea if this can be used to work around some of this bgu?

noxiilarxene

2020-08-24 17:55

reporter   ~0040707

Can confirm this is still the case in 47.04

Add Note

Note

Issue History

Date Modified Username Field Change
2015-10-26 03:37 DarthAgnan New Issue
2015-10-26 12:26 user8971 Note Added: 0033133
2015-10-27 08:41 DarthAgnan Note Added: 0033136
2015-10-27 12:39 user8971 Note Added: 0033137
2015-10-28 07:29 chaosvolt Note Added: 0033138
2015-10-28 07:30 chaosvolt Tag Attached: adventurer mode
2015-10-28 07:30 chaosvolt Tag Attached: modding
2015-10-28 07:30 chaosvolt Tag Attached: reactions
2015-10-28 08:48 DarthAgnan Note Added: 0033140
2015-10-29 21:15 chaosvolt Note Added: 0033146
2016-02-13 09:29 chaosvolt Note Added: 0034656
2016-05-20 18:19 chaosvolt Tag Attached: long-standing bug
2020-02-13 22:26 chaosvolt Note Added: 0040054
2020-08-24 17:55 noxiilarxene Note Added: 0040707