diff --git a/mods/PLAYER/mcl_player/init.lua b/mods/PLAYER/mcl_player/init.lua index e39e8f956..2cf9c4e08 100644 --- a/mods/PLAYER/mcl_player/init.lua +++ b/mods/PLAYER/mcl_player/init.lua @@ -156,10 +156,12 @@ minetest.register_globalstep(function(dtime) animation_speed_mod = animation_speed_mod / 2 end - -- ask if player is in a place which he should crawl - local node_in_feet = minetest.registered_nodes[mcl_playerinfo[name].node_feet] + + + -- ask if player should be crawling + local block_in_head = minetest.registered_nodes[mcl_playerinfo[name].node_head] -- ask if player is swiming - local standing_on_water = minetest.get_item_group(mcl_playerinfo[name].node_feet, "water") ~= 0 + local standing_on_water = minetest.get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 -- ask if player is sprinting local is_sprinting = mcl_sprint.is_sprinting(name) @@ -171,9 +173,9 @@ minetest.register_globalstep(function(dtime) player_anim[name] = nil player_sneak[name] = controls.sneak end - if controls.LMB and not controls.sneak and standing_on_water and is_sprinting == true then + if controls.LMB and not controls.sneak and standing_on_water and is_sprinting == true or block_in_head.walkable and controls.LMB then player_set_animation(player, "swim_walk_mine", animation_speed_mod) - elseif not controls.sneak and standing_on_water and is_sprinting == true then + elseif not controls.sneak and standing_on_water and is_sprinting == true or block_in_head.walkable then player_set_animation(player, "swim_walk", animation_speed_mod) elseif is_sprinting == true and controls.LMB and not controls.sneak and not standing_on_water then player_set_animation(player, "run_walk_mine", animation_speed_mod) @@ -188,8 +190,10 @@ minetest.register_globalstep(function(dtime) else player_set_animation(player, "walk", animation_speed_mod) end - elseif controls.LMB and not controls.sneak and standing_on_water and is_sprinting == true then + elseif controls.LMB and not controls.sneak and standing_on_water and is_sprinting == true or controls.LMB and block_in_head.walkable then player_set_animation(player, "swim_mine") + elseif not controls.LMB and not controls.sneak and standing_on_water and is_sprinting == true or not controls.LMB and block_in_head.walkable then + player_set_animation(player, "swim_stand") elseif controls.LMB and not controls.sneak then player_set_animation(player, "mine") elseif controls.LMB and controls.sneak then diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index 2918841bd..5d7917ed3 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -45,7 +45,7 @@ minetest.register_globalstep(function(dtime) -- sets eye height, and nametag color accordingly player:set_properties({collisionbox = {-0.35,0,-0.35,0.35,1.8,0.35}, eye_height = 1.35, nametag_color = { r = 225, b = 225, a = 0, g = 225 }}) - elseif minetest.get_item_group(mcl_playerinfo[name].node_feet, "water") ~= 0 and player:get_attach() == nil and mcl_sprint.is_sprinting(name) == true then + elseif minetest.get_item_group(mcl_playerinfo[name].node_head, "water") ~= 0 and player:get_attach() == nil and mcl_sprint.is_sprinting(name) == true or minetest.registered_nodes[mcl_playerinfo[name].node_head].walkable then -- controls head pitch when swiming player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90,0,0)) -- sets eye height, and nametag color accordingly