diff options
author | Wuzzy <almikes@aol.com> | 2014-07-13 22:07:04 +0200 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2014-07-13 22:07:04 +0200 |
commit | 85fbd146b145af79d5e197957caa5308f4101d66 (patch) | |
tree | 80f263f8a11845d88414fc2f819cd3b60a5f2175 /init.lua | |
parent | bf505282280835c5ffbf124003003b1bfa72dbc8 (diff) |
Add support for hidden effects
Hidden effects are effects which are not exposed to the player’s HUD.
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -48,7 +48,7 @@ function playereffects.next_effect_id() end --[=[ API functions ]=] -function playereffects.register_effect_type(name, description, icon, groups, apply, cancel) +function playereffects.register_effect_type(name, description, icon, groups, apply, cancel, hidden) effect_type = {} effect_type.description = description effect_type.apply = apply @@ -59,6 +59,11 @@ function playereffects.register_effect_type(name, description, icon, groups, app else effect_type.cancel = function() end end + if hidden ~= nil then + effect_type.hidden = hidden + else + effect_type.hidden = false + end playereffects.effect_types[name] = effect_type minetest.log("action", "Effect type "..name.." registered!") end @@ -306,7 +311,8 @@ end function playereffects.hud_effect(effect_type_id, player, pos, time_left) local text_id, icon_id - if(playereffects.use_hud == true) then + local effect_type = playereffects.effect_types[effect_type_id] + if(playereffects.use_hud == true and effect_type.hidden == false) then text_id = player:hud_add({ hud_elem_type = "text", position = { x = 1, y = 0.3 }, |