diff options
| author | BlockMen <nmuelll@web.de> | 2014-05-13 18:59:08 +0200 | 
|---|---|---|
| committer | BlockMen <nmuelll@web.de> | 2014-05-13 18:59:08 +0200 | 
| commit | 28754289b7c026b8f97a1b34119210c51173c1ec (patch) | |
| tree | 5d50c502c9d847683c45e909b83c60c2b72fd2c4 | |
| parent | 45eebf79c9fcfb94c022f74e50905b173ef79e7e (diff) | |
Compatibility update (scaling statbars)
| -rw-r--r-- | README.txt | 2 | ||||
| -rw-r--r-- | changelog.txt | 6 | ||||
| -rw-r--r-- | depends.txt | 2 | ||||
| -rw-r--r-- | init.lua | 36 | 
4 files changed, 35 insertions, 11 deletions
| @@ -1,6 +1,6 @@  Minetest mod "Better HUD"  ========================= -Version: 1.3 +Version: 1.3.1  License of source code: WTFPL  ----------------------------- diff --git a/changelog.txt b/changelog.txt index b823dd1..3a68841 100644 --- a/changelog.txt +++ b/changelog.txt @@ -63,3 +63,9 @@  - Add support for mods: seaplants[sea] and mobfcooking (by Xanthin)  - Tweaked hand image  - Player can die caus of starving now + +1.3.1 +----- +- Add compatibility for statbar scaling +- Fix typo in depends.txt +- Lower maintimer tick diff --git a/depends.txt b/depends.txt index af464fb..7d5b43b 100644 --- a/depends.txt +++ b/depends.txt @@ -7,7 +7,7 @@ fishing?  glooptest?  bushes?  docfarming? -farmingplus? +farming_plus?  mtfoods?  bushes_classic?  mushroom? @@ -16,6 +16,10 @@ local armor_hud = {}  local armor_hud_bg = {}  -- default settings + +HUD_SCALEABLE = false +HUD_SIZE = "" +   -- statbar positions  HUD_HEALTH_POS = {x=0.5,y=0.9}  HUD_HEALTH_OFFSET = {x=-175, y=2} @@ -26,7 +30,21 @@ HUD_AIR_OFFSET = {x=15,y=-15}  HUD_ARMOR_POS = {x=0.5,y=0.9}  HUD_ARMOR_OFFSET = {x=-175, y=-15} -HUD_TICK = 0.2 +-- dirty way to check for new statbars +if dump(minetest.hud_replace_builtin) ~= "nil" then +	HUD_SCALEABLE = true +	HUD_SIZE = {x=24, y=24} +	HUD_HEALTH_POS = {x=0.5,y=1} +	HUD_HEALTH_OFFSET = {x=-262, y=-87} +	HUD_HUNGER_POS = {x=0.5,y=1} +	HUD_HUNGER_OFFSET = {x=15, y=-87} +	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} +end + +HUD_TICK = 0.1  HUD_HUNGER_TICK = 300  HUD_ENABLE_HUNGER = minetest.setting_getbool("hud_hunger_enable") @@ -46,7 +64,7 @@ if set then  	set:close()  else  	if not HUD_ENABLE_HUNGER then -		HUD_AIR_OFFSET = {x=15,y=0} +		HUD_AIR_OFFSET = HUD_HUNGER_OFFSET  	end  end @@ -70,7 +88,7 @@ local function custom_hud(player)         	 player:hud_add({  		hud_elem_type = "statbar",  		position = HUD_HUNGER_POS, -		scale = {x=1, y=1}, +		size = HUD_SIZE,  		text = "hud_hunger_bg.png",  		number = 20,  		alignment = {x=-1,y=-1}, @@ -81,7 +99,7 @@ local function custom_hud(player)  	 hunger_hud[name] = player:hud_add({  		hud_elem_type = "statbar",  		position = HUD_HUNGER_POS, -		scale = {x=1, y=1}, +		size = HUD_SIZE,  		text = "hud_hunger_fg.png",  		number = h,  		alignment = {x=-1,y=-1}, @@ -92,7 +110,7 @@ local function custom_hud(player)          player:hud_add({  		hud_elem_type = "statbar",  		position = HUD_HEALTH_POS, -		scale = {x=1, y=1}, +		size = HUD_SIZE,  		text = "hud_heart_bg.png",  		number = 20,  		alignment = {x=-1,y=-1}, @@ -101,7 +119,7 @@ local function custom_hud(player)  	health_hud[name] = player:hud_add({  		hud_elem_type = "statbar",  		position = HUD_HEALTH_POS, -		scale = {x=1, y=1}, +		size = HUD_SIZE,  		text = "hud_heart_fg.png",  		number = player:get_hp(),  		alignment = {x=-1,y=-1}, @@ -112,7 +130,7 @@ local function custom_hud(player)  	air_hud[name] = player:hud_add({  		hud_elem_type = "statbar",  		position = HUD_AIR_POS, -		scale = {x=1, y=1}, +		size = HUD_SIZE,  		text = "hud_air_fg.png",  		number = 0,  		alignment = {x=-1,y=-1}, @@ -124,7 +142,7 @@ local function custom_hud(player)         armor_hud_bg[name] = player:hud_add({  		hud_elem_type = "statbar",  		position = HUD_ARMOR_POS, -		scale = {x=1, y=1}, +		size = HUD_SIZE,  		text = "hud_armor_bg.png",  		number = 0,  		alignment = {x=-1,y=-1}, @@ -133,7 +151,7 @@ local function custom_hud(player)  	armor_hud[name] = player:hud_add({  		hud_elem_type = "statbar",  		position = HUD_ARMOR_POS, -		scale = {x=1, y=1}, +		size = HUD_SIZE,  		text = "hud_armor_fg.png",  		number = 0,  		alignment = {x=-1,y=-1}, | 
