Documentation

This commit is contained in:
Rendo 2025-10-12 16:41:34 +05:00
commit 23b6e5d180
5 changed files with 34 additions and 0 deletions

View file

@ -1,22 +1,28 @@
@abstract
extends Resource
## Class that can hold items in it
class_name Inventory
func _init() -> void:
resource_local_to_scene = true
## Tries to add an item into inventory. Returns not stored stack of item.
@abstract
func add(item : Stack) -> Stack
## Tries to take first item. Returns null if no items in inventory
@abstract
func pop() -> Stack
## Tries to take certain item from inventory. Returns null if no item found
@abstract
func take(item : Item,amount: int) -> Stack
## Finds first entry of item. Returns -1 if no item found
@abstract
func find(item : Item) -> int
## Does inventory have certain item?
func has(item : Item) -> bool:
return find(item) != -1