2026-08-15 10:12:33 +02:00
|
|
|
extends SceneTree
|
|
|
|
|
|
|
|
|
|
var main: Node
|
|
|
|
|
var fleet: Node
|
|
|
|
|
var skill: GasBombController
|
|
|
|
|
var elapsed := 0.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _initialize() -> void:
|
|
|
|
|
var state: Node = root.get_node("GameState")
|
|
|
|
|
state.buildings.clear()
|
|
|
|
|
state.extractors.clear()
|
|
|
|
|
state.transporters.clear()
|
|
|
|
|
state.vessel_levels["unlock_gas_bomber"] = 1
|
|
|
|
|
main = load("res://Main.tscn").instantiate()
|
|
|
|
|
root.add_child(main)
|
|
|
|
|
fleet = main.get_node("Fleet")
|
|
|
|
|
skill = main.get_node("GasBombController")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _process(delta: float) -> bool:
|
|
|
|
|
elapsed += delta
|
|
|
|
|
if elapsed < 0.2:
|
|
|
|
|
return false
|
|
|
|
|
main.get_node("EnemySpawner").set_process(false)
|
|
|
|
|
main.get_node("AsteroidField").set_process(false)
|
|
|
|
|
fleet.spawn_ships(2, Vector2.ZERO, PackedStringArray([
|
|
|
|
|
GameState.VESSEL_GAS_BOMBER, GameState.VESSEL_GAS_BOMBER]))
|
|
|
|
|
skill._process(0.0)
|
|
|
|
|
var first: Node = fleet.ships[0].get_component("gas_bomber")
|
|
|
|
|
var second: Node = fleet.ships[1].get_component("gas_bomber")
|
|
|
|
|
if not first.is_ready() or not second.is_ready() or not skill.button.enabled:
|
|
|
|
|
return _fail("two fresh bombers did not each begin ready")
|
|
|
|
|
|
|
|
|
|
skill.aim_target = Vector2(500, 0)
|
|
|
|
|
skill._fire()
|
|
|
|
|
skill._process(0.0)
|
|
|
|
|
if first.is_ready() or not second.is_ready() or not skill.button.enabled:
|
|
|
|
|
return _fail("the first shot disabled more than its firing bomber")
|
2026-08-15 10:41:24 +02:00
|
|
|
if not first._filled_hull(fleet.ships[0].definition.hull_points, 0.0).is_empty() \
|
|
|
|
|
or first._filled_hull(fleet.ships[0].definition.hull_points, 0.5).size() < 3:
|
|
|
|
|
return _fail("bomber cooldown did not produce an empty-to-filling hull")
|
2026-08-15 10:12:33 +02:00
|
|
|
if skill.projectiles.size() != 1:
|
|
|
|
|
return _fail("the first bomber did not launch exactly one projectile")
|
|
|
|
|
|
|
|
|
|
skill.aim_target = Vector2(-500, 0)
|
|
|
|
|
skill._fire()
|
|
|
|
|
skill._process(0.0)
|
|
|
|
|
if first.is_ready() or second.is_ready() or skill.button.enabled:
|
|
|
|
|
return _fail("the skill stayed available after both bombers fired")
|
|
|
|
|
if skill.projectiles.size() != 2:
|
|
|
|
|
return _fail("independent bombers could not have shots in flight together")
|
|
|
|
|
|
|
|
|
|
# Rearming one bomber restores one available shot without touching the
|
|
|
|
|
# other bomber's cooldown.
|
|
|
|
|
first.tick(GasBombController.COOLDOWN)
|
|
|
|
|
skill._process(0.0)
|
|
|
|
|
if not first.is_ready() or second.is_ready() or not skill.button.enabled:
|
|
|
|
|
return _fail("one completed cooldown did not restore exactly one shot")
|
|
|
|
|
print("TEST_GAS_BOMBER_COOLDOWNS: PASS")
|
|
|
|
|
quit(0)
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _fail(message: String) -> bool:
|
|
|
|
|
print("TEST_GAS_BOMBER_COOLDOWNS: FAIL (%s)" % message)
|
|
|
|
|
quit(1)
|
|
|
|
|
return true
|