Repository navigation
Announce only accepted goods, and leave mixed mode fully on reload - #8
Merged
Merged
Conversation
Two follow-ups from the v1.1.0 reviews. A saved allocation can name a good the game no longer knows, for example after a goods mod is removed. Leaving mixed mode announced every allocated good, and announcing an unknown good reaches InventoryRegistry._inventoriesWithCapacity[good], which throws. Now only goods the building accepts are announced; the game limits any other good to 0 whatever the allocation says (Inventory.LimitedAmount), so nothing else needs to hear about it. A mixed building reloaded without an allocation (the map editor's undo) cleared its shares without announcing its goods, so the game's caches kept the old limits. A redraw already queued then met null shares and disabled mixed visuals for that building for the session. Load now announces the goods of the old and new allocation when a mixed building is reloaded, like Deactivate. That sends its visuals back to the native pile. A queued redraw that finds no allocation now releases the sections instead of failing. A normal save load still announces nothing: a building is never mixed before its own load. visual-tests/AnnouncementTests.cs runs StorageState against the game's own SingleGoodAllower and Inventory, created without Unity, and records every announced good. It fails on main with "announced [Log, Gone], expected [Log]", and fails on a Load that does not announce. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kramsey458
added a commit
that referenced
this pull request
Sep 22, 2026
Bump the version in Directory.Build.props and the manifest to 1.1.1, point the README at the v1.1.1 download, and list PR #8 in the changelog: a saved allocation naming a removed good no longer throws when the building leaves mixed storage, and the map editor's undo that removes an allocation updates the game's caches and the building's visuals. README, developer notes and the website say the changes have not been played in game. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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
This fixes two of the three follow-ups the v1.1.0 reviewers flagged. The third belongs to the BeaverBuddies forks (see below).
Inventory.OnDisallowedGoodsChanged→InventoryChanged→InventoryRegistry.UpdateRegistries→_inventoriesWithCapacity[good], which throwsKeyNotFoundException(confirmed by decompiling 1.1.2.4). Now only goods the building accepts are announced. The game already limits any other good to 0 (Inventory.LimitedAmounttakes the minimum with the inventory's own allowed goods), so nothing else needs to hear about it.Fail()ed, which disabled mixed visuals for that building for the rest of the session.Loadnow announces the goods of the old and new allocation whenever a mixed building is reloaded, the same wayDeactivatedoes. That also returns its visuals to the native pile throughMixedAllocationVisualPatch.MixedContentsRenderer.Rendernow releases the sections instead of failing when the building is no longer mixed.Other unknown-good paths checked: Apply announces only
Inventory.InputGoods; Obtain filters onHasUnreservedCapacity, which checksTakesfirst; Supply skips goods with no stock (#5). The renderer'sGetGoodon an unknown good still falls back to native visuals with a warning. That fallback is visual-only and unchanged here.Tests
visual-tests/AnnouncementTests.csruns the built mod'sStorageStateagainst the game's ownSingleGoodAllowerandInventory, created without Unity. It records every good announced throughDisallowedGoodsChangedand checks five cases: leave, reload without an allocation, reload with another allocation, a normal save load, and a load without an allocation. Every announcement must run as the mod's own change (InternalChange).Leaving mixed mode announces the allocated goods the building accepts, and no good the game does not know; announced [Log, Gone], expected [Log].A mixed building reloaded without an allocation announces its formerly allocated goods, as Deactivate does; announced [], expected [Log].build.ps1green with 0 warnings; 19,115 allocation assertions; 4/4 loading modes; ReplayChecks scans 61 mod methods; 76/76 site checks.The renderer guard needs Unity, so it is only checked in game.
Co-op impact
Simulation changes only on paths that used to throw (unknown good) or that are reached only through the map editor's undo. The wire and save formats are unchanged, and the LateGamePerformance contract (
LimitPatch,SavePatch) is untouched.Proposed CHANGELOG lines
Needs in-game testing
MixedStorage.Allocationis1|Berries=5000;NoSuchGood=5000. Load it, then Copy Settings from a normal Berries warehouse onto it. Expected: no exception in Player.log; the building becomes a normal Berries warehouse.Mixed visuals unavailablewarning appears.Not in this PR: BeaverBuddies prefix order (from #7's review)
The forks' event-recording prefixes (
ReplayEvent.DoPrefixand similar, about 109 bool prefixes in the Stability Fork) run at default priority, so today they run before MixedStorage'sPriority.Lastprefixes. Changing that needs changes in both BeaverBuddies repos, so it is left for a separate decision.🤖 Generated with Claude Code