1
0
Fork 0

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

View File

@ -62,7 +62,7 @@ minetest.register_globalstep(function(dtime)
if players[playerName]["shouldSprint"] == true then --Stopped
local sprinting
-- 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
else
sprinting = true

View File

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

View File

@ -61,7 +61,7 @@ minetest.register_globalstep(function(dtime)
end
-- 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
if players[playerName]["moving"] == false and playerInfo["state"] == 3 then --Stopped
setState(playerName, 0)