Added damage_inflicted member to wesnoth.current.event_context (fixes #2368)
This commit is contained in:
parent
118eb94beb
commit
d46f129d3c
2 changed files with 12 additions and 0 deletions
|
@ -947,6 +947,12 @@ void attack::fire_event(const std::string& n)
|
|||
return;
|
||||
}
|
||||
|
||||
// damage_inflicted is set in these two events.
|
||||
// TODO: should we set this value from unit_info::damage, or continue using the WML variable?
|
||||
if(n == "attacker_hits" || n == "defender_hits") {
|
||||
ev_data["damage_inflicted"] = resources::gamedata->get_variable("damage_inflicted");
|
||||
}
|
||||
|
||||
const int defender_side = d_.get_unit().side();
|
||||
|
||||
resources::game_events->pump().fire(n,
|
||||
|
|
|
@ -1359,6 +1359,12 @@ int game_lua_kernel::impl_current_get(lua_State *L)
|
|||
if (const config &weapon = ev.data.child("second")) {
|
||||
cfg.add_child("second_weapon", weapon);
|
||||
}
|
||||
|
||||
const config::attribute_value di = ev.data["damage_inflicted"];
|
||||
if(!di.empty()) {
|
||||
cfg["damage_inflicted"] = di;
|
||||
}
|
||||
|
||||
if (ev.loc1.valid()) {
|
||||
cfg["x1"] = ev.loc1.filter_loc().wml_x();
|
||||
cfg["y1"] = ev.loc1.filter_loc().wml_y();
|
||||
|
|
Loading…
Add table
Reference in a new issue