mirror of
git://repo.or.cz/minetest_hbhunger.git
synced 2024-12-23 16:30:20 +01:00
Fix hunger crash (2)
Thanks to Ombridride
This commit is contained in:
parent
2f37d00c59
commit
ac4a5ad22f
@ -371,6 +371,7 @@ function hbhunger.handle_node_actions(pos, oldnode, player, ext)
|
|||||||
end
|
end
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local exhaus = hbhunger.exhaustion[name]
|
local exhaus = hbhunger.exhaustion[name]
|
||||||
|
if exhaus == nil then return end
|
||||||
local new = HUNGER_EXHAUST_PLACE
|
local new = HUNGER_EXHAUST_PLACE
|
||||||
-- placenode event
|
-- placenode event
|
||||||
if not ext then
|
if not ext then
|
||||||
@ -380,7 +381,7 @@ function hbhunger.handle_node_actions(pos, oldnode, player, ext)
|
|||||||
if not pos and not oldnode then
|
if not pos and not oldnode then
|
||||||
new = HUNGER_EXHAUST_MOVE
|
new = HUNGER_EXHAUST_MOVE
|
||||||
end
|
end
|
||||||
exhaus = (exhaus or 0) + new
|
exhaus = exhaus + new
|
||||||
if exhaus > HUNGER_EXHAUST_LVL then
|
if exhaus > HUNGER_EXHAUST_LVL then
|
||||||
exhaus = 0
|
exhaus = 0
|
||||||
local h = tonumber(hbhunger.hunger[name])
|
local h = tonumber(hbhunger.hunger[name])
|
||||||
|
Loading…
Reference in New Issue
Block a user