Return Guardian MAI: bug fix for situation when return hex is occupied
This commit is contained in:
parent
00165dd5c0
commit
66913d3aa8
1 changed files with 7 additions and 1 deletions
|
@ -125,7 +125,13 @@ return {
|
|||
local unit = wesnoth.get_units { id = cfg.id }[1]
|
||||
--print("Exec guardian move",unit.id)
|
||||
|
||||
local nh = AH.next_hop(unit, cfg.return_x, cfg.return_y)
|
||||
-- In case the return hex is occupied:
|
||||
local x, y = cfg.return_x, cfg.return_y
|
||||
if (unit.x ~= x) or (unit.y ~= y) then
|
||||
x, y = wesnoth.find_vacant_tile(x, y, unit)
|
||||
end
|
||||
|
||||
local nh = AH.next_hop(unit, x, y)
|
||||
if unit.moves~=0 then
|
||||
AH.movefull_stopunit(ai, unit, nh)
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue