What methods does the game use to store fractional payouts for a player?

The title might not make sense so let me give you an example.

If you take the advanced scrap tea buff, this gives you an extra 225% scrap payout from barrels. By default there are 2 scrap in a barrel so when you hit a barrel you are awarded 4.5 extra scrap. Because you cannot be given a fractional amount the number is rounded down to 2 and the 0.5 is saved for later. Next time you hit a barrel you get another 2.5 scrap but the fractional amount from last time rounds up to 3 so you get the full 3 extra scrap awarded. This means the payout from barrel to barrel flip flops between 6 and 7 scrap.

Another example is when you recycle a turret in the recycler. There is a 50% chance you get a camera and 50% chance you get a targeting computer. If you recycle two auto-turrets you will always get 1 camera and 1 targeting computer so I'm pretty sure this isn't done using odds and random chance, rather you are given a fraction of a payout and it is stored against your player until you get a whole fraction to pay out.

So my question is how, as a plugin author, can I leverage this? Are there any methods on the player object where I can store fractional payouts of items and when the value reaches 1 I can pay it out?

I have a plugin that auto pickups loots barrels on destroy but because that happens before the built-in modifiers from teas kick in, my plugin isn't awarding the extra scrap when it should. I can check the player's modifiers to see what multiplier I should apply to scrap and I can change the amount of scrap awarded from the barrel. The problem arises with the advanced tea and the resulting fractional payout. Also if other plugins are modifying the barrel amounts or the tea modifiers then I'm more likely to run up against fractional payouts. I could just round down to a whole number and be done with it, but the game has a way of dealing with this built-in so it would be nice to use it.

For the scrap modifier from scrap teas, I found out how the game does it. Here is the code I used to replicate what the game does but differently for use in my plugin:

 

                // If item is scrap, apply the tea bonus drop logic used by the game to award extra scrap.
                if(lootContainerInventory.itemList[i].info.shortname == "scrap")
                {
                    float num = (player.modifiers != null) ? (1f + player.modifiers.GetValue(global::Modifier.ModifierType.Scrap_Yield, 0f)) : 0f;
                    if (num > 1f)
                    {
                        float num2 = player.modifiers.GetVariableValue(global::Modifier.ModifierType.Scrap_Yield, 0f);
                        float num3 = Mathf.Max((float)lootContainerInventory.itemList[i].amount * num - (float)lootContainerInventory.itemList[i].amount, 0f);

                        num2 += num3;
                        int num4 = 0;
                        if (num2 >= 1f)
                        {
                            num4 = (int)num2;
                            num2 -= (float)num4;
                        }
                        player.modifiers.SetVariableValue(global::Modifier.ModifierType.Scrap_Yield, num2);
                        if (num4 > 0)
                        {
                            lootContainerInventory.itemList[i].amount += num4;
                        }
                    }
                }