Configuration from/for Better HUD mod

master
Ben Deutsch 2015-04-24 21:41:19 +02:00
parent 5ebbe0c176
commit c343d027a4
5 changed files with 107 additions and 5 deletions

17
HUD.txt Normal file
View File

@ -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'.

View File

@ -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

40
hud.conf.no_hunger Normal file
View File

@ -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 }

43
hud.conf.with_hunger Normal file
View File

@ -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 }

View File

@ -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]