Fix item amount underflow on item deflect
Loading
This fixes an underflow issue when a player uses an item within the same time they get hurt by that same item.
Bug in question:
What causes the underflow? The following happens in the same tic:
K_ThrowKartItem
.K_BubbleShieldReflect
transfering ownership (making threshold
or leniency frames not apply anymore).K_DropHnextList
. This sets the player's item amount to zero and their item type to none.The fix here is to apply the item amount reduction before calling K_ThrowKartItem in any applicable cases, which makes the underflow not happen.
Fix applied:
Attached is a reproduction script, 255repro.lua, which loads a test case where P1 gets their Orbinaut reflected by P2. It will automatically run after a second and can be repeated by calling the performsetup
command in the developer console.
Changelog: Fixed an issue where a player could have 255 of an empty item in specific circumstances, which would prevent picking up Item Boxes or dropped items.