extends Node2D # TODO: implement add_weapon ## Shortcut to get_parent() @onready var ship: Ship = get_parent() ## List of weapons @onready var list: Array[Node] = get_children() as Array[Node] ## Updates list with actual children of this node func update_weapon_list() -> void: list = get_children() as Array[Node] ## Removes weapon with given ID func remove_weapon(id: String) -> void: for weapon in list: if weapon.id == id: list.erase(weapon) weapon.free() break update_weapon_list() ## Adds weapon with given ID to list func add_weapon(_id: String) -> void: pass ## Returns a reference to weapon with given id if it exists, otherwise returns null func get_weapon(id: String) -> Weapon: for weapon in list: if weapon.id == id: return weapon as Weapon return null