Gate enemies behind a detection range instead of instant omniscient pursuit (#69)
Chasers (EnemyPursuitComponent) and snipers (EnemyStandoffComponent) used to beeline/close in from anywhere on the map the instant they spawned - no matter how far the fleet was, which read as omniscient rather than alert. Both now sit idle until the fleet is within their own detection_range. Artillery's slow drift is gated the same way, but reuses its own existing fire_range rather than a new tunable - outside its firing envelope it has nothing to be drifting toward yet. The enemy mothership deliberately keeps the opposite behaviour: it is meant to read as a persistent, unavoidable stalking threat, not a local sentry, so it gets its own EnemyPursuitComponentMothership.tscn variant with an effectively unlimited detection_range - the same scene-variant pattern EnemySpawnerComponentChaser/Artillery already use for per-definition property overrides on a shared component script.
This commit is contained in:
parent
8d089d6f76
commit
1de66c6fb2
6 changed files with 161 additions and 7 deletions
|
|
@ -56,6 +56,11 @@ func _drift(enemy: Node2D, delta: float) -> void:
|
|||
if fleet == null or fleet.ships.is_empty():
|
||||
return
|
||||
var to_fleet: Vector2 = fleet.get_centroid() - enemy.position
|
||||
# #69: gated by the same fire_range it already shells within, rather
|
||||
# than a second tunable that could drift out of sync - outside its own
|
||||
# firing envelope it has nothing to be drifting toward yet.
|
||||
if to_fleet.length() > fire_range:
|
||||
return
|
||||
if to_fleet.length() < 1.0:
|
||||
return
|
||||
enemy.position += to_fleet.normalized() * drift_speed * delta
|
||||
|
|
|
|||
Loading…
Reference in a new issue