Skip to content

InventoryStyle ​

Inherits: Resource

The rules of the inventory of one kind of owner: how items take space, where the capacity comes from, and whether items weigh something.

Description ​

The default style is the one the toolkit always had: slots, the number of them from the Bag Slots stat, no weight. The rules combine: weight can be added to slots, to a grid or to unlimited space. The Gameplay Config holds the style of the characters, of NPCs and of containers; an NPC definition and a container can have a style of their own. See docs/systems/inventory-styles.md, section 3.

Properties ​

SpacespaceSpace.SLOTS
SlotsFromslots_fromSlotsFrom.STAT
intfixed_slots20
intgrid_width10
intgrid_height6
boolweight_enabledfalse
CapacityFromcapacity_fromCapacityFrom.STAT
floatfixed_capacity100.0
boolcount_worn_itemstrue
OverLimitover_limitOverLimit.NONE
floathard_limit_percent100.0
Array[EncumbranceTier]encumbrance_steps[]

Methods ​

EncumbranceTierget_step_for( percent: float )
InventoryStylefor_npc() static
InventoryStylefor_entity( entity: Entity ) static
Array[Dictionary]validate()

Enumerations ​

enum Space ​

How items take space

  • SLOTS = 0 - A list of slots, one stack in each
  • GRID = 1 - A grid of cells: an item covers the cells of its shape
  • UNLIMITED = 2 - No limit: slots appear as items come

enum SlotsFrom ​

Where the number of slots comes from

  • STAT = 0 - The Bag Slots stat of the owner (it can be changed by effects and equipment)
  • FIXED = 1 - A number of this style

enum CapacityFrom ​

Where the weight capacity comes from

  • STAT = 0 - The Carry Capacity stat of the owner
  • FIXED = 1 - A number of this style

enum OverLimit ​

What happens above the weight capacity

  • NONE = 0 - Nothing: the weight is only shown
  • HARD_LIMIT = 1 - Nothing more can be picked up above the limit
  • ENCUMBRANCE = 2 - Effects (slowed ...) come on in steps

Property descriptions ​

Space

Space space = Space.SLOTS ​

How items take space

SlotsFrom slots_from = SlotsFrom.STAT ​

Slots: where the number of them comes from

int fixed_slots = 20 ​

Slots: the number of them when it is fixed

int grid_width = 10 ​

Grid: how many cells wide

int grid_height = 6 ​

Grid: how many cells high

Weight

bool weight_enabled = false ​

Items have weight and the owner has a carry capacity

CapacityFrom capacity_from = CapacityFrom.STAT ​

Where the carry capacity comes from

float fixed_capacity = 100.0 ​

The carry capacity when it is fixed

bool count_worn_items = true ​

What the worn equipment weighs counts too

OverLimit over_limit = OverLimit.NONE ​

What happens above the capacity

float hard_limit_percent = 100.0 ​

Hard limit: how much of the capacity can be filled (100 = exactly the capacity)

Array[EncumbranceTier] encumbrance_steps = [] ​

Encumbrance: the steps, each with the share of the capacity it starts at and the effect that goes on

Method descriptions ​

EncumbranceTier get_step_for( percent: float ) ​

The highest step of encumbrance that a load of this many percent of the capacity has reached (null = none)

InventoryStyle for_npc() ​

No description yet.

InventoryStyle for_entity( entity: Entity ) ​

The style of the owner: an NPC has no limit; a player (and a companion) has the project's style for characters

Array[Dictionary] validate() ​

Checks the settings. Gives the problems found (empty when it is fine).