Grid
📐 Grid Class
A grid system for managing item placement in inventory spaces.
Namespace:
Esper.Inventool
Access:
public
Type:
class
📦 Fields
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
public
Grid(int width, int height)
Creates a new grid with specified dimensions.
🧰 Methods
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.
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
public
coordinate
Vector2Int
Gets the coordinate as a Vector2Int.
Constructors
public
Placement(int x, int y, bool isRotated, int pageIndex, List<int> occupiedSlots)
Creates a new Placement with the specified values.
Last updated