Skip to content

Commit

Permalink
Messenger MAI Lua code: change proxy unit location directly
Browse files Browse the repository at this point in the history
(cherry-picked from commit b3058e8)
  • Loading branch information
mattsc committed Oct 7, 2018
1 parent 25b2024 commit 5bc44fc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions data/ai/micro_ais/cas/ca_messenger_move.lua
Expand Up @@ -59,17 +59,17 @@ function ca_messenger_move:execution(cfg)
if (unit_in_way == messenger) then unit_in_way = nil end
if unit_in_way then unit_in_way:extract() end

wesnoth.put_unit(messenger, next_hop[1], next_hop[2])
messenger.loc = { next_hop[1], next_hop[2] }
local _, cost1 = AH.find_path_with_shroud(messenger, x, y, { ignore_units = 'yes' })

local unit_in_way2 = wesnoth.get_unit(optimum_hop[1], optimum_hop[2])
if (unit_in_way2 == messenger) then unit_in_way2 = nil end
if unit_in_way2 then unit_in_way2:extract() end

wesnoth.put_unit(messenger, optimum_hop[1], optimum_hop[2])
messenger.loc = { optimum_hop[1], optimum_hop[2] }
local _, cost2 = AH.find_path_with_shroud(messenger, x, y, { ignore_units = 'yes' })

wesnoth.put_unit(messenger, x_current, y_current)
messenger.loc = { x_current, y_current }
if unit_in_way then unit_in_way:to_map() end
if unit_in_way2 then unit_in_way2:to_map() end

Expand Down

0 comments on commit 5bc44fc

Please sign in to comment.