summaryrefslogtreecommitdiff
path: root/builtin/game/statbars.lua
diff options
context:
space:
mode:
authorShadowNinja <shadowninja@minetest.net>2017-06-03 14:55:10 -0400
committerShadowNinja <shadowninja@minetest.net>2017-06-03 14:55:10 -0400
commitcaecdb681c428c1aab9c0f7eec2570c0460f995c (patch)
treee5115982ea59bbf2343ba9b35bc4a0cfbb56f407 /builtin/game/statbars.lua
parent81d56b94919dceb7b2e51d70b21a7ca22f852bd5 (diff)
parent80dc961d24e1964e25d57039ddb2ba639f9f4d22 (diff)
downloadminetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.gz
minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.tar.bz2
minetest-caecdb681c428c1aab9c0f7eec2570c0460f995c.zip
Merge 0.4.16 into stable-0.4
Diffstat (limited to 'builtin/game/statbars.lua')
-rw-r--r--builtin/game/statbars.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/builtin/game/statbars.lua b/builtin/game/statbars.lua
index 61a8b9077..6aa106140 100644
--- a/builtin/game/statbars.lua
+++ b/builtin/game/statbars.lua
@@ -1,3 +1,5 @@
+-- cache setting
+local enable_damage = core.settings:get_bool("enable_damage")
local health_bar_definition =
{
@@ -42,9 +44,8 @@ local function initialize_builtin_statbars(player)
player:hud_set_flags(player:hud_get_flags())
end
- if player:hud_get_flags().healthbar and
- core.is_yes(core.setting_get("enable_damage")) then
- if hud_ids[name].id_healthbar == nil then
+ if player:hud_get_flags().healthbar and enable_damage then
+ if hud_ids[name].id_healthbar == nil then
health_bar_definition.number = player:get_hp()
hud_ids[name].id_healthbar = player:hud_add(health_bar_definition)
end
@@ -56,8 +57,7 @@ local function initialize_builtin_statbars(player)
end
if (player:get_breath() < 11) then
- if player:hud_get_flags().breathbar and
- core.is_yes(core.setting_get("enable_damage")) then
+ if player:hud_get_flags().breathbar and enable_damage then
if hud_ids[name].id_breathbar == nil then
hud_ids[name].id_breathbar = player:hud_add(breath_bar_definition)
end