Class ItemManager
Provides access to managing items across the game.
public static class ItemManager
- Inheritance
-
ItemManager
- Inherited Members
Methods
EnsureItemRegistered(ItemDefinition)
Registers an item only when it is missing from the active game registry.
public static bool EnsureItemRegistered(ItemDefinition definition)
Parameters
definitionItemDefinitionThe item definition to register.
Returns
- bool
True if the item is registered after the call; otherwise, false.
GetAllItemDefinitions()
Gets all item definitions registered in the game's registry.
public static List<ItemDefinition> GetAllItemDefinitions()
Returns
- List<ItemDefinition>
A list of all registered item definitions, wrapped with S1API types.
GetDefinition(string)
Gets the definition of an item by its ID.
public static ItemDefinition? GetDefinition(string itemID)
Parameters
itemIDstringThe ID of the item.
Returns
- ItemDefinition
An instance of the item definition.
GetItemDefinition(string)
Gets the definition of an item by its ID.
[Obsolete("Use S1API.Items.ItemManager.GetDefinition instead.")]
public static ItemDefinition GetItemDefinition(string itemID)
Parameters
itemIDstringThe ID of the item.
Returns
- ItemDefinition
An instance of the item definition.
IsItemRegistered(string)
Checks whether an item ID is present in the active game registry.
public static bool IsItemRegistered(string itemID)
Parameters
itemIDstringThe ID of the item to look up.
Returns
- bool
True if the item is registered; otherwise, false.
PreserveRuntimeItem(ItemDefinition)
Prevents a runtime-registered item from being removed during the next scene transition. This is useful for items that must survive a menu-to-game load sequence.
public static bool PreserveRuntimeItem(ItemDefinition definition)
Parameters
definitionItemDefinitionThe item definition to preserve.
Returns
- bool
True if the item was removed from the runtime cleanup queue, false otherwise.
RegisterItem(ItemDefinition)
Manually registers an item definition with the game's registry. This is typically handled automatically by ItemCreator methods, but can be used for advanced scenarios.
public static void RegisterItem(ItemDefinition definition)
Parameters
definitionItemDefinitionThe item definition to register.
UnregisterItem(string)
Removes an item definition from the registry by ID.
public static bool UnregisterItem(string itemID)
Parameters
itemIDstringThe ID of the item to remove.
Returns
- bool
True if the item existed and was removed, false otherwise.