Pay out salvage materials fairly when each item gives only a fraction
If a common item breaks down into less than one dust, rounding makes salvaging a pile either worthless or generous, and the player learns to salvage one by one or all at once. This entry makes both ways pay the same.
Why this works
Value that is owed should never be thrown away by rounding. Keeping the small leftover with the player and adding it to the next batch makes the reward the same however they split the work, so no habit pays better than another.
When not to use it
Don't carry leftovers when every item should give a clear, whole result you can promise, or when the gain is so tiny it does not matter. Then set yields to whole numbers from the start and make cheap things simply give nothing.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- 13 lines of example code with 3 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Pay out salvage materials fairly when each item gives only a fraction" (read_entry salvage-yields-with-leftover-fractions-carried) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP