summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2014-07-14 18:29:22 +0200
committerWuzzy <almikes@aol.com>2014-07-14 18:29:22 +0200
commit0ea070a3bdbd2cc959f2814021208431881397dc (patch)
tree8c8bbc1361d2981e598b3b2587e299dca3461609
parent4ef959c78e0a129b16500aba863db807d6a72da8 (diff)
Add “cancelall” example (cancels user’s effects)
-rw-r--r--examples.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples.lua b/examples.lua
index ba798f7..dd30a71 100644
--- a/examples.lua
+++ b/examples.lua
@@ -165,6 +165,21 @@ minetest.register_chatcommand("fly", {
end,
})
+--[[
+ Cancel all active effects
+]]
+minetest.register_chatcommand("cancelall", {
+ params = "",
+ description = "Cancels all your effects.",
+ privs = {},
+ func = function(name, param)
+ local effects = playereffects.get_player_effects(name)
+ for e=1, #effects do
+ playereffects.cancel_effect(effects[e].effect_id)
+ end
+ end,
+})
+
--[[ The stress test applies a shitload of effects at once.
This is used to test the performance of this mod at very large effect numbers. ]]
minetest.register_chatcommand("stresstest", {