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

@ -28,7 +28,11 @@ class_name InventorySlot
get:
return amount
## Get some amount of items from slot. Returns null if slot is empty
func extract_stack(extract_amount: int) -> Stack:
if amount == 0:
return null
var return_stack : Stack
if extract_amount > amount:
return_stack = Stack.new(held_item,amount)
@ -39,12 +43,17 @@ func extract_stack(extract_amount: int) -> Stack:
return return_stack
## Extract entire stack from slot. Returns null if slot is empty
func extract() -> Stack:
if amount == 0:
return null
var return_stack : Stack = Stack.new(held_item,amount)
self.amount = 0
return return_stack
## Add provided stack's amount to this amount. Returns null if stack is empty or items arent matching
func merge_stack(stack: Stack) -> Stack:
if held_item == null:
held_item = stack.held_item