oldschooljs
oldschooljs copied to clipboard
LootTable improvements (cloning, memory, allItems accuracy)
Description:
Fixes issues where LootTable.clone() doesn't actually deep-clone, so if you want to make adjustments to LootTables, it's a much trickier prospect.
Also, if a sub-table changes after it's add()
'd then the LootTable.allItems will be incorrect
This fixes those issues, and also removes the need to cache allItems which is a small memory improvement.
Changes:
-
allItems
is now a getter, so that it is always accurate. -
LootTable.clone() now properly clones the LootTable
-
Added unit tests
-
[x] I have tested all my changes thoroughly.