feat(ai): Introduce predator detection logic for WildCreatureAI with sensing and evasion behaviors

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
autocommit 2026-04-16 11:29:46 -07:00
parent f7310e8d14
commit cb899d1ab4

View file

@ -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 PREDATOR_RADIUS: int = 5
const ROAM_CHANCE: int = 40
var _rng: RandomNumberGenerator = RandomNumberGenerator.new()
@ -94,7 +95,8 @@ func _act(
var home_pos: Vector2i = _find_nearest_lair(
unit.position, leash_radius + detection_radius
)
var target: RefCounted = _find_attack_target(unit, detection_radius)
var predator_scan: int = max(detection_radius, PREDATOR_RADIUS)
var target: RefCounted = _find_attack_target(unit, predator_scan)
if target != null:
# Step toward target, then attack if adjacent and still able.