ax.item¶
Source: gamemode/framework/libraries/sh_item.lua
Item management system for creating, storing, and managing game items.
Documented functions: 7
Functions¶
ax.item:GetActionsForClass(class)ax.item:Initialize()ax.item:LoadBasesFromDirectory(basePath, timeFilter)ax.item:LoadItemsFromDirectory(path, timeFilter, prefix)ax.item:LoadItemsWithBase(dirPath, baseName, baseItem, timeFilter)ax.item:LoadItemsWithInheritance(path, timeFilter)ax.item:RefreshItemInstances()
ax.item:GetActionsForClass(class)¶
Get a merged action table for a class, including inherited base actions.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
class |
string |
The item class identifier |
Returns
table: actions
ax.item:Initialize()¶
Initialize the item system by loading all item files. Automatically includes items from framework, schema, and modules directories. Called during framework boot to set up all available items and refresh instances.
Realm: shared
Usage
ax.item:LoadBasesFromDirectory(basePath, timeFilter)¶
Load base items from a specific directory. First pass of item loading that sets up base items with the isBase flag. Base items serve as parent classes for other items to inherit from.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
basePath |
string |
The directory path containing base item files |
Usage
ax.item:LoadItemsFromDirectory(path, timeFilter, prefix)¶
Load regular items from a directory. Second pass of item loading that sets up regular items without inheritance. Items loaded here get default drop actions and are stored in the item registry.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
path |
string |
The directory path containing item files |
prefix |
string |
Optional prefix to add to item class names (e.g., "ammo_" or "weapon_") |
Usage
ax.item:LoadItemsWithBase(dirPath, baseName, baseItem, timeFilter)¶
Load items from a directory with inheritance from a specific base item. Loads items that inherit properties and methods from a specified base item. Items maintain their own identity while gaining base functionality.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
dirPath |
string |
The directory path containing items to inherit from base |
baseName |
string |
The name of the base item for reference |
baseItem |
table |
The base item table to inherit from |
Usage
ax.item:LoadItemsWithInheritance(path, timeFilter)¶
Load items from subdirectories with inheritance from base items. Third pass that loads items from subdirectories, checking for corresponding base items. If a base item exists, items inherit from it; otherwise they're loaded as regular items.
Realm: shared
Parameters
| Name | Type | Description |
|---|---|---|
path |
string |
The root directory path to search for subdirectories |
Usage
ax.item:RefreshItemInstances()¶
Refresh all existing item instances to reflect updated item definitions. Updates metatables of existing item instances to use the latest stored item definitions. Called automatically during initialization to ensure consistency after hot-reloading.
Realm: shared
Usage