mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 13:53:45 +01:00
fix some codestyle issues in hudbars
This commit is contained in:
parent
190d5cad33
commit
fd387a65af
@ -1,17 +1,22 @@
|
|||||||
local S = minetest.get_translator("hudbars")
|
local modname = minetest.get_current_modname()
|
||||||
|
local modpath = minetest.get_modpath(modname)
|
||||||
|
|
||||||
|
local S = minetest.get_translator(modname)
|
||||||
local N = function(s) return s end
|
local N = function(s) return s end
|
||||||
|
|
||||||
hb = {}
|
local math = math
|
||||||
|
local table = table
|
||||||
|
|
||||||
hb.hudtables = {}
|
hb = {
|
||||||
|
hudtables = {},
|
||||||
-- number of registered HUD bars
|
-- number of registered HUD bars
|
||||||
hb.hudbars_count = 0
|
hudbars_count = 0,
|
||||||
|
-- table which records which HUD bar slots have been “registered” so far; used for automatic positioning
|
||||||
-- table which records which HUD bar slots have been “registered” so far; used for automatic positioning
|
registered_slots = {},
|
||||||
hb.registered_slots = {}
|
settings = {},
|
||||||
|
-- Table which contains all players with active default HUD bars (only for internal use)
|
||||||
hb.settings = {}
|
players = {},
|
||||||
|
}
|
||||||
|
|
||||||
function hb.load_setting(sname, stype, defaultval, valid_values)
|
function hb.load_setting(sname, stype, defaultval, valid_values)
|
||||||
local sval
|
local sval
|
||||||
@ -45,7 +50,8 @@ function hb.load_setting(sname, stype, defaultval, valid_values)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Load default settings
|
-- Load default settings
|
||||||
dofile(minetest.get_modpath("hudbars").."/default_settings.lua")
|
dofile(modpath.."/default_settings.lua")
|
||||||
|
|
||||||
if minetest.get_modpath("mcl_experience") and not minetest.is_creative_enabled("") then
|
if minetest.get_modpath("mcl_experience") and not minetest.is_creative_enabled("") then
|
||||||
-- reserve some space for experience bar:
|
-- reserve some space for experience bar:
|
||||||
hb.settings.start_offset_left.y = hb.settings.start_offset_left.y - 20
|
hb.settings.start_offset_left.y = hb.settings.start_offset_left.y - 20
|
||||||
@ -85,9 +91,6 @@ local function make_label(format_string, format_string_config, label, start_valu
|
|||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Table which contains all players with active default HUD bars (only for internal use)
|
|
||||||
hb.players = {}
|
|
||||||
|
|
||||||
function hb.value_to_barlength(value, max)
|
function hb.value_to_barlength(value, max)
|
||||||
if max == 0 then
|
if max == 0 then
|
||||||
return 0
|
return 0
|
||||||
|
Loading…
Reference in New Issue
Block a user