summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2014-07-14 19:06:10 +0200
committerWuzzy <almikes@aol.com>2014-07-14 19:06:10 +0200
commit735dce5a7bc779a0106cbbb8dc1e00171a282583 (patch)
treeeaa681230475854cf2ed039fc36d3d25968dd410 /init.lua
parent0ea070a3bdbd2cc959f2814021208431881397dc (diff)
Fix effect cancelling after applying
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua13
1 files changed, 7 insertions, 6 deletions
diff --git a/init.lua b/init.lua
index 661b73c..97bf532 100644
--- a/init.lua
+++ b/init.lua
@@ -82,8 +82,13 @@ function playereffects.apply_effect_type(effect_type_id, duration, player)
return false
end
- local status = playereffects.effect_types[effect_type_id].apply(player)
local playername = player:get_player_name()
+ local groups = playereffects.effect_types[effect_type_id].groups
+ for k,v in pairs(groups) do
+ playereffects.cancel_effect_group(v, playername)
+ end
+
+ local status = playereffects.effect_types[effect_type_id].apply(player)
local metadata
if(status == false) then
@@ -93,10 +98,6 @@ function playereffects.apply_effect_type(effect_type_id, duration, player)
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)
- end
local effect_id = playereffects.next_effect_id()
local effects = playereffects.get_player_effects(playername)
local smallest_hudpos
@@ -141,7 +142,7 @@ function playereffects.apply_effect_type(effect_type_id, duration, player)
playereffects.effects[effect_id] = effect
- minetest.log("action", "[playereffects] Effect type "..effect_type_id.." applied to player "..playername.."!")
+ minetest.log("action", "[playereffects] Effect type "..effect_type_id.." applied to player "..playername.." (effect_id = "..effect_id..").")
minetest.after(duration, function(effect_id) playereffects.cancel_effect(effect_id) end, effect_id)
return effect_id