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:
parent
7e8cedaea8
commit
ea4657c6d4
2 changed files with 5 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Add table
Reference in a new issue