Fix crash when sprinting

This commit is contained in:
Wuzzy 2017-02-22 13:28:03 +01:00
parent 7da471386b
commit c60cff8f81
3 changed files with 3 additions and 2 deletions

@ -62,7 +62,7 @@ minetest.register_globalstep(function(dtime)
if players[playerName]["shouldSprint"] == true then --Stopped if players[playerName]["shouldSprint"] == true then --Stopped
local sprinting local sprinting
-- Prevent sprinting if standing on soul sand or hungry -- Prevent sprinting if standing on soul sand or hungry
if playerplus[playerName].nod_stand == "mcl_nether:soul_sand" or mcl_hunger.get_hunger(player) <= 6 then if playerplus[playerName].nod_stand == "mcl_nether:soul_sand" or (mcl_hunger and mcl_hunger.get_hunger(player) <= 6) then
sprinting = false sprinting = false
else else
sprinting = true sprinting = true

@ -0,0 +1 @@
name = mcl_sprint

@ -61,7 +61,7 @@ minetest.register_globalstep(function(dtime)
end end
-- Prevent sprinting if standing on soul sand or hungry -- Prevent sprinting if standing on soul sand or hungry
local can_sprint = (playerplus[playerName].nod_stand ~= "mcl_nether:soul_sand") and (mcl_hunger.get_hunger(player) <= 6) local can_sprint = (playerplus[playerName].nod_stand ~= "mcl_nether:soul_sand") or (mcl_hunger and mcl_hunger.get_hunger(player) <= 6)
--Adjust player states --Adjust player states
if players[playerName]["moving"] == false and playerInfo["state"] == 3 then --Stopped if players[playerName]["moving"] == false and playerInfo["state"] == 3 then --Stopped
setState(playerName, 0) setState(playerName, 0)