delurbelako/scripts/inventory/stack.gd
2025-10-15 17:56:18 +05:00

22 lines
455 B
GDScript

extends RefCounted
## Structure of item and amount of it. Basic object that more complex exchange
class_name Stack
func _init(item: Item = null, amount: int = 0) -> void:
held_item = item
self.amount = amount
## Item in stack
@export_storage var held_item : Item
## Amount of items in stack
@export_storage var amount : int
func invalidate() -> void:
held_item = null
amount = 0
func is_valid() -> bool:
return held_item != null or amount > 0