Fix crash when sprinting
This commit is contained in:
parent
7da471386b
commit
c60cff8f81
|
@ -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
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
name = mcl_sprint
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue