From c60cff8f812464c9567a35063167124d5ec73587 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 22 Feb 2017 13:28:03 +0100 Subject: [PATCH] Fix crash when sprinting --- mods/PLAYER/mcl_sprint/esprint.lua | 2 +- mods/PLAYER/mcl_sprint/mod.conf | 1 + mods/PLAYER/mcl_sprint/wsprint.lua | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 mods/PLAYER/mcl_sprint/mod.conf diff --git a/mods/PLAYER/mcl_sprint/esprint.lua b/mods/PLAYER/mcl_sprint/esprint.lua index e7599b458a..9ce810fa76 100644 --- a/mods/PLAYER/mcl_sprint/esprint.lua +++ b/mods/PLAYER/mcl_sprint/esprint.lua @@ -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 diff --git a/mods/PLAYER/mcl_sprint/mod.conf b/mods/PLAYER/mcl_sprint/mod.conf new file mode 100644 index 0000000000..7a3692459f --- /dev/null +++ b/mods/PLAYER/mcl_sprint/mod.conf @@ -0,0 +1 @@ +name = mcl_sprint diff --git a/mods/PLAYER/mcl_sprint/wsprint.lua b/mods/PLAYER/mcl_sprint/wsprint.lua index 05c7cdb3bf..b6c2a5bf22 100644 --- a/mods/PLAYER/mcl_sprint/wsprint.lua +++ b/mods/PLAYER/mcl_sprint/wsprint.lua @@ -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)