diff options
author | Wuzzy <almikes@aol.com> | 2015-02-12 04:39:15 +0100 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2015-02-12 04:39:15 +0100 |
commit | ea9a303e484da7cf674c93b0c8e92be11f2fc019 (patch) | |
tree | 8668a8c872fa0295ed7d3396b487208f68be3045 /init.lua | |
parent | eb4e72c5a4294b9d3f2bd38fedf509587b566e3a (diff) |
Do not register health/breath bar if damage is off
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 31 |
1 files changed, 17 insertions, 14 deletions
@@ -229,9 +229,10 @@ function hb.get_hudbar_state(player, identifier) end --register built-in HUD bars -hb.register_hudbar("health", 0xFFFFFF, "Health", { bar = "hudbars_bar_health.png", icon = "hudbars_icon_health.png" }, 20, 20, false) -hb.register_hudbar("breath", 0xFFFFFF, "Breath", { bar = "hudbars_bar_breath.png", icon = "hudbars_icon_breath.png" }, 10, 10, true) - +if minetest.setting_getbool("enable_damage") then + hb.register_hudbar("health", 0xFFFFFF, "Health", { bar = "hudbars_bar_health.png", icon = "hudbars_icon_health.png" }, 20, 20, false) + hb.register_hudbar("breath", 0xFFFFFF, "Breath", { bar = "hudbars_bar_breath.png", icon = "hudbars_icon_breath.png" }, 10, 10, true) +end --load custom settings local set = io.open(minetest.get_modpath("hudbars").."/hudbars.conf", "r") @@ -255,18 +256,20 @@ end -- update built-in HUD bars local function update_hud(player) - --air - local air = player:get_breath() - - if air == 11 then - hb.hide_hudbar(player, "breath") - else - hb.unhide_hudbar(player, "breath") - hb.change_hudbar(player, "breath", air) + if minetest.setting_getbool("enable_damage") then + --air + local air = player:get_breath() + + if air == 11 then + hb.hide_hudbar(player, "breath") + else + hb.unhide_hudbar(player, "breath") + hb.change_hudbar(player, "breath", air) + end + + --health + hb.change_hudbar(player, "health", player:get_hp()) end - - --health - hb.change_hudbar(player, "health", player:get_hp()) end minetest.register_on_joinplayer(function(player) |