Update animation when [un]petrifying units using WML tags
Previously, when a unit was petrified with [petrify] or [harm_unit], it would continue its standing animation. Also, it would not start its standing animation when unpetrifying it with [unpetrify] or [heal_unit]. Now the animation stops/starts correctly when the status is changed. This fixes bug #20124
This commit is contained in:
parent
7b0722f819
commit
5ee8e35568
2 changed files with 13 additions and 2 deletions
|
@ -753,6 +753,9 @@ end
|
|||
function wml_actions.petrify(cfg)
|
||||
for index, unit in ipairs(wesnoth.get_units(cfg)) do
|
||||
unit.status.petrified = true
|
||||
-- Extract unit and put it back to update animation (not needed for recall units)
|
||||
wesnoth.extract_unit(unit)
|
||||
wesnoth.put_unit(unit, unit.x, unit.y)
|
||||
end
|
||||
|
||||
for index, unit in ipairs(wesnoth.get_recall_units(cfg)) do
|
||||
|
@ -763,6 +766,9 @@ end
|
|||
function wml_actions.unpetrify(cfg)
|
||||
for index, unit in ipairs(wesnoth.get_units(cfg)) do
|
||||
unit.status.petrified = false
|
||||
-- Extract unit and put it back to update animation (not needed for recall units)
|
||||
wesnoth.extract_unit(unit)
|
||||
wesnoth.put_unit(unit, unit.x, unit.y)
|
||||
end
|
||||
|
||||
for index, unit in ipairs(wesnoth.get_recall_units(cfg)) do
|
||||
|
@ -889,6 +895,10 @@ function wml_actions.harm_unit(cfg)
|
|||
set_status("petrified", _"petrified", _"female^petrified", "petrified.ogg")
|
||||
set_status("unhealable", _"unhealable", _"female^unhealable")
|
||||
|
||||
-- Extract unit and put it back to update animation if status was changed
|
||||
wesnoth.extract_unit(unit_to_harm)
|
||||
wesnoth.put_unit(unit_to_harm, unit_to_harm.x, unit_to_harm.y)
|
||||
|
||||
if add_tab then
|
||||
text = string.format("%s%s", "\t", text)
|
||||
end
|
||||
|
@ -1045,7 +1055,7 @@ function wml_actions.add_ai_behavior(cfg)
|
|||
helper.wml_error("[add_ai_behavior]: invalid execution/evaluation handler(s)")
|
||||
end
|
||||
|
||||
|
||||
|
||||
local path = "stage[" .. loop_id .. "].candidate_action[" .. id .. "]" -- bca: behavior candidate action
|
||||
|
||||
local conf = {
|
||||
|
|
|
@ -850,6 +850,7 @@ WML_HANDLER_FUNCTION(heal_unit, event_info, cfg)
|
|||
u->set_state(unit::STATE_SLOWED, false);
|
||||
u->set_state(unit::STATE_PETRIFIED, false);
|
||||
u->set_state(unit::STATE_UNHEALABLE, false);
|
||||
u->set_standing();
|
||||
}
|
||||
|
||||
if (heal_amount_to_set)
|
||||
|
@ -1281,7 +1282,7 @@ WML_HANDLER_FUNCTION(modify_side, /*event_info*/, cfg)
|
|||
if ( !setc.empty() ) {
|
||||
teams[team_index].set_no_turn_confirmation(setc.to_bool());
|
||||
}
|
||||
|
||||
|
||||
// Change leader scrolling options
|
||||
config::attribute_value stl = cfg["scroll_to_leader"];
|
||||
if ( !stl.empty()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue