Skip to content

Commit e9cd718

Browse files
tenplus1paramat
authored andcommittedFeb 18, 2017
Statbars.lua: Cache enable_damage setting
1 parent 5db41d4 commit e9cd718

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

Diff for: ‎builtin/game/statbars.lua

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
-- cache setting
2+
local enable_damage = core.setting_getbool("enable_damage") == true
13

24
local health_bar_definition =
35
{
@@ -42,9 +44,8 @@ local function initialize_builtin_statbars(player)
4244
player:hud_set_flags(player:hud_get_flags())
4345
end
4446

45-
if player:hud_get_flags().healthbar and
46-
core.is_yes(core.setting_get("enable_damage")) then
47-
if hud_ids[name].id_healthbar == nil then
47+
if player:hud_get_flags().healthbar and enable_damage then
48+
if hud_ids[name].id_healthbar == nil then
4849
health_bar_definition.number = player:get_hp()
4950
hud_ids[name].id_healthbar = player:hud_add(health_bar_definition)
5051
end
@@ -56,8 +57,7 @@ local function initialize_builtin_statbars(player)
5657
end
5758

5859
if (player:get_breath() < 11) then
59-
if player:hud_get_flags().breathbar and
60-
core.is_yes(core.setting_get("enable_damage")) then
60+
if player:hud_get_flags().breathbar and enable_damage then
6161
if hud_ids[name].id_breathbar == nil then
6262
hud_ids[name].id_breathbar = player:hud_add(breath_bar_definition)
6363
end

0 commit comments

Comments
 (0)
Please sign in to comment.