summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2014-07-13 21:27:59 +0200
committerWuzzy <almikes@aol.com>2014-07-13 21:27:59 +0200
commit25fcabc095349ed97aff2a5b67e837eba2f4dada (patch)
tree48de72dcc1736a66137823596870b340ebb70628
parent338598710669f51b2562963e22447000c0040868 (diff)
Add playereffects.cancel_effect_type
-rw-r--r--init.lua13
1 files changed, 11 insertions, 2 deletions
diff --git a/init.lua b/init.lua
index 3471f41..af715ce 100644
--- a/init.lua
+++ b/init.lua
@@ -115,8 +115,17 @@ function playereffects.apply_effect_type(effect_type_id, duration, player)
minetest.after(duration, function(effect_id) playereffects.cancel_effect(effect_id) end, effect_id)
end
--- TODO
-function playereffects.cancel_effect_type(effect_type_id, playername)
+function playereffects.cancel_effect_type(effect_type_id, cancel_all, playername)
+ local effects = playereffects.get_player_effects(playername)
+ if(cancel_all==nil) then all = false end
+ for e=1, #effects do
+ if(effects[e].effect_type_id == effect_type_id) then
+ playereffects.cancel_effect(effects[e].effect_id)
+ if(cancel_all==false) then
+ return
+ end
+ end
+ end
end
function playereffects.cancel_effect_group(groupname, playername)