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:
parent
f7310e8d14
commit
cb899d1ab4
1 changed files with 3 additions and 1 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 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.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue