mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-11 23:21:14 +00:00
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
@ -753,6 +753,9 @@ end
|
|||||||
function wml_actions.petrify(cfg)
|
function wml_actions.petrify(cfg)
|
||||||
for index, unit in ipairs(wesnoth.get_units(cfg)) do
|
for index, unit in ipairs(wesnoth.get_units(cfg)) do
|
||||||
unit.status.petrified = true
|
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
|
end
|
||||||
|
|
||||||
for index, unit in ipairs(wesnoth.get_recall_units(cfg)) do
|
for index, unit in ipairs(wesnoth.get_recall_units(cfg)) do
|
||||||
@ -763,6 +766,9 @@ end
|
|||||||
function wml_actions.unpetrify(cfg)
|
function wml_actions.unpetrify(cfg)
|
||||||
for index, unit in ipairs(wesnoth.get_units(cfg)) do
|
for index, unit in ipairs(wesnoth.get_units(cfg)) do
|
||||||
unit.status.petrified = false
|
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
|
end
|
||||||
|
|
||||||
for index, unit in ipairs(wesnoth.get_recall_units(cfg)) do
|
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("petrified", _"petrified", _"female^petrified", "petrified.ogg")
|
||||||
set_status("unhealable", _"unhealable", _"female^unhealable")
|
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
|
if add_tab then
|
||||||
text = string.format("%s%s", "\t", text)
|
text = string.format("%s%s", "\t", text)
|
||||||
end
|
end
|
||||||
@ -1045,7 +1055,7 @@ function wml_actions.add_ai_behavior(cfg)
|
|||||||
helper.wml_error("[add_ai_behavior]: invalid execution/evaluation handler(s)")
|
helper.wml_error("[add_ai_behavior]: invalid execution/evaluation handler(s)")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local path = "stage[" .. loop_id .. "].candidate_action[" .. id .. "]" -- bca: behavior candidate action
|
local path = "stage[" .. loop_id .. "].candidate_action[" .. id .. "]" -- bca: behavior candidate action
|
||||||
|
|
||||||
local conf = {
|
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_SLOWED, false);
|
||||||
u->set_state(unit::STATE_PETRIFIED, false);
|
u->set_state(unit::STATE_PETRIFIED, false);
|
||||||
u->set_state(unit::STATE_UNHEALABLE, false);
|
u->set_state(unit::STATE_UNHEALABLE, false);
|
||||||
|
u->set_standing();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (heal_amount_to_set)
|
if (heal_amount_to_set)
|
||||||
@ -1281,7 +1282,7 @@ WML_HANDLER_FUNCTION(modify_side, /*event_info*/, cfg)
|
|||||||
if ( !setc.empty() ) {
|
if ( !setc.empty() ) {
|
||||||
teams[team_index].set_no_turn_confirmation(setc.to_bool());
|
teams[team_index].set_no_turn_confirmation(setc.to_bool());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change leader scrolling options
|
// Change leader scrolling options
|
||||||
config::attribute_value stl = cfg["scroll_to_leader"];
|
config::attribute_value stl = cfg["scroll_to_leader"];
|
||||||
if ( !stl.empty()) {
|
if ( !stl.empty()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user