Table of Contents

Class StorageEntity

Namespace
S1API.Storage
Assembly
S1API.dll

Represents a storage entity in the game world. Provides cross-runtime safe manipulation of storage slots and properties.

public sealed class StorageEntity
Inheritance
StorageEntity
Inherited Members
Extension Methods

Remarks

This is the structural layer: it owns slot topology changes (add/remove/set count), display row adjustments, and placeable storage IO-slot wiring while handling Il2Cpp/Mono differences. Use this when modifying capacity or layout. For runtime interaction with an existing storage instance (metadata, item add/remove, events), prefer StorageInstance.

Properties

CustomName

Gets or sets the custom name set by the player via the management clipboard. Returns null if this is not placeable storage or no custom name is set. Setting this value updates the Configuration.Name field which persists to save files.

public string CustomName { get; set; }

Property Value

string

Remarks

This is different from Name which is the base StorageEntityName. CustomName reflects the user-editable name shown in the clipboard UI. When a player renames storage via the clipboard, this property is updated.

DisplayRowCount

Number of rows to display in the storage UI. Automatically set to 2 when SlotCount exceeds 6.

public int DisplayRowCount { get; set; }

Property Value

int

HasCustomName

Gets whether this storage has a custom name set by the player.

public bool HasCustomName { get; }

Property Value

bool

IsPlaceable

Whether this storage entity is placeable in the world.

public bool IsPlaceable { get; }

Property Value

bool

ItemId

The item ID of the storage container. Convenience property for filtering by storage type. Returns null if this storage is not placeable.

public string ItemId { get; }

Property Value

string

ItemInstance

The item instance this storage is part of (e.g., the storage rack item). Returns null if this storage is not placeable.

public ItemInstance ItemInstance { get; }

Property Value

ItemInstance

MaxSlots

Maximum number of slots this storage can have. Default is 20 for most storage types.

public int MaxSlots { get; set; }

Property Value

int

Name

The display name of this storage container shown in the UI.

public string Name { get; set; }

Property Value

string

SlotCount

Current number of slots in this storage container. Setting this value will add or remove slots as needed.

public int SlotCount { get; set; }

Property Value

int

SlotsAreFilterable

Whether slots in this storage are filterable (can restrict item types).

public bool SlotsAreFilterable { get; }

Property Value

bool

Methods

AddSlots(int)

Adds the specified number of slots to this storage container. Automatically updates input/output slots for placeable storage.

public bool AddSlots(int count)

Parameters

count int

Number of slots to add (must be positive)

Returns

bool

True if slots were added successfully

Remarks

This method handles all runtime-specific logic internally. Display row count is automatically adjusted for > 6 slots.

GetEmptySlotCount()

Gets the number of empty slots in this storage.

public int GetEmptySlotCount()

Returns

int

GetOccupiedSlotCount()

Gets the number of occupied slots in this storage.

public int GetOccupiedSlotCount()

Returns

int

HasItems()

Checks if this storage has any items in it.

public bool HasItems()

Returns

bool

IsEmpty()

Checks if this storage is completely empty.

public bool IsEmpty()

Returns

bool

RemoveSlots(int)

Removes the specified number of slots from this storage container. Only removes empty slots from the end.

public bool RemoveSlots(int count)

Parameters

count int

Number of slots to remove (must be positive)

Returns

bool

True if slots were removed successfully

Remarks

This method will fail if any of the slots to be removed contain items. Always check slot contents before removing.

SetSlotCount(int)

Sets the total number of slots, expanding or contracting as needed.

public bool SetSlotCount(int targetSlotCount)

Parameters

targetSlotCount int

Target number of slots

Returns

bool

True if operation was successful

SyncCustomNameToDisplayName()

Synchronizes the StorageEntityName with the custom name from Configuration. Call this before opening the storage menu to ensure the custom name is displayed.

public void SyncCustomNameToDisplayName()

Remarks

The base game's StorageMenu uses StorageEntityName for display, but custom names set via the clipboard are stored in Configuration.Name. This method syncs them.