PlayerBag

PlayerBag

The player's inventory bag. Always contains EMPTY_HANDED at index 0. One entry is "selected" — the currently wielded item.

Entries are {piece, count, ammo} objects (not Piece subclasses).

Constructor

new PlayerBag()

Source:

Classes

PlayerBag

Methods

exchange()

Description:
  • Exchange the current selection for a new item.

Source:

find()

Description:
  • Returns the first item matching predicate fn, or null.

Source:

getSelected()

Description:
  • The currently selected item (or EMPTY_HANDED).

Source:

isSelected()

Description:
  • True if this entry is the selected one.

Source:

setInitialSelection()

Description:
  • Quietly set the selection index (during deserialization, no events).

Source: