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
|
|
@ -11,6 +11,10 @@ var capability_id: String = "standoff"
|
|||
|
||||
@export var preferred_range: float = 620.0
|
||||
@export var retreat_range_factor: float = 0.75
|
||||
# #69: kept comfortably beyond preferred_range so it still has room to close
|
||||
# in before settling at stand-off distance, but the fleet has to actually be
|
||||
# somewhere on the board first - see EnemyPursuitComponent's identical fix.
|
||||
@export var detection_range: float = 1200.0
|
||||
|
||||
var velocity: Vector2 = Vector2.ZERO
|
||||
|
||||
|
|
@ -22,7 +26,7 @@ func tick(delta: float) -> void:
|
|||
return
|
||||
var to_target: Vector2 = target.position - enemy.position
|
||||
var distance: float = to_target.length()
|
||||
if distance < 1.0:
|
||||
if distance < 1.0 or 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