diff options
author | Wuzzy <almikes@aol.com> | 2014-07-15 00:38:01 +0200 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2014-07-15 00:38:01 +0200 |
commit | c400ac1ed9fd6d5dfa9f498a093270de03e01c9e (patch) | |
tree | 8911261dc3c890116385e5f792c235dfde493d64 /examples.lua | |
parent | 7a411df76ea2c74b3f5e3d8eea257777ae7edb5d (diff) |
Add cancel_on_death parameter for effect types.
This optional parameter controls wheather the effect shall be cancelled
when the player dies. By default, this is true.
Diffstat (limited to 'examples.lua')
-rw-r--r-- | examples.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/examples.lua b/examples.lua index e8fca66..d1bc082 100644 --- a/examples.lua +++ b/examples.lua @@ -90,7 +90,7 @@ playereffects.register_effect_type("highjump", "Greater jump height", "playereff end ) --- Adds the “fly” privilege +-- Adds the “fly” privilege. Keep the privilege even if the player dies playereffects.register_effect_type("fly", "Fly mode available", "playereffects_example_fly.png", {"fly"}, function(player) local playername = player:get_player_name() @@ -102,7 +102,9 @@ playereffects.register_effect_type("fly", "Fly mode available", "playereffects_e local privs = minetest.get_player_privs(effect.playername) privs.fly = nil minetest.set_player_privs(effect.playername, privs) - end + end, + false, -- not hidden + false -- do NOT cancel the effect on death ) -- Dummy effect for the stree test @@ -174,10 +176,10 @@ minetest.register_chatcommand("highjump", { minetest.register_chatcommand("fly", { params = "", - description = "Grants you the fly privilege for a short time.", + description = "Grants you the fly privilege for a minute. You keep the effect when you die.", privs = {}, func = function(name, param) - local ret = playereffects.apply_effect_type("fly", 20, minetest.get_player_by_name(name)) + local ret = playereffects.apply_effect_type("fly", 60, minetest.get_player_by_name(name)) notify(name, ret) end, }) |