From 96afee3a527f0e684272141d1dc68684ab7e49ad Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Wed, 28 Mar 2018 16:05:18 +0100 Subject: [PATCH] Add reasons to on_dieplayer and on_hpchange --- builtin/game/register.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builtin/game/register.lua b/builtin/game/register.lua index 5ce8caf..7b2b149 100644 --- a/builtin/game/register.lua +++ b/builtin/game/register.lua @@ -529,11 +529,11 @@ end core.registered_on_player_hpchanges = { modifiers = { }, loggers = { } } -function core.registered_on_player_hpchange(player, hp_change) +function core.registered_on_player_hpchange(player, hp_change, reason) local last = false for i = #core.registered_on_player_hpchanges.modifiers, 1, -1 do local func = core.registered_on_player_hpchanges.modifiers[i] - hp_change, last = func(player, hp_change) + hp_change, last = func(player, hp_change, reason) if type(hp_change) ~= "number" then local debuginfo = debug.getinfo(func) error("The register_on_hp_changes function has to return a number at " .. @@ -544,7 +544,7 @@ function core.registered_on_player_hpchange(player, hp_change) end end for i, func in ipairs(core.registered_on_player_hpchanges.loggers) do - func(player, hp_change) + func(player, hp_change, reason) end return hp_change end