mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-21 00:15:50 +00:00
Pick Advance: merge moveto event into turn_refresh, closes #8954
This commit is contained in:
parent
b0e9ac1947
commit
1f0ffe0058
|
@ -200,15 +200,8 @@ on_event("start", function()
|
|||
wml.variables.pickadvance_force_choice = wml.variables.pickadvance_force_choice or not map_has_recruits
|
||||
end)
|
||||
|
||||
-- set "fresh_turn" for the moveto event at the start of each side turn
|
||||
-- check if there are any new units that need to be forced to make an advancement choice
|
||||
on_event("turn refresh", function()
|
||||
wml.variables.pa_fresh_turn = true
|
||||
end)
|
||||
|
||||
-- the first time a unit moves at the start of each side's turn, check if there are any new units that need to be forced to make an advancement choice
|
||||
on_event("moveto", function()
|
||||
if wml.variables.pa_fresh_turn then
|
||||
wml.variables.pa_fresh_turn = nil
|
||||
if not wesnoth.sides[wesnoth.current.side].__cfg.allow_player then return end
|
||||
for _, unit in ipairs(wesnoth.units.find_on_map { side = wesnoth.current.side }) do
|
||||
if #unit.advances_to > 1 and wml.variables.pickadvance_force_choice and wesnoth.current.turn > 1 then
|
||||
|
@ -222,8 +215,6 @@ on_event("moveto", function()
|
|||
initialize_unit(unit)
|
||||
end
|
||||
end
|
||||
wesnoth.allow_undo(false)
|
||||
end
|
||||
end)
|
||||
|
||||
-- initialize units on recruit and after advancing, forcing another advancement choice if required
|
||||
|
|
Loading…
Reference in New Issue
Block a user