forked from minetest-mods/hbsprint
Add support for new hunger_ng API
This commit is contained in:
parent
b2e8c08265
commit
13cc9d522a
4
init.lua
4
init.lua
|
@ -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]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user