Repository navigation
Keep alloys working after ac reload - #40
Conversation
`ac reload` rebuilt ingredient types, hits and schemes as new objects, but loaded alloys and open stations kept the old ones, and stations looked them up by object. Every alloy then stopped counting as its type until a restart: `ac give equipment ... alloy.<id>` said "0 out of 4 Metal items" and adding an alloy to a station threw. Ingredient types, hit types and hits now compare by id, and a reload points the loaded alloys at the reloaded objects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@coderabbitai review |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to No merge-blocking issue was established; proceed with normal checks.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
✅ Action performedReview finished.
|
|
TFMCDev01 (PR jar |
Problem
After
ac reloadevery alloy stops working until the server restarts (seen on TFMCDev01 after someone ranac reload):/ac give equipment medium_helmet alloy.darksteelfails with "You only have 0 out of 4 Metal items".CraftingStation.addMaterial, and nothing is crafted.ac reloadbuilds newIngredientType,HitType,CraftingHitand scheme objects, but the loaded alloys (and any open station) keep the old ones. Stations count materials in maps keyed by those objects, which compared by identity. So an old alloy type never matched the station's new "metal" type. Ingredients were fine because they are rebuilt on reload. Main would hit the same bug if anyone ranac reloadthere.Change
IngredientType,HitTypeandCraftingHitcompare by id (equals/hashCode). Old and new objects for the same id now match everywhere: station type and hit counts, restored stations,Cache.combinations.ac reloadnow also points every loaded alloy at the reloaded type, hits, colour scheme and model scheme (AlloyManager.relinkAlloys→AlloyData.relink). An id that is no longer in the config keeps its old object, as before.Revision hashes use ids only, so nothing gets re-revisioned.
Testing
AlloyReloadTest: an alloy loaded before a reload fills a station by hand and through the give command's restore path; relink swaps in the reloaded objects and keeps missing ones; id equality. Without the fix, the station case throws the same NPE as on Dev.mvn verifylocally withoutEdgeCoverageTest/StationDatabaseCoverageTest(they always fail on Windows, also onmain): all 141 other tests pass, and the changed classes are fully covered.🤖 Generated with Claude Code