extends Node const GAME := preload("res://scenes/game/game.tscn") const GENERATOR := preload("res://scripts/items/item_generator.gd") func _ready() -> void: GameState.start_new_run() var game := GAME.instantiate() add_child(game) game.set_physics_process(false) var ship := game.get_node("PlayerShip") ship.set_physics_process(false) ship.get_node("WeaponController").set_physics_process(false) for enemy in get_tree().get_nodes_in_group("enemies"): enemy.set_physics_process(false) var inventory: ShipInventory = ship.get_node("ShipInventory") for definition in GENERATOR.DEFINITIONS: assert(definition.icon != null) assert(definition.icon.get_width() == definition.icon.get_height()) if definition.item_id in ["reinforced_shield", "hull_plating", "engine_extension", "compact_generator", "ship_computer", "beam_laser", "machine_gun", "plasma_cannon", "missile_launcher", "unguided_missile"]: assert(inventory.add_item(GENERATOR.generate_for_definition(definition, 8))) var category_index := ShipInventory.MODULE_CATEGORIES.find(definition.category) if category_index >= 0 and inventory.module_slots[category_index] == null: var item := GENERATOR.generate_for_definition(definition, 8) assert(inventory.add_item(item)) assert(inventory.move_item("cargo", inventory.cargo.find(item), "module", category_index)) var hud := game.get_node("HUD") hud._toggle_inventory() await get_tree().create_timer(0.3).timeout var slots: Array = hud.inventory_panel.get_node("Contents/CargoGrid").get_children() for slot in slots: assert(is_equal_approx(slot.size.x, slot.size.y)) var item := inventory.get_item("cargo", slot.slot_index) if item != null: assert(slot.get_node("ItemIcon").texture == item.definition.icon) assert(not slot.get_node("SlotLabel").visible) var style: StyleBoxFlat = slot.get_theme_stylebox("panel") assert(style.bg_color == item.get_background_color()) assert(style.border_color == item.get_type_color()) print("ITEM_ICONS_TEST: PASS square textures and slots, icon assignment, rarity backgrounds and borders, inventory and equipment")