#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:
parent
7a78d1b1a6
commit
1a2a27b6e8
6 changed files with 68 additions and 3 deletions
|
|
@ -27,7 +27,10 @@ func tick(delta: float) -> void:
|
|||
return
|
||||
var to_target: Vector2 = target.global_position - enemy.global_position
|
||||
var distance: float = to_target.length()
|
||||
if distance < 1.0 or distance > detection_range:
|
||||
if distance < 1.0:
|
||||
return
|
||||
# #113: see EnemyPursuitComponent - a wave arrives with somewhere to be.
|
||||
if not EnemyTargets.ignores_range(enemy) and distance > detection_range:
|
||||
return
|
||||
var direction: Vector2 = to_target / distance
|
||||
var retreat_range: float = preferred_range * retreat_range_factor
|
||||
|
|
|
|||
Loading…
Reference in a new issue