Micro AIs: update to new syntax of wesnoth.put_unit()

This commit is contained in:
mattsc 2016-03-19 20:59:33 -07:00
parent d0c716a22d
commit 6f57ee846b
3 changed files with 6 additions and 6 deletions

View file

@ -156,7 +156,7 @@ function ca_forest_animals_move:execution(ai, cfg)
if unit and unit.valid
and (unit.type == rabbit_type) and hole_map:get(farthest_hex[1], farthest_hex[2])
then
local command = "wesnoth.put_unit(x1, y1)"
local command = "wesnoth.erase_unit(x1, y1)"
ai.synced_command(command, farthest_hex[1], farthest_hex[2])
end
end

View file

@ -59,11 +59,11 @@ function ca_forest_animals_new_rabbit:execution(ai, cfg)
x, y = wesnoth.find_vacant_tile(holes[i].x, holes[i].y)
end
local command = "wesnoth.put_unit(x1, y1, { side = "
local command = "wesnoth.put_unit({ side = "
.. wesnoth.current.side
.. ", type = '"
.. cfg.rabbit_type
.. "' })"
.. "' }, x1, y1)"
ai.synced_command(command, x, y)
end
end

View file

@ -57,17 +57,17 @@ function ca_messenger_move:execution(ai, cfg)
if (unit_in_way == messenger) then unit_in_way = nil end
if unit_in_way then wesnoth.extract_unit(unit_in_way) end
wesnoth.put_unit(next_hop[1], next_hop[2], messenger)
wesnoth.put_unit(messenger, next_hop[1], next_hop[2])
local _, cost1 = wesnoth.find_path(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 wesnoth.extract_unit(unit_in_way2) end
wesnoth.put_unit(optimum_hop[1], optimum_hop[2], messenger)
wesnoth.put_unit(messenger, optimum_hop[1], optimum_hop[2])
local _, cost2 = wesnoth.find_path(messenger, x, y, { ignore_units = 'yes' })
wesnoth.put_unit(x_current, y_current, messenger)
wesnoth.put_unit(messenger, x_current, y_current)
if unit_in_way then wesnoth.put_unit(unit_in_way) end
if unit_in_way2 then wesnoth.put_unit(unit_in_way2) end