diff options
author | Wuzzy <almikes@aol.com> | 2014-07-14 17:55:48 +0200 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2014-07-14 17:55:48 +0200 |
commit | 15daa210c496232caa110e32bfb61bfb54e13183 (patch) | |
tree | 964cd3c395d5154fe72e216350e04527983ab627 /init.lua | |
parent | 21f053270f0015438e28b347a87ba9a151c59aff (diff) |
Add effect failure
The apply function of effects can return false, in that case, the effect
is not applied
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -69,7 +69,17 @@ end function playereffects.apply_effect_type(effect_type_id, duration, player) local start_time = os.time() + local status = playereffects.effect_types[effect_type_id].apply(player) local playername = player:get_player_name() + local metadata + + if(status == false) then + minetest.log("action", "[playereffects] Attempt to apply effect type "..effect_type_id.." to player "..playername.." failed!") + return + else + metadata = status + end + local groups = playereffects.effect_types[effect_type_id].groups for k,v in pairs(groups) do playereffects.cancel_effect_group(v, playername) @@ -105,8 +115,6 @@ function playereffects.apply_effect_type(effect_type_id, duration, player) hudids = {text_id=nil, icon_id=nil} end - local metadata = playereffects.effect_types[effect_type_id].apply(player) - local effect = { playername = playername, effect_id = effect_id, |