new script: item-uses - show all workshop uses for selected item#1581
Open
sizzlins wants to merge 2 commits intoDFHack:masterfrom
Open
new script: item-uses - show all workshop uses for selected item#1581sizzlins wants to merge 2 commits intoDFHack:masterfrom
sizzlins wants to merge 2 commits intoDFHack:masterfrom
Conversation
Adds a new DFHack command 'item-uses' that introspects the selected item and lists every workshop and task that can use it. Features: - Material flag inspection (IS_METAL, WOOD, LEATHER, IS_DYE, etc.) - Plant flag analysis (DRINK, MILL, DRY, THREAD, etc.) - Material reaction product discovery (DRINK_MAT, DYE_MAT, CHEESE_MAT, etc.) - Full reaction/workshop matching against all game reactions - Dynamic workshop name resolution using df.workshop_type/df.furnace_type enums - Smart reagent filtering to avoid false positives from containers and secondary reagents - Proper gating of 'make items' uses to raw materials only (finished goods like armor and furniture correctly show 'Encrust' and 'Melt' instead) - Growth-aware: distinguishes PLANT vs PLANT_GROWTH for accurate results Usage: select an item in-game, then run 'item-uses' from the DFHack console.
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds a new DFHack command
item-usesthat introspects the currently selected item and lists every workshop and task that can use it.Usage
Select any item in-game (from inventory, stockpile, or trade screen), then run:
item-usesExample Output
`
=== Uses for: steel bars ===
Type: BAR | Material: INORGANIC:STEEL
Metalsmith's forge:
- Forge metal items
- Forge weapons/armor/items
- forge angir body
- forge angir strings
...
Smelter:
- Melt metal item
Trade depot:
- Trade with merchants
Total: 142 uses across 6 workshops
`
Features
df.workshop_type/df.furnace_typeenums for version-safe workshop namesTechnical Details
r.building.type[idx])EDIBLE_GROWTHonly shown when the growth's own material hasEDIBLE_COOKED