Add support for new hunger_ng API

This commit is contained in:
tacotexmex 2019-02-10 09:26:50 +01:00
parent b2e8c08265
commit 13cc9d522a

@ -87,7 +87,7 @@ local function drain_hunger(player, hunger, name)
hbhunger.hunger[name] = newhunger hbhunger.hunger[name] = newhunger
hbhunger.set_hunger_raw(player) hbhunger.set_hunger_raw(player)
elseif starve == "hunger_ng" then elseif starve == "hunger_ng" then
player:get_meta():set_int("hunger_ng:hunger", newhunger) hunger_ng.alter_hunger(name, - starve_drain, "Sprinting")
end end
end end
end end
@ -173,7 +173,7 @@ minetest.register_globalstep(function(dtime)
if starve == "hbhunger" then if starve == "hbhunger" then
hunger = tonumber(hbhunger.hunger[name]) hunger = tonumber(hbhunger.hunger[name])
elseif starve == "hunger_ng" then elseif starve == "hunger_ng" then
hunger = tonumber(player:get_meta():get("hunger_ng:hunger")) hunger = hunger_ng.get_hunger_information(name).hunger.exact
end end
if ground ~= nil then if ground ~= nil then
local ground_def = minetest.registered_nodes[ground.name] local ground_def = minetest.registered_nodes[ground.name]