This object is capable of storing ("stowing") Equipment
within itself.
The following objects are considered item containers:
players (their own inventory),
players (their corpse's loot),
vehicles (their trunk), and
lockers (contents of the player's fifth slot).
An inventory are used to stow Equipment
when it does not exist visually in the game world.
Visually, an inventory is understood as a rectangular region divided into cellular units.
A slot-like interface for a specific grid position in an inventory.
A slot-like interface for a specific grid position in an inventory.
The size is typically bound to anything that can be stowed which encompasses most all Equipment
.
The capacity of this EquipmentSlot
is essentially treated as 1x1.
Upon insertions, however, the capacity temporarily is treated as the size of the item being inserted (unless None
).
This allows a proper check for insertion collision.
Rather than operating on a fixed-size slot, this "slot" represents an inventory region that either includes slot
or starts at slot
.
When determining the contents of the inventory at slot
, only that singular cell is checked.
When removing an item from slot
, the item in inventory only has to be positioned in such a way that overlaps with slot
.
When adding an item to slot
, slot
is treated as the upper left corner (the initial point) of a larger capacity region.
The following diagrams demonstrate the coordinate association:
- - - - - - - - - - - - - - -
- - - - - - r r x - - - - - -
- - s - - - r r x - - - i i -
- - - - - - x x x - - - i i -
- - - - - - - - - - - - - - -
... where 's' is the 1x1 slot,
'r' is the corner of any 2x2 item that can be removed ('x' is a potential affected edge),
and 'i' is the region checked for a 2x2 insertion into slot
.
Represent the image placard that is used to visually and spatially manipulate an item placed into the grid-like inventory.
Represent the image placard that is used to visually and spatially manipulate an item placed into the grid-like inventory. The unofficial term for this placard (the size of the placard) is a "tile." The size of the tile is usually fixed but the origin point of the tile can be changed.
A "tile" represents the size of the icon placard that is used by Equipment
when placed into an inventory or visible slot.
A "tile" represents the size of the icon placard that is used by Equipment
when placed into an inventory or visible slot.
It is also used by some ObjectDefinition
s to pass information about the size of an inventory itself.
IllegalArgumentException
if either the width or the height are less than zero
An inventory are used to stow
Equipment
when it does not exist visually in the game world.Visually, an inventory is understood as a rectangular region divided into cellular units. The
Equipment
that is placed into the inventory can also be represented as smaller rectangles, also composed of cells. The same number of cells of the item must overlap with the same number of cells of the inventory. No two items may have cells that overlap. This "grid" maintains a spatial distinction between items when they get stowed.It is not necessary to actually have a structural representation of the "grid." Adhering to such a data structure does speed up the actions upon the inventory and its contents in certain cases (where noted). The
HashMap
of items is used for quick object lookup. Use of theHashMap
only is hitherto referred as "using the inventory as aList
." TheArray
of spatial GUIDs is used for quick collision lookup. Use of theArray
only is hitherto referred as "using the inventory as a grid."