fix: delegate null-cost research lore to addon unlock-instructions in ItemButton#799
Open
KevinWoodWL wants to merge 1 commit into
Open
fix: delegate null-cost research lore to addon unlock-instructions in ItemButton#799KevinWoodWL wants to merge 1 commit into
KevinWoodWL wants to merge 1 commit into
Conversation
… ItemButton ItemButton rendered `guide.button.item.not-researched` (a YAML section, not a string) for researches with cost == null, causing RebarTranslator to call toString() on the MemorySection and display garbled text in the guide. ResearchButton already handles this case correctly by delegating to the addon's `<namespace>.researches.<key>.unlock-instructions` key. Align ItemButton with the same behaviour: addons can now describe their custom unlock flow on item buttons (main guide page, recipe detail pages, vanilla crafting pages) as well as on the research node itself.
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.
Problem
ItemButton.getItemProviderrendersguide.button.item.not-researchedfor researches whosecost == null(custom unlock flow, no research points). That key is a YAML section in the lang file (it hasno-research-cost,enough-points,not-enough-pointschildren), not a string.RebarTranslatorreads it viaConfigAdapter.STRINGwhich callstoString()on theMemorySection, so the player sees:This appears on item buttons in the main guide page, recipe detail pages, and vanilla crafting pages — anywhere
ItemButtonis used to display a locked item.Fix
ResearchButtonalready handlescost == nullcorrectly by delegating to<namespace>.researches.<key>.unlock-instructions, letting the addon describe its own unlock flow. This PR alignsItemButtonwith the same behaviour.Addons that use null-cost researches can now provide a meaningful lore line on item buttons (e.g. "Requires 80 Material discipline points — unlock via Science Interface") rather than seeing garbled text.
Reproduce
Researchwithcost = nulland add an item to itsunlocksset.ItemButtonshowing that item displaysMemorySection[...]as the first lore line.