diff options
author | Marcin <beyondlimits@10g.pl> | 2015-10-18 00:17:52 +0200 |
---|---|---|
committer | Marcin <beyondlimits@10g.pl> | 2015-10-18 00:18:23 +0200 |
commit | c1e604c140a9b0efe5cbaedb24efe7262a55208b (patch) | |
tree | 548c9c0be4522776a42db9593e3acf2b7ee1cbf3 /init.lua | |
parent | af0267b9f53c33dddab8ac9b1723d6ad296395c9 (diff) |
Prevent server from crashing when player logs in using specific name
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1,4 +1,5 @@ hunger = {} +hunger.players = {} hunger.food = {} HUNGER_TICK = 800 -- time in seconds after that 1 hunger point is taken @@ -31,10 +32,10 @@ if minetest.setting_getbool("enable_damage") then inv:set_size("hunger", 1) local name = player:get_player_name() - hunger[name] = {} - hunger[name].lvl = hunger.read(player) - hunger[name].exhaus = 0 - local lvl = hunger[name].lvl + hunger.players[name] = {} + hunger.players[name].lvl = hunger.read(player) + hunger.players[name].exhaus = 0 + local lvl = hunger.players[name].lvl if lvl > 20 then lvl = 20 end |