diff --git a/mods/hbhunger/depends.txt b/mods/hbhunger/depends.txt new file mode 100644 index 0000000..1cc6acf --- /dev/null +++ b/mods/hbhunger/depends.txt @@ -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? diff --git a/mods/hbhunger/init.lua b/mods/hbhunger/init.lua index 8d19e16..aec4911 100644 --- a/mods/hbhunger/init.lua +++ b/mods/hbhunger/init.lua @@ -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 @@ -45,7 +68,11 @@ dofile(minetest.get_modpath("hbhunger").."/hunger.lua") dofile(minetest.get_modpath("hbhunger").."/register_foods.lua") -- 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 local function update_hud(player) @@ -86,6 +113,7 @@ hbhunger.set_hunger_raw = function(player) end minetest.register_on_joinplayer(function(player) + if minetest.is_player(player) then local name = player:get_player_name() local inv = player:get_inventory() inv:set_size("hunger",1) @@ -95,14 +123,16 @@ minetest.register_on_joinplayer(function(player) hbhunger.poisonings[name] = 0 custom_hud(player) hbhunger.set_hunger_raw(player) + end end) minetest.register_on_respawnplayer(function(player) - -- reset hunger (and save) local name = player:get_player_name() + if minetest.is_player(player) and name then hbhunger.hunger[name] = hbhunger.SAT_INIT hbhunger.set_hunger_raw(player) hbhunger.exhaustion[name] = 0 + end end) local main_timer = 0 diff --git a/mods/hbhunger/locale/hbhunger.es.tr b/mods/hbhunger/locale/hbhunger.es.tr new file mode 100644 index 0000000..0ec642c --- /dev/null +++ b/mods/hbhunger/locale/hbhunger.es.tr @@ -0,0 +1,2 @@ +# textdomain:hbhunger +Satiation=Saciado diff --git a/mods/hbhunger/textures/hbhunger_bar_health_poison.png b/mods/hbhunger/textures/hbhunger_bar_health_poison.png index 255a287..516bf6b 100644 Binary files a/mods/hbhunger/textures/hbhunger_bar_health_poison.png and b/mods/hbhunger/textures/hbhunger_bar_health_poison.png differ diff --git a/mods/hbhunger/textures/hbhunger_bgicon.png b/mods/hbhunger/textures/hbhunger_bgicon.png deleted file mode 100644 index 07e21e7..0000000 Binary files a/mods/hbhunger/textures/hbhunger_bgicon.png and /dev/null differ diff --git a/mods/hbhunger/textures/hbhunger_icon.png b/mods/hbhunger/textures/hbhunger_icon.png index a5cc2a1..22447c1 100644 Binary files a/mods/hbhunger/textures/hbhunger_icon.png and b/mods/hbhunger/textures/hbhunger_icon.png differ diff --git a/mods/hbhunger/textures/hbhunger_icon_health_poison.png b/mods/hbhunger/textures/hbhunger_icon_health_poison.png index 8ce2db8..daf6d39 100644 Binary files a/mods/hbhunger/textures/hbhunger_icon_health_poison.png and b/mods/hbhunger/textures/hbhunger_icon_health_poison.png differ