Show the laser's whole reach while aiming

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019AJMdB7iuHuLFZM1aBu3GD
This commit is contained in:
Loïc Wisniewski 2026-09-04 23:20:29 +02:00
commit a902fddba0
4 changed files with 70 additions and 7 deletions

View file

@ -12,6 +12,11 @@ func _ready() -> void:
GameState.extractors.clear()
GameState.transporters.clear()
GameState.vessel_levels["unlock_laser"] = 1
GameState.intro_active = false
# A shot the fleet cannot pay for is refused before aiming starts, so
# without this the preview drew no guide at all - the state it exists
# to show. Deposited before Main is built, like test_laser_vessel.gd.
GameState.deposit_fleet_resource(GameState.RESOURCE_ENERGY, 40)
var main: Node = load("res://world/Main.tscn").instantiate()
add_child(main)
main.get_node("BackgroundLayer").visible = false
@ -21,14 +26,17 @@ func _ready() -> void:
main.get_node("EnemySpawner").set_process(false)
main.get_node("AsteroidField").set_process(false)
var fleet: Node = main.get_node("Fleet")
fleet.spawn_ships(4, Vector2.ZERO, PackedStringArray([
GameState.VESSEL_INTERCEPTOR, GameState.VESSEL_SHIELD,
GameState.VESSEL_LASER, GameState.VESSEL_LASER]))
# Three, not four: the starting fleet holds three hulls until the skill
# tree widens it, and a fourth entry was silently dropped - which took the
# ready laser with it and left this preview with nothing to aim.
fleet.spawn_ships(3, Vector2.ZERO, PackedStringArray([
GameState.VESSEL_SHIELD, GameState.VESSEL_LASER,
GameState.VESSEL_LASER]))
var skill: Node = main.get_node("LaserController")
skill._process(0.0)
# Show both per-ship states in one frame: one laser ship rearming, the
# other ready and supplying the shot.
var rearming: Node = fleet.ships[2].get_component("laser")
var rearming: Node = fleet.ships[1].get_component("laser")
rearming.consume_shot()
rearming.tick(rearming.cooldown_duration * 0.5)
main.get_node("Camera2D").zoom = Vector2(1.8, 1.8)