diff --git a/HUD.txt b/HUD.txt new file mode 100644 index 0000000..5aa9426 --- /dev/null +++ b/HUD.txt @@ -0,0 +1,17 @@ +Configuration for Better HUD +---------------------------- + +The Better HUD mod positions the stat displays according to +a 'hud.conf' file in its mod directory. If you wish to shift +the positions of the stat displays around, you need to create or +edit the 'hud.conf' file. + +There should be two files in this mod directory, 'hud.conf.with_hunger' +and 'hud.conf.no_hunger'. These can be used as the basis for your +'hud.conf', depending on whether you are also using the Hunger mod +(which adds a hunger display), or not. + +The positions of the displays in those files correspond to the +default settings in Better HUD. In most cases, it's enough to +copy one of these files as 'hud.conf' in the Better HUD mod +directory 'mods/hud'. diff --git a/README.md b/README.md index 6c86f65..541c63b 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ once and for all. Dependencies ------------ * default -* hud (optional): https://forum.minetest.net/viewtopic.php?f=11&t=6342 +* hud (optional): https://forum.minetest.net/viewtopic.php?f=11&t=6342 (see HUD.txt for configuration) * hudbars (optional): https://forum.minetest.net/viewtopic.php?f=11&t=11153 * vessels (optional): https://forum.minetest.net/viewtopic.php?id=2574 diff --git a/hud.conf.no_hunger b/hud.conf.no_hunger new file mode 100644 index 0000000..df4b15d --- /dev/null +++ b/hud.conf.no_hunger @@ -0,0 +1,40 @@ +--[[ + +Better HUD config file, without Hunger mod. + +This file mirrors the default settings of the Better HUD mod, +except that it moves the "breath" bar upwards to make room +for the "thirst" bar. + +Use this config file as a starting point if you *don't* have the +Hunger mod enabled. + +For more information, see hud.conf.example in the mods/hud +directory. + +]] + +HUD_SB_SIZE = { x = 24, y = 24 } + +--[[ Layout: + + ARMOR | (AIR) + HEALTH | THIRST + +]] + +HUD_HEALTH_POS = { x = 0.5, y = 1 } +HUD_HEALTH_OFFSET = { x = -262, y = -87 } + +-- not used +HUD_HUNGER_POS = { x = 0.5, y = 1 } +HUD_HUNGER_OFFSET = { x = 15, y = -133 } + +HUD_AIR_POS = { x = 0.5, y = 1 } +HUD_AIR_OFFSET = { x = 15, y = -110 } + +HUD_ARMOR_POS = { x = 0.5, y = 1 } +HUD_ARMOR_OFFSET = { x = -262, y = -110 } + +HUD_THIRST_POS = { x = 0.5, y = 1 } +HUD_THIRST_OFFSET = { x = 15, y = -87 } diff --git a/hud.conf.with_hunger b/hud.conf.with_hunger new file mode 100644 index 0000000..6565c8d --- /dev/null +++ b/hud.conf.with_hunger @@ -0,0 +1,43 @@ +--[[ + +Better HUD config file, with Hunger mod. + +This file mirrors the default settings of the Better HUD mod, +except that it moves the "breath" bar upwards to make room +for the "thirst" bar. + +Use this config file as a starting point if you *do* have the +Hunger mod enabled. + +For more information, see hud.conf.example in the mods/hud +directory. + +]] + +HUD_SB_SIZE = { x = 24, y = 24 } + +--[[ Layout: + + (AIR) + ARMOR | THIRST + HEALTH | HUNGER + +]] + +HUD_HEALTH_POS = { x = 0.5, y = 1 } +HUD_HEALTH_OFFSET = { x = -262, y = -87 } + +-- At the time of writing, the Hunger mod contains code to swap +-- the positions of "hunger" and "air", so these positions are +-- "un-swapped"... +HUD_HUNGER_POS = { x = 0.5, y = 1 } +HUD_HUNGER_OFFSET = { x = 15, y = -133 } + +HUD_AIR_POS = { x = 0.5, y = 1 } +HUD_AIR_OFFSET = { x = 15, y = -87 } + +HUD_ARMOR_POS = { x = 0.5, y = 1 } +HUD_ARMOR_OFFSET = { x = -262, y = -110 } + +HUD_THIRST_POS = { x = 0.5, y = 1 } +HUD_THIRST_OFFSET = { x = 15, y = -110 } diff --git a/init.lua b/init.lua index 1cdcac8..9f39375 100644 --- a/init.lua +++ b/init.lua @@ -105,16 +105,18 @@ if minetest.get_modpath("hudbars") then hb.change_hudbar(player, 'thirst', thirsty.hud_clamp(value), 20) end elseif minetest.get_modpath("hud") then - -- API.txt + -- default positions follow [hud] defaults + local position = HUD_THIRST_POS or { x=0.5, y=1 } + local offset = HUD_THIRST_OFFSET or { x=15, y=-133} -- above AIR hud.register('thirst', { hud_elem_type = "statbar", - position = { x=0.5, y=1 }, + position = position, text = "thirsty_cup_100_24.png", background = "thirsty_cup_0_24.png", number = 20, max = 20, - size = { x=24, y=24 }, - offset = { x=25, y=-(48+24+16+32)}, + size = HUD_SD_SIZE, -- by default { x=24, y=24 }, + offset = offset, }) function thirsty.hud_init(player) -- automatic by [hud]