Goto Micro AI: add remove_movement option

By default, the MAI removes movement points from units even when they cannot find a hex to move to.  When this option is set to 'no' (default is 'yes'), this step is skipped, so that other candidate actions can take over.

This implements feature request #5580
This commit is contained in:
mattsc 2021-03-03 12:49:35 -08:00
parent 7e8cedaea8
commit ea4657c6d4
2 changed files with 5 additions and 2 deletions

View file

@ -227,9 +227,12 @@ function ca_goto:execution(cfg, data)
end
end
local remove_movement = cfg.remove_movement
if (remove_movement == nil) then remove_movement = true end
if closest_hex then
AH.checked_move_full(ai, best_unit, closest_hex[1], closest_hex[2])
else
elseif remove_movement then
AH.checked_stopunit_moves(ai, best_unit)
end

View file

@ -24,7 +24,7 @@ wesnoth.micro_ais["goto"] = function(cfg)
local required_keys = { "[filter_location]" }
local optional_keys = {
"[avoid]", "avoid_enemies", "[filter]", "ignore_units", "ignore_enemy_at_goal",
"release_all_units_at_goal", "release_unit_at_goal", "unique_goals", "use_straight_line"
"release_all_units_at_goal", "release_unit_at_goal", "remove_movement", "unique_goals", "use_straight_line"
}
local CA_parms = {
ai_id = 'mai_goto',