feat(ai): ✨ Implement aggressive radius override in WildCreatureAI to enforce consistent detection behavior
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
parent
f3e6ac1b2d
commit
17b9d37ca5
1 changed files with 4 additions and 2 deletions
|
|
@ -13,6 +13,7 @@ const CombatResolverScript = preload("res://engine/src/modules/combat/combat_res
|
|||
|
||||
const DEFAULT_DETECTION_RADIUS: int = 4
|
||||
const DEFAULT_LEASH_RADIUS: int = 5
|
||||
const AGGRO_OVERRIDE_RADIUS: int = 8
|
||||
const ROAM_CHANCE: int = 40
|
||||
const CITY_DRIFT_CHANCE: int = 20
|
||||
|
||||
|
|
@ -92,10 +93,11 @@ func _act(
|
|||
|
||||
# Chase range can exceed leash, so search far enough that a chasing creature
|
||||
# can always find its home lair when it's time to return.
|
||||
var effective_detection: int = max(detection_radius, AGGRO_OVERRIDE_RADIUS)
|
||||
var home_pos: Vector2i = _find_nearest_lair(
|
||||
unit.position, leash_radius + detection_radius
|
||||
unit.position, leash_radius + effective_detection
|
||||
)
|
||||
var target: RefCounted = _find_attack_target(unit, detection_radius)
|
||||
var target: RefCounted = _find_attack_target(unit, effective_detection)
|
||||
|
||||
if target != null:
|
||||
# Step toward target, then attack if adjacent and still able.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue