From 17b9d37ca586966725c0aa851edb79d02d990cb6 Mon Sep 17 00:00:00 2001 From: autocommit Date: Thu, 16 Apr 2026 15:46:14 -0700 Subject: [PATCH] =?UTF-8?q?feat(ai):=20=E2=9C=A8=20Implement=20aggressive?= =?UTF-8?q?=20radius=20override=20in=20WildCreatureAI=20to=20enforce=20con?= =?UTF-8?q?sistent=20detection=20behavior?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Lilith Autocommit --- src/game/engine/src/modules/ai/wild_creature_ai.gd | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/game/engine/src/modules/ai/wild_creature_ai.gd b/src/game/engine/src/modules/ai/wild_creature_ai.gd index c79a3e59..c0450e5b 100644 --- a/src/game/engine/src/modules/ai/wild_creature_ai.gd +++ b/src/game/engine/src/modules/ai/wild_creature_ai.gd @@ -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.