Skip to content

Commit

Permalink
Statbars.lua: Cache enable_damage setting
Browse files Browse the repository at this point in the history
  • Loading branch information
tenplus1 authored and paramat committed Feb 18, 2017
1 parent 5db41d4 commit e9cd718
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions builtin/game/statbars.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- cache setting
local enable_damage = core.setting_getbool("enable_damage") == true

local health_bar_definition =
{
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit e9cd718

Please sign in to comment.