mods - hudbars and hbarmor and hbhunger - player checks and texture minimize
* provide player checks for registering callbacks * provide spanish translations and backguar compat for older engine the translation fallback was provide with upload of mod * provide depends txt file for older engines * optimize textures and remove icos as same in hbarmor and hudbars * not set and icon for bar progress and remove background texture * provide more simplistic hudbar of hbhunger
30
mods/hbhunger/depends.txt
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
hudbars
|
||||||
|
default
|
||||||
|
flowers?
|
||||||
|
animalmaterials?
|
||||||
|
bucket?
|
||||||
|
bushes?
|
||||||
|
bushes_classic?
|
||||||
|
cooking?
|
||||||
|
creatures?
|
||||||
|
docfarming?
|
||||||
|
dwarves?
|
||||||
|
ethereal?
|
||||||
|
farming?
|
||||||
|
farming_plus?
|
||||||
|
ferns?
|
||||||
|
fishing?
|
||||||
|
fruit?
|
||||||
|
glooptest?
|
||||||
|
jkanimals?
|
||||||
|
jkfarming?
|
||||||
|
jkwine?
|
||||||
|
kpgmobs?
|
||||||
|
mobfcooking?
|
||||||
|
mobs?moretrees?
|
||||||
|
mtfoods?
|
||||||
|
mush45?
|
||||||
|
mushroom?
|
||||||
|
seaplants?
|
||||||
|
pizza?
|
||||||
|
nssm?
|
@ -1,4 +1,27 @@
|
|||||||
local S = minetest.get_translator("hbhunger")
|
local S
|
||||||
|
|
||||||
|
if minetest.get_translator ~= nil then
|
||||||
|
S = minetest.get_translator("hbhunger") -- 5.x translation function
|
||||||
|
else
|
||||||
|
if minetest.get_modpath("intllib") then
|
||||||
|
dofile(minetest.get_modpath("intllib") .. "/init.lua")
|
||||||
|
if intllib.make_gettext_pair then
|
||||||
|
gettext, ngettext = intllib.make_gettext_pair() -- new gettext method
|
||||||
|
else
|
||||||
|
gettext = intllib.Getter() -- old text file method
|
||||||
|
end
|
||||||
|
S = gettext
|
||||||
|
else -- boilerplate function
|
||||||
|
S = function(str, ...)
|
||||||
|
local args = {...}
|
||||||
|
return str:gsub("@%d+", function(match)
|
||||||
|
return args[tonumber(match:sub(2))]
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local N = function(s) return s end
|
||||||
|
|
||||||
if minetest.settings:get_bool("enable_damage") then
|
if minetest.settings:get_bool("enable_damage") then
|
||||||
|
|
||||||
@ -45,7 +68,11 @@ dofile(minetest.get_modpath("hbhunger").."/hunger.lua")
|
|||||||
dofile(minetest.get_modpath("hbhunger").."/register_foods.lua")
|
dofile(minetest.get_modpath("hbhunger").."/register_foods.lua")
|
||||||
|
|
||||||
-- register satiation hudbar
|
-- register satiation hudbar
|
||||||
hb.register_hudbar("satiation", 0xFFFFFF, S("Satiation"), { icon = "hbhunger_icon.png", bgicon = "hbhunger_bgicon.png", bar = "hbhunger_bar.png" }, hbhunger.SAT_INIT, hbhunger.SAT_MAX, false, nil, { format_value = "%.1f", format_max_value = "%d" })
|
local sicon = "hbhunger_icon.png"
|
||||||
|
if hb.settings.bar_type == "progress_bar" then
|
||||||
|
sicon = nil
|
||||||
|
end
|
||||||
|
hb.register_hudbar("satiation", 0xFFFFFF, S("Satiation"), { icon = sicon, bgicon = nil, bar = "hbhunger_bar.png" }, hbhunger.SAT_INIT, hbhunger.SAT_MAX, false, nil, { format_value = "%.1f", format_max_value = "%2d" })
|
||||||
|
|
||||||
-- update hud elemtens if value has changed
|
-- update hud elemtens if value has changed
|
||||||
local function update_hud(player)
|
local function update_hud(player)
|
||||||
@ -86,6 +113,7 @@ hbhunger.set_hunger_raw = function(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_on_joinplayer(function(player)
|
minetest.register_on_joinplayer(function(player)
|
||||||
|
if minetest.is_player(player) then
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local inv = player:get_inventory()
|
local inv = player:get_inventory()
|
||||||
inv:set_size("hunger",1)
|
inv:set_size("hunger",1)
|
||||||
@ -95,14 +123,16 @@ minetest.register_on_joinplayer(function(player)
|
|||||||
hbhunger.poisonings[name] = 0
|
hbhunger.poisonings[name] = 0
|
||||||
custom_hud(player)
|
custom_hud(player)
|
||||||
hbhunger.set_hunger_raw(player)
|
hbhunger.set_hunger_raw(player)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
minetest.register_on_respawnplayer(function(player)
|
minetest.register_on_respawnplayer(function(player)
|
||||||
-- reset hunger (and save)
|
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
|
if minetest.is_player(player) and name then
|
||||||
hbhunger.hunger[name] = hbhunger.SAT_INIT
|
hbhunger.hunger[name] = hbhunger.SAT_INIT
|
||||||
hbhunger.set_hunger_raw(player)
|
hbhunger.set_hunger_raw(player)
|
||||||
hbhunger.exhaustion[name] = 0
|
hbhunger.exhaustion[name] = 0
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local main_timer = 0
|
local main_timer = 0
|
||||||
|
2
mods/hbhunger/locale/hbhunger.es.tr
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# textdomain:hbhunger
|
||||||
|
Satiation=Saciado
|
Before Width: | Height: | Size: 151 B After Width: | Height: | Size: 112 B |
Before Width: | Height: | Size: 417 B |
Before Width: | Height: | Size: 522 B After Width: | Height: | Size: 145 B |
Before Width: | Height: | Size: 526 B After Width: | Height: | Size: 192 B |