Inventory context

This commit is contained in:
Rendo 2025-10-16 22:05:24 +05:00
commit fed57e38df
17 changed files with 128 additions and 108 deletions

View file

@ -19,7 +19,7 @@ func _init() -> void:
super()
resize.call_deferred()
func add(stack : Stack) -> Stack:
func add(stack : Stack, _context: InventoryContext = null) -> Stack:
for i in range(input_capacity):
if input_array[i].can_be_merged(stack.held_item):
stack_added.emit(stack,i)
@ -28,10 +28,7 @@ func add(stack : Stack) -> Stack:
return null
return stack
func add_from_side(stack : Stack, _ang_diff : float) -> Stack:
return add(stack)
func can_add(item : Item = null) -> bool:
func can_add(item : Item = null, _context: InventoryContext = null) -> bool:
if item == null:
return false
else:
@ -40,8 +37,6 @@ func can_add(item : Item = null) -> bool:
return true
return false
func can_add_from_side(_ang_diff : float,item: Item = null) -> bool:
return can_add(item)
## Tries to take first item. Returns null if no items in inventory
func pop() -> Stack: