test(scenes): Update auto-play test scenarios to reflect scene behavior changes

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
autocommit 2026-04-15 23:28:22 -07:00
parent 2c295628b1
commit ba116c791e

View file

@ -1271,14 +1271,37 @@ func _command_worker(unit: Variant, player: RefCounted, game_map: RefCounted) ->
best_dist = d
best_target = tpos
if best_target != Vector2i(-1, -1):
_move_toward(unit, best_target, game_map)
_worker_step_toward(unit, best_target, game_map)
return
if not player.cities.is_empty():
_move_toward(unit, player.cities[0].position, game_map)
_worker_step_toward(unit, player.cities[0].position, game_map)
else:
_explore(unit, player, game_map)
func _worker_step_toward(unit: Variant, target: Vector2i, game_map: RefCounted) -> void:
# Workers must step ONTO the target tile to build on it — do not use the
# attack-adjacent shortcut in _move_toward which skips movement entirely.
if unit.position == target:
return
var reachable: Dictionary = PathfinderScript.movement_range(
game_map, unit.position, unit.movement_remaining, "land"
)
if reachable.is_empty():
return
var best_pos: Vector2i = unit.position
var best_dist: int = HexUtilsScript.hex_distance(unit.position, target)
for pos: Vector2i in reachable:
if pos == unit.position:
continue
var dist: int = HexUtilsScript.hex_distance(pos, target)
if dist < best_dist:
best_dist = dist
best_pos = pos
if best_pos != unit.position:
_do_move(unit, best_pos, game_map)
func _nearest_city_to_target(player: RefCounted) -> RefCounted:
## Return the player's city closest to the locked attack target.
## Falls back to city[0] if no target is locked.