GridInventoryConstraint

Inherits: Resource

Script that can be extended to define add rules for GridInventory behaviors.

Description

This script is used in the FPS demo to have inventories with specialized slots like the campfire that only accepts burnables and food.

Methods

bool

_can_add_on_position(inventory: Node, position: Vector2i, item_id: String, amount: int, properties: Dictionary, is_rotated: bool) virtual


Method Descriptions

bool _can_add_on_position(inventory: Node, position: Vector2i, item_id: String, amount: int, properties: Dictionary, is_rotated: bool) virtual 🔗

Extended function that defines whether an item can be added or not to a grid position.

This script is used by GridInventory to define rules for adding items to the inventory.

It is used by default in GridInventory and can be extended to create custom behaviors.