Documentation
This commit is contained in:
parent
66a623e568
commit
23b6e5d180
5 changed files with 34 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue