extends Node2D # Preloaded by path rather than an `is CapturePoint` check - this preview # runs through screenshot.sh, which (unlike run_tests.sh) does not run an # import pass first, so the global class_name cache may not be warm yet. const CAPTURE_POINT_SCRIPT = preload("res://surface/CapturePoint.gd") func _ready() -> void: GameState.planet_name = "Kepler's Rest" GameState.planet_id = "chunk:3:7" GameState.planet_definition_id = "rocky" GameState.surviving_ship_count = 3 GameState.rocks = 128 var surface: Node = load("res://surface/PlanetSurface.tscn").instantiate() surface.get_node("SurfaceController").fade_duration = 0.0 add_child(surface) # Zoomed out so all three ~220-radius capture rings fit the frame with # margin, regardless of wherever the real setup's points happen to sit. surface.get_node("Camera2D").zoom = Vector2(0.55, 0.55) var host: Node = surface.get_node("SurfaceFeatures/PlanetSetupHost") var points: Array = [] for child in host.get_children(): if child.get_script() == CAPTURE_POINT_SCRIPT: points.append(child) # Lay the three points out in a compact, clearly-separated triangle for # the screenshot, rather than the real (far-flung) authored positions. # Point 0 sits at the origin - exactly where the fleet spawns - so the # screenshot also proves the #50 z_index fix: the ring must not occlude # the ships parked on top of it. var layout: Array = [Vector2(0, 0), Vector2(-300, 150), Vector2(300, -200)] for i in range(mini(points.size(), layout.size())): points[i].position = layout[i] # Show all three states at once: captured, mid-fill, and blocked. Each # point's own _process() would otherwise immediately recompute state # from the real (empty, this far from any ship) fleet/enemy proximity # and overwrite these on the very next frame, so freeze it after setting # the display state - same technique as freezing enemy.speed for the # gas bomber screenshot. if points.size() >= 1: points[0].mark_captured() points[0].set_process(false) GameState.mark_point_captured(GameState.planet_id, points[0].point_index) if points.size() >= 2: points[1].state = CAPTURE_POINT_SCRIPT.State.CAPTURING points[1].progress = 0.55 points[1].queue_redraw() points[1].set_process(false) if points.size() >= 3: points[2].state = CAPTURE_POINT_SCRIPT.State.BLOCKED points[2].progress = 0.3 points[2].queue_redraw() points[2].set_process(false)