27 lines
529 B
GDScript
27 lines
529 B
GDScript
@tool
|
|
|
|
extends Inventory
|
|
|
|
@export var capacity : int:
|
|
set(value):
|
|
if value < 0:
|
|
return
|
|
if value == capacity:
|
|
return
|
|
capacity = value
|
|
get:
|
|
return capacity
|
|
|
|
@export_storage var upper_array : Array[InventorySlot]
|
|
@export_storage var down_array : Array[InventorySlot]
|
|
|
|
func _init() -> void:
|
|
super()
|
|
deferred_init.call_deferred()
|
|
|
|
func deferred_init():
|
|
upper_array.resize(capacity)
|
|
down_array.resize(capacity)
|
|
for i in range(capacity):
|
|
upper_array[i] = InventorySlot.new()
|
|
down_array[i] = InventorySlot.new()
|