trash can

This commit is contained in:
Rendo 2025-10-16 22:21:30 +05:00
commit 39c52694da
11 changed files with 57 additions and 5 deletions

View file

@ -53,11 +53,11 @@ func add(stack: Stack, _context: InventoryContext = null) -> Stack:
func can_add(item : Item = null, _context: InventoryContext = null) -> bool:
if item == null:
for i in range(internal_array):
for i in range(capacity):
return internal_array[i].amount == 0
return false
else:
for i in range(internal_array):
for i in range(capacity):
if internal_array[i].amount == 0:
return (internal_array[i].filter != null and internal_array[i].filter.is_equal(item)) or internal_array[i].filter == null
return internal_array[i].held_item.is_equal(item)

View file

@ -0,0 +1,9 @@
extends StructureBehaviour
@onready var inventory : Storage = structure_parent.inventory
func _ready() -> void:
inventory.stack_added.connect(on_stack_added)
func on_stack_added(_stack : Stack, _position: int) -> void:
inventory.internal_array[0].amount = 0

View file

@ -0,0 +1 @@
uid://dwx8y8c6guldd