oldschooljs icon indicating copy to clipboard operation
oldschooljs copied to clipboard

LootTable improvements (cloning, memory, allItems accuracy)

Open themrrobert opened this issue 1 year ago • 0 comments

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.

themrrobert avatar Oct 16 '22 04:10 themrrobert