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)