Fix no exhaustion caused by being on top of water

This commit is contained in:
Wuzzy 2017-05-22 23:21:29 +02:00
parent eeb855c00a
commit 6f56c5cec9
2 changed files with 7 additions and 4 deletions

View file

@ -16,7 +16,7 @@ mcl_hunger.EXHAUST_DIG = 5 -- after digging node
mcl_hunger.EXHAUST_JUMP = 50 -- jump mcl_hunger.EXHAUST_JUMP = 50 -- jump
mcl_hunger.EXHAUST_SPRINT_JUMP = 200 -- TODO: jump while sprinting mcl_hunger.EXHAUST_SPRINT_JUMP = 200 -- TODO: jump while sprinting
mcl_hunger.EXHAUST_ATTACK = 100 -- hit an enemy 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_SPRINT = 100 -- sprint (per node)
mcl_hunger.EXHAUST_DAMAGE = 100 -- TODO (mostly done): taking damage (protected by armor) mcl_hunger.EXHAUST_DAMAGE = 100 -- TODO (mostly done): taking damage (protected by armor)
mcl_hunger.EXHAUST_REGEN = 6000 -- Regenerate 1 HP mcl_hunger.EXHAUST_REGEN = 6000 -- Regenerate 1 HP

View file

@ -143,9 +143,8 @@ minetest.register_globalstep(function(dtime)
end end
end end
-- Underwater: Spawn bubble particles, cause exhaustion -- 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
if minetest.get_item_group(playerplus[name].nod_head, "water") ~= 0 then
local lastPos = playerplus_internal[name].lastPos local lastPos = playerplus_internal[name].lastPos
if lastPos then if lastPos then
local dist = vector.distance(lastPos, pos) local dist = vector.distance(lastPos, pos)
@ -156,6 +155,10 @@ minetest.register_globalstep(function(dtime)
playerplus_internal[name].swimDistance = playerplus_internal[name].swimDistance - superficial playerplus_internal[name].swimDistance = playerplus_internal[name].swimDistance - superficial
end end
end end
end
-- Underwater: Spawn bubble particles
if minetest.get_item_group(playerplus[name].nod_head, "water") ~= 0 then
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 10, amount = 10,