Thieves go straight for loose loot in clear view, however far

With #21's animals roaming the whole (now 60 x 80) farm, an animal
thief whose loose target was beyond direct_seek_distance followed the
pen's flow field away from it and gave up after 10 s. Loot away from
home has no home area to head for, so any clear line to it now counts.
Fixes test_roster "a thief walks in through the gap it opened and
takes an animal" on the merged #20 + #21 tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Forrest 2026-10-06 13:22:21 -04:00
parent 11d19d874a
commit 55ebae4058

View file

@ -238,7 +238,10 @@ func _seek(es: EnemySystem, i: int, dt: float) -> void:
return
es.pace[i] = 1.0
var field := field_for(unit)
if (area_for(loot.category[unit], goal).has_point(p) or d < cfg.direct_seek_distance) and nav.line_clear(p.x, p.y, goal.x, goal.y):
# Loot away from home (a loose animal roaming the farm, a dropped item) has no home area to
# head for, so any clear line to it will do, however far.
var near := not loot.is_home(unit) or area_for(loot.category[unit], goal).has_point(p) or d < cfg.direct_seek_distance
if near and nav.line_clear(p.x, p.y, goal.x, goal.y):
es.desire_x[i] = to.x / d
es.desire_z[i] = to.y / d
es.timer[i] = 0.0