From 5b2dd77e47b787d84889430b396e7d1f3e410d68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Wisniewski?= Date: Sat, 15 Aug 2026 22:47:44 +0200 Subject: [PATCH] Draw capture points behind fleet vessels (#50) CapturePoint.gd left z_index at its default 0, the same layer Ship draws on, so a ship parked inside a ring was partly swallowed by the ring fill - exactly where the player most needs to see their own vessels. Set z_index = -1, matching the convention every other world object already follows (Planet, Rock, Building, Hauler, Transporter, VesselDelivery). Verified with a ship placed directly on a capture point in the preview screenshot, and asserted in test_capture_points.gd. --- CapturePoint.gd | 6 ++++++ tests/_capture_points_preview.gd | 5 ++++- tests/test_capture_points.gd | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CapturePoint.gd b/CapturePoint.gd index eb1f447..6b138cd 100644 --- a/CapturePoint.gd +++ b/CapturePoint.gd @@ -28,6 +28,12 @@ var state: int = State.NEUTRAL func _ready() -> void: + # Behind the fleet and enemies, same convention as every other world + # object that must never occlude them (Planet.gd, Rock.gd, Building.gd, + # Hauler.gd, Transporter.gd, VesselDelivery.gd all set this in _ready()). + # "Is an enemy inside my capture radius" is the core read of this + # mechanic, so a ship or enemy sitting in the ring must stay fully visible. + z_index = -1 queue_redraw() diff --git a/tests/_capture_points_preview.gd b/tests/_capture_points_preview.gd index 29a3ddf..2de5d21 100644 --- a/tests/_capture_points_preview.gd +++ b/tests/_capture_points_preview.gd @@ -28,7 +28,10 @@ func _ready() -> void: # Lay the three points out in a compact, clearly-separated triangle for # the screenshot, rather than the real (far-flung) authored positions. - var layout: Array = [Vector2(300, 150), Vector2(-300, 150), Vector2(0, -280)] + # 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] diff --git a/tests/test_capture_points.gd b/tests/test_capture_points.gd index 1f281b7..12ffc86 100644 --- a/tests/test_capture_points.gd +++ b/tests/test_capture_points.gd @@ -197,6 +197,8 @@ func _process(delta: float) -> bool: # through the build UI here to avoid duplicating that coverage. if not game_state.is_planet_conquered(planet_id): return _fail("single-point planet was not marked conquered") + if point.z_index >= 0: + return _fail("capture point does not draw behind the fleet/enemies (z_index=%d)" % point.z_index) print("TEST_CAPTURE_POINTS: PASS") quit(0)