Items

Inventory System

class InventoryReader: Instance
size: integer

Number of slots in this InventoryReader

get(self: InventoryReader, index: integer): ItemData

Get ItemData with index from InventoryReader

find(self: InventoryReader, item: StaticItem): (index: integer)

Looking for index of StaticItem in InventoryReader

Returns:

index (integer) – of found item or -1

staticmethod new(parent: Object, name: string): InventoryReader

Creates a new InventoryReader instance

Parameters:
  • parent (Object) – Object of parent

  • name (string) – The name of the instance

staticmethod new_simple(): InventoryReader

Creates a new InventoryReader instance

staticmethod get_class(): Class

Return InventoryReader class object

staticmethod cast(object: Object): InventoryReader

Trying to cast Object into InventoryReader

Parameters:

object (Object) – to cast

class InventoryAccess: InventoryReader
zero_slots: boolean

undocumented

add(
    self: InventoryAccess,
    item: StaticItem,
    count: integer
): (Remainder: integer)

Add item with count to InventoryAccess

sub(
    self: InventoryAccess,
    item: StaticItem,
    count: integer
): (Remainder: integer)

Remove item with count from InventoryAccess

class BaseInventory: InventoryAccess
class Inventory: BaseInventory
class InventoryContainer: InventoryAccess
class AutosizeInventory: Inventory
class SingleSlotInventory: BaseInventory
capacity: integer

undocumented

Item Representation

class ItemData: Struct
count: integer

undocumented

item: StaticItem

undocumented

class StaticItem: Prototype
image: Texture

Item image in UI

stack_size: integer

Size of item stack

tier: integer

Item unlock tier

unit_mul: number

multiplier for UI

mesh: StaticMesh

Mesh for item rendering in world

block: StaticObject

Buildable object pointer for this item

custom_data: bool

Is item instance contains CustomData

logic: Class

Class for item while in hand

lua: table

undocumented

tags: string

undocumented

category: string

In-game database category

label: Loc

undocumented

description_parts: Loc[]

undocumented

staticmethod reg(name: string): StaticItem

Register a new StaticItem static object

Parameters:

name (string) – The name of the object

staticmethod find(name: string): StaticItem

Searching for StaticItem in db

Parameters:

name (string) – The name of the object

staticmethod get_class(): Class

Return StaticItem class object

staticmethod cast(object: Object): StaticItem

Trying to cast Object into StaticItem

Parameters:

object (Object) – to cast

Filtering

class InventoryFilter: Instance
staticmethod new(parent: Object, name: string): InventoryFilter

Creates a new InventoryFilter instance

Parameters:
  • parent (Object) – Object of parent

  • name (string) – The name of the instance

staticmethod new_simple(): InventoryFilter

Creates a new InventoryFilter instance

staticmethod get_class(): Class

Return InventoryFilter class object

staticmethod cast(object: Object): InventoryFilter

Trying to cast Object into InventoryFilter

Parameters:

object (Object) – to cast

class InventoryWhiteFilter: InventoryFilter
class InventoryBlackFilter: InventoryFilter
class InventoryInventoryFilter: InventoryFilter
inventory: InventoryAccess

(nil by default)

is_filtering: boolean

is filtering enabled (true by default)

is_white: boolean

is white filtering enabled (true by default)