mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-30 18:55:36 +00:00
Lua API: implicitly clear animator after playing it (#3536)
This prevents the animator from holding a strong reference to the target unit, which was keeping the unit object alive and thus preventing the unit halo, if any, from disappearing. (cherry-picked from commit 7d6e2b2a10a61e1704c38ea7ee6aa34178a29b38)
This commit is contained in:
parent
489e958d9f
commit
c1a70068d5
@ -110,5 +110,4 @@ function wesnoth.wml_actions.animate_unit(cfg)
|
||||
local anim = wesnoth.create_animator()
|
||||
add_animation(anim, cfg)
|
||||
anim:run()
|
||||
anim:clear()
|
||||
end
|
||||
end
|
||||
|
@ -44,7 +44,6 @@ function wesnoth.wml_actions.heal_unit(cfg)
|
||||
animator:add(healers[1], 'healing', 'hit', {value = heal_amount})
|
||||
end
|
||||
animator:run()
|
||||
animator:clear()
|
||||
end
|
||||
|
||||
u.hitpoints = new_hitpoints
|
||||
|
@ -71,7 +71,6 @@ function wesnoth.wml_actions.kill(cfg)
|
||||
anim:add(secondary_unit, "victory", "kill", {primary = secondary, secondary = primary})
|
||||
end
|
||||
anim:run()
|
||||
anim:clear()
|
||||
end
|
||||
-- wesnoth.wml_actions.redraw{}
|
||||
|
||||
|
@ -448,6 +448,7 @@ static int impl_run_animation(lua_State* L)
|
||||
anim.start_animations();
|
||||
anim.wait_for_end();
|
||||
anim.set_all_standing();
|
||||
anim.clear();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user