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:
parent
64a8d6cb5d
commit
3f00f6d610
4 changed files with 539 additions and 583 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue