summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2015-07-01 02:11:34 +0200
committerWuzzy <almikes@aol.com>2015-07-01 02:11:34 +0200
commitac4a5ad22f46d08d08ebfe66ce01885e1681f3f0 (patch)
tree8ea29df6378e24945f6baf65a406698a10db5d18
parent2f37d00c5956a80801935fbabf650bc6151e5b2c (diff)
Fix hunger crash (2)
Thanks to Ombridride
-rw-r--r--hunger.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/hunger.lua b/hunger.lua
index 1d82ca1..4b11351 100644
--- a/hunger.lua
+++ b/hunger.lua
@@ -371,6 +371,7 @@ function hbhunger.handle_node_actions(pos, oldnode, player, ext)
end
local name = player:get_player_name()
local exhaus = hbhunger.exhaustion[name]
+ if exhaus == nil then return end
local new = HUNGER_EXHAUST_PLACE
-- placenode event
if not ext then
@@ -380,7 +381,7 @@ function hbhunger.handle_node_actions(pos, oldnode, player, ext)
if not pos and not oldnode then
new = HUNGER_EXHAUST_MOVE
end
- exhaus = (exhaus or 0) + new
+ exhaus = exhaus + new
if exhaus > HUNGER_EXHAUST_LVL then
exhaus = 0
local h = tonumber(hbhunger.hunger[name])