diff options
author | BlockMen <nmuelll@web.de> | 2015-04-08 20:24:01 +0200 |
---|---|---|
committer | BlockMen <nmuelll@web.de> | 2015-04-08 20:24:01 +0200 |
commit | 7ece8b87bec0451f24c2d8e2cffcd06b12a0262b (patch) | |
tree | 0f596ad08ab23e9aafbb576f9bfa658f03f47d7c | |
parent | 1071c7f13e491b2f3bc09bbbcb1bd6aaed6071c5 (diff) |
Fix hud_flags (fixes #20); check player once more
-rw-r--r-- | api.lua | 9 | ||||
-rw-r--r-- | builtin.lua | 2 |
2 files changed, 7 insertions, 4 deletions
@@ -11,7 +11,7 @@ local sb_bg = {} -- statbar background ids local items = hud.registered_items local function throw_error(msg) - minetest.chat_send_all(msg) + minetest.log("error", "Better HUD[error]: " .. msg) end @@ -67,7 +67,7 @@ function hud.register(name, def) end function hud.change_item(player, name, def) - if not player or not name or not def then + if not player or not player:is_player() or not name or not def then throw_error("Not enough parameters given to change HUD item") return false end @@ -185,7 +185,10 @@ end minetest.register_on_joinplayer(function(player) -- first: hide the default statbars - player:hud_set_flags({healthbar = false, breathbar = false}) + local hud_flags = player:hud_get_flags() + hud_flags.healthbar = false + hud_flags.breathbar = false + player:hud_set_flags(hud_flags) -- now add the backgrounds (e.g. for statbars) for _,item in pairs(sb_bg) do diff --git a/builtin.lua b/builtin.lua index b82ba41..7169c4c 100644 --- a/builtin.lua +++ b/builtin.lua @@ -80,7 +80,7 @@ if damage_enabled then }) local start_value = 0 - if show_hunger then + if hud.show_hunger then start_value = 20 end |