forked from VoxeLibre/VoxeLibre
fix codestyle in mcl_hbarmor
This commit is contained in:
parent
ee9577b625
commit
5fc3256930
|
@ -1,23 +1,26 @@
|
|||
local S = minetest.get_translator("mcl_hbarmor")
|
||||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
|
||||
local mcl_hbarmor = {}
|
||||
local math = math
|
||||
local tonumber = tonumber
|
||||
|
||||
local get_connected_players = minetest.get_connected_players
|
||||
|
||||
local mcl_hbarmor = {
|
||||
-- HUD statbar values
|
||||
mcl_hbarmor.armor = {}
|
||||
|
||||
armor = {},
|
||||
-- Stores if player's HUD bar has been initialized so far.
|
||||
mcl_hbarmor.player_active = {}
|
||||
|
||||
player_active = {},
|
||||
-- Time difference in seconds between updates to the HUD armor bar.
|
||||
-- Increase this number for slow servers.
|
||||
mcl_hbarmor.tick = 0.1
|
||||
|
||||
tick = 0.1,
|
||||
-- If true, the armor bar is hidden when the player does not wear any armor
|
||||
mcl_hbarmor.autohide = true
|
||||
autohide = true,
|
||||
}
|
||||
|
||||
set = minetest.settings:get("mcl_hbarmor_tick")
|
||||
if tonumber(set) ~= nil then
|
||||
mcl_hbarmor.tick = tonumber(set)
|
||||
local tick_config = minetest.settings:get("mcl_hbarmor_tick")
|
||||
|
||||
if tonumber(tick_config) ~= nil then
|
||||
mcl_hbarmor.tick = tonumber(tick_config)
|
||||
end
|
||||
|
||||
|
||||
|
@ -106,12 +109,13 @@ end)
|
|||
local main_timer = 0
|
||||
local timer = 0
|
||||
minetest.register_globalstep(function(dtime)
|
||||
--TODO: replace this by playerglobalstep API then implemented
|
||||
main_timer = main_timer + dtime
|
||||
timer = timer + dtime
|
||||
if main_timer > mcl_hbarmor.tick or timer > 4 then
|
||||
if minetest.settings:get_bool("enable_damage") then
|
||||
if main_timer > mcl_hbarmor.tick then main_timer = 0 end
|
||||
for _,player in pairs(minetest.get_connected_players()) do
|
||||
for _,player in pairs(get_connected_players()) do
|
||||
local name = player:get_player_name()
|
||||
if mcl_hbarmor.player_active[name] == true then
|
||||
local ret = mcl_hbarmor.get_armor(player)
|
||||
|
|
Loading…
Reference in New Issue