#91: keep the gas source behind the fleet

On a gas planet the vents were drawn on top of the player. SurfaceFeatures
is added after Fleet in PlanetSurface.tscn, so at the default z_index of 0
the vent field won the tie purely by being the later sibling, and the fleet
flew under its own gas source.

Same one-line fix, for the same reason, as #50's capture rings and the
rocks on a rocky surface. It goes on the field rather than on children
because this one draws in its own _draw().

The test checks the rule instead of the node that was wrong: every drawing
feature, on every surface profile that has features, must end up behind the
fleet - 22 of them today, and any added later without editing the test.
Enemies are excluded and the test says why; they are combatants and share
the fleet's plane on purpose.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Loïc Wisniewski 2026-08-22 23:29:21 +02:00
commit 03b1c85569
3 changed files with 142 additions and 0 deletions

View file

@ -13,6 +13,14 @@ var vents: Array[Vector2] = []
var progress: float = 0.0
var emission_phase: float = 0.0
func _ready() -> void:
# #91: the vents are ground features and must never cover the fleet.
# SurfaceFeatures is added AFTER Fleet in PlanetSurface.tscn, so at the
# default z_index of 0 the later sibling simply wins and the player flies
# UNDER their own gas source. Same fix, and the same reason, as #50's
# capture rings and the rocks on a rocky surface (Rock.gd) - the
# difference is that this field draws in its own _draw() rather than
# spawning child nodes, so the depth belongs on the field itself.
z_index = -1
var rng := RandomNumberGenerator.new()
rng.seed = hash(GameState.planet_id if GameState.planet_id != "" else GameState.planet_name)
for i in range(6): vents.append(Vector2(rng.randf_range(-800,800), rng.randf_range(-650,650)))