Grid

📐 Grid Class

A grid system for managing item placement in inventory spaces.

Namespace: Esper.Inventool

Access: public

Type: class


📦 Fields

Access
Field
Type
Description

public

width

int

The width of the grid.

public

height

int

The height of the grid.

public

cells

bool[,]

A 2D array representing grid cells.


🔧 Constructors

Access
Constructor
Description

public

Grid(int width, int height)

Creates a new grid with specified dimensions.


🧰 Methods

Access
Method
Returns
Description

public

IsEmpty()

bool

Checks if the grid is completely empty. Returns true if no cells are occupied, false otherwise.

public

CanPlaceItem(int x, int y, ItemStack itemStack, bool rotated)

bool

Checks if an item can be placed at the specified position. Returns true if the item can be placed, false otherwise.

public

PlaceItem(int x, int y, ItemStack itemStack, bool rotated)

void

Places an item on the grid at the specified position and marks the occupied cells.

public

FindPlacement(ItemStack itemStack)

(int x, int y, bool rotated)?

Finds the first available placement for an item. Returns the coordinates and rotation, or null if no placement is found.


🧩 Nested Types

Placement

A struct representing item placement data.

Access
Field
Type
Description

public

x

int

The X coordinate of the placement.

public

y

int

The Y coordinate of the placement.

public

isRotated

bool

Whether the item is rotated in this placement.

public

pageIndex

int

The page index of the placement.

public

occupiedSlots

List<int>

List of slot indices occupied by this placement.

Properties

Access
Property
Type
Description

public

coordinate

Vector2Int

Gets the coordinate as a Vector2Int.

Constructors

Access
Constructor
Description

public

Placement(int x, int y, bool isRotated, int pageIndex, List<int> occupiedSlots)

Creates a new Placement with the specified values.

Last updated