fix: Fixes loot with zero amount (#1666)

### Summary

* Adds logging if Amount goes to zero. It should never go to zero!
* Deletes an item if it mutates with zero amount.
* Eliminates possible allocation from `params` for `Type[][]` loot pack construction.
* Renames `Loot.ChestOfHeirloomsContains` to `Loot.RandomChestOfHeirloomsContent`.
This commit is contained in:
Kamron Batman 2024-01-29 23:23:42 -08:00 committed by GitHub
parent 64a8d6cb5d
commit 3f00f6d610
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 539 additions and 583 deletions

View file

@ -655,6 +655,17 @@ public class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropertyListEnt
m_Amount = value;
if (m_Amount <= 0)
{
logger.Error(
new Exception("Item.Amount <= 0 error"),
"Item {Type} ({Serial}) was changed to amount of {Amount}, but must be at least 1",
GetType(),
Serial,
m_Amount
);
}
var newPileWeight = PileWeight;
UpdateTotal(this, TotalType.Weight, newPileWeight - oldPileWeight);