Table of Contents

Class StorageEvents

Namespace
S1API.Storage
Assembly
S1API.dll
public static class StorageEvents
Inheritance
StorageEvents
Inherited Members

Events

OnStorageCreated

Event raised after a storage entity is created and initialized in the world. This event fires when storage items are placed by the player.

public static event Action<StorageEventArgs> OnStorageCreated

Event Type

Action<StorageEventArgs>

Remarks

Use this event to customize storage properties when items are placed. This is the primary event for expanding storage slots on placement.

OnStorageLoading

Event raised before items are loaded into storage from a save file. Use this event to expand storage slots to accommodate saved items.

public static event Action<StorageLoadingEventArgs> OnStorageLoading

Event Type

Action<StorageLoadingEventArgs>

Remarks

This event is critical for save compatibility when you've expanded storage slots. Check args.NeedsMoreSlots to determine if expansion is required.

OnStorageOpening

Event raised just before the storage menu opens for a storage entity. Use this event to update the display name or perform other pre-open actions.

public static event Action<StorageEventArgs> OnStorageOpening

Event Type

Action<StorageEventArgs>

Examples

// Ensure custom names are displayed when opening storage
StorageEvents.OnStorageOpening += (args) =>
{
    args.Storage.SyncCustomNameToDisplayName();
};

Remarks

This event is useful for syncing custom names (set via clipboard) to the display name. The base game's StorageMenu uses StorageEntityName for display, but custom names are stored separately in Configuration.Name. Subscribe to this event and call SyncCustomNameToDisplayName() to ensure custom names are shown.