diff options
author | Wuzzy <Wuzzy2@mail.ru> | 2019-02-21 00:36:17 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2019-08-01 14:45:23 +0200 |
commit | ec3142af990ea55775185e04e46ebf8eb16e2268 (patch) | |
tree | 3ada15363f854f8cf0fefcab1e045cac091f6984 /builtin | |
parent | 3296952ae55231d601686b69c037ec1366381fc5 (diff) | |
download | minetest-ec3142af990ea55775185e04e46ebf8eb16e2268.tar.gz minetest-ec3142af990ea55775185e04e46ebf8eb16e2268.tar.bz2 minetest-ec3142af990ea55775185e04e46ebf8eb16e2268.zip |
Group "immortal" also protects players from damage
Document new meaning of immortal=1 for players
Disable breathing if player is immortal
Hide builtin statbars if player immortal (delayed)
Co-authored-by: ClobberXD <ClobberXD@gmail.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/game/statbars.lua | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/builtin/game/statbars.lua b/builtin/game/statbars.lua index da924d6f8..bb88356d5 100644 --- a/builtin/game/statbars.lua +++ b/builtin/game/statbars.lua @@ -50,7 +50,8 @@ local function update_builtin_statbars(player) end local hud = hud_ids[name] - if flags.healthbar and enable_damage then + local immortal = player:get_armor_groups().immortal == 1 + if flags.healthbar and enable_damage and not immortal then local number = scaleToDefault(player, "hp") if hud.id_healthbar == nil then local hud_def = table.copy(health_bar_definition) @@ -65,7 +66,7 @@ local function update_builtin_statbars(player) end local breath_max = player:get_properties().breath_max - if flags.breathbar and enable_damage and + if flags.breathbar and enable_damage and not immortal and player:get_breath() < breath_max then local number = 2 * scaleToDefault(player, "breath") if hud.id_breathbar == nil then @@ -116,7 +117,7 @@ local function player_event_handler(player,eventname) end end - if eventname == "hud_changed" then + if eventname == "hud_changed" or eventname == "properties_changed" then update_builtin_statbars(player) return true end |