Lua: don't trigger unit placed events by WML tags

If the last argument to the C++ function ( game_lua_kernel::intf_put_unit )
is false, event's won't be fired.

closes #5158
This commit is contained in:
Severin Glöckner 2020-09-20 16:28:31 +02:00 committed by Pentarctagon
parent 14706e52ed
commit a748126b75
5 changed files with 7 additions and 8 deletions

View file

@ -58,7 +58,7 @@ local status_anim_update = function(is_undo)
changed_something = true
ec_unit.status.diversion = true
ec_unit:extract()
ec_unit:to_map()
ec_unit:to_map(false)
wesnoth.wml_actions.animate_unit {
flag = "launching",
with_bars = true,
@ -79,7 +79,7 @@ local status_anim_update = function(is_undo)
changed_something = true
ec_unit.status.diversion = false
ec_unit:extract()
ec_unit:to_map()
ec_unit:to_map(false)
wesnoth.wml_actions.animate_unit {
flag = "landing",
with_bars = true,

View file

@ -26,7 +26,7 @@ wesnoth.game_events.add_repeating("die", function()
effect.increase_total = effect.increase_total + 1
u_killer_cfg.max_hitpoints = u_killer_cfg.max_hitpoints + 1
u_killer_cfg.hitpoints = u_killer_cfg.hitpoints + 1
wesnoth.units.to_map(u_killer_cfg)
wesnoth.units.to_map(u_killer_cfg, false)
wesnoth.interface.float_label(ec.x2, ec.y2, _ "+1 max HP", "0,255,0")
return
end

View file

@ -498,7 +498,7 @@ function wml_actions.petrify(cfg)
unit.status.petrified = true
-- Extract unit and put it back to update animation (not needed for recall units)
unit:extract()
unit:to_map()
unit:to_map(false)
end
for index, unit in ipairs(wesnoth.units.find_on_recall{wml.tag["and"](cfg)}) do
@ -511,7 +511,7 @@ function wml_actions.unpetrify(cfg)
unit.status.petrified = false
-- Extract unit and put it back to update animation (not needed for recall units)
unit:extract()
unit:to_map()
unit:to_map(false)
end
for index, unit in ipairs(wesnoth.units.find_on_recall(cfg)) do

View file

@ -129,7 +129,7 @@ function wml_actions.harm_unit(cfg)
-- Extract unit and put it back to update animation if status was changed
unit_to_harm:extract()
unit_to_harm:to_map()
unit_to_harm:to_map(false)
if add_tab then
text = string.format("%s%s", "\t", text)

View file

@ -112,8 +112,7 @@ function wesnoth.wml_actions.move_unit(cfg)
}
local x2, y2 = current_unit.x, current_unit.y
current_unit.x, current_unit.y = x, y
current_unit:to_map()
current_unit:to_map(false)
if unshroud then
wesnoth.wml_actions.redraw {clear_shroud=true}
end