From 6f56c5cec9d2c6bedcc4b45ddc84c73304b96b8f Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 22 May 2017 23:21:29 +0200 Subject: [PATCH] Fix no exhaustion caused by being on top of water --- mods/PLAYER/mcl_hunger/init.lua | 2 +- mods/PLAYER/playerplus/init.lua | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mods/PLAYER/mcl_hunger/init.lua b/mods/PLAYER/mcl_hunger/init.lua index 09ef117d56..349e825779 100644 --- a/mods/PLAYER/mcl_hunger/init.lua +++ b/mods/PLAYER/mcl_hunger/init.lua @@ -16,7 +16,7 @@ mcl_hunger.EXHAUST_DIG = 5 -- after digging node mcl_hunger.EXHAUST_JUMP = 50 -- jump mcl_hunger.EXHAUST_SPRINT_JUMP = 200 -- TODO: jump while sprinting mcl_hunger.EXHAUST_ATTACK = 100 -- hit an enemy -mcl_hunger.EXHAUST_SWIM = 10 -- TODO: player movement in water +mcl_hunger.EXHAUST_SWIM = 10 -- player movement in water mcl_hunger.EXHAUST_SPRINT = 100 -- sprint (per node) mcl_hunger.EXHAUST_DAMAGE = 100 -- TODO (mostly done): taking damage (protected by armor) mcl_hunger.EXHAUST_REGEN = 6000 -- Regenerate 1 HP diff --git a/mods/PLAYER/playerplus/init.lua b/mods/PLAYER/playerplus/init.lua index 064a5529c6..3300e173c0 100644 --- a/mods/PLAYER/playerplus/init.lua +++ b/mods/PLAYER/playerplus/init.lua @@ -143,9 +143,8 @@ minetest.register_globalstep(function(dtime) end end - -- Underwater: Spawn bubble particles, cause exhaustion - - if minetest.get_item_group(playerplus[name].nod_head, "water") ~= 0 then + -- Swimming: Cause exhaustion + if minetest.get_item_group(playerplus[name].nod_head, "liquid") ~= 0 or minetest.get_item_group(playerplus[name].nod_feet, "liquid") ~= 0 or minetest.get_item_group(playerplus[name].nod_stand, "liquid") ~= 0 then local lastPos = playerplus_internal[name].lastPos if lastPos then local dist = vector.distance(lastPos, pos) @@ -156,6 +155,10 @@ minetest.register_globalstep(function(dtime) playerplus_internal[name].swimDistance = playerplus_internal[name].swimDistance - superficial end end + end + + -- Underwater: Spawn bubble particles + if minetest.get_item_group(playerplus[name].nod_head, "water") ~= 0 then minetest.add_particlespawner({ amount = 10,