#113: a wave converges on the nearest structure from any distance

A wave is an attack on what the player has built, not a hazard sitting in
space waiting to be flown near. Wave enemies now ignore the detection radius
their components otherwise respect and close on the nearest building from
wherever they arrived.

The flag is per INSTANCE rather than per definition: the same chaser is a
wave when the director launches it and a garrison when a map author places
it, and a planet garrison that chased the player across the system would be
a very different thing from what the editor is used to place. The test pins
both halves - a wave chaser 6000px out closed on a crafter, and an
identically built one nobody sent held its station.

What it fights on the way is unchanged: EnemyTargets already prefers a
vessel inside 520px over a building further off, and already searches the
player_ships group, so the fleet and an outpost's garrison both count.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Loïc Wisniewski 2026-08-23 21:38:09 +02:00
commit 1a2a27b6e8
6 changed files with 68 additions and 3 deletions

View file

@ -20,8 +20,13 @@ func tick(delta: float) -> void:
# #101: a structure is a target now, not scenery. EnemyTargets keeps a
# ship in the enemy's face ahead of a building further off.
var target: Node2D = EnemyTargets.nearest_target(self, enemy.global_position)
if target == null \
or enemy.global_position.distance_to(target.global_position) > detection_range:
if target == null:
return
# #113: a wave enemy closes on what the player built from wherever it
# arrived. Everything else keeps the radius that stops it reading as
# omniscient (#69).
if not EnemyTargets.ignores_range(enemy) \
and enemy.global_position.distance_to(target.global_position) > detection_range:
return
var to_target: Vector2 = target.global_position - enemy.global_position