Forest Animals MAI: make the rabbit-type animals replay safe
They need to be put on the map and taken off using ai.synced_command(), otherwise it causes OOS errors.
This commit is contained in:
parent
a66a87dad6
commit
ac5acf69af
2 changed files with 9 additions and 1 deletions
|
@ -156,6 +156,8 @@ function ca_forest_animals_move:execution(ai, cfg)
|
|||
-- If this is a rabbit ending on a hole -> disappears
|
||||
if (unit.type == rabbit_type) and hole_map:get(farthest_hex[1], farthest_hex[2]) then
|
||||
wesnoth.put_unit(farthest_hex[1], farthest_hex[2])
|
||||
local command = "wesnoth.put_unit(x1, y1)"
|
||||
ai.synced_command(command, farthest_hex[1], farthest_hex[2])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -64,7 +64,13 @@ function ca_forest_animals_new_rabbit:execution(ai, cfg)
|
|||
else
|
||||
x, y = wesnoth.find_vacant_tile(holes[i].x, holes[i].y)
|
||||
end
|
||||
wesnoth.put_unit(x, y, { side = wesnoth.current.side, type = cfg.rabbit_type } )
|
||||
|
||||
local command = "wesnoth.put_unit(x1, y1, { side = "
|
||||
.. wesnoth.current.side
|
||||
.. ", type = '"
|
||||
.. cfg.rabbit_type
|
||||
.. "' } )"
|
||||
ai.synced_command(command, x, y)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue