Inventory context
This commit is contained in:
parent
d413c211b5
commit
fed57e38df
17 changed files with 128 additions and 108 deletions
27
scripts/inventory/splitter_inventory.gd
Normal file
27
scripts/inventory/splitter_inventory.gd
Normal file
|
@ -0,0 +1,27 @@
|
|||
@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()
|
Loading…
Add table
Add a link
Reference in a new issue