sunder/scripts/entities/components/inventory.gd

24 lines
526 B
GDScript3
Raw Permalink Normal View History

2026-02-17 23:36:57 -05:00
class_name Inventory extends Node3D
# weapons, tuple of 3 unique weapons
# flag, object
# grenades, typed array of max 2 grenade resources
@export_range(-1, 2) var cursor: int = -1
@export var loadout:Loadout
@onready var weapons:Node3D = $Weapons
func _ready() -> void:
if loadout and multiplayer.is_server():
for weapon in loadout.weapons:
weapons.add_child(weapon.instantiate())
#func _on_primary() -> void:
#equipped.trigger()
func clear() -> void:
for child in weapons.get_children():
child.queue_free()