From af9646ec074e23c31c1a48a78d78d283f37799d9 Mon Sep 17 00:00:00 2001 From: epCode Date: Wed, 17 Feb 2021 14:31:40 -0800 Subject: [PATCH] Fix sprint activation --- mods/PLAYER/mcl_player/init.lua | 22 +++++++++++----------- mods/PLAYER/mcl_playerplus/init.lua | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/mods/PLAYER/mcl_player/init.lua b/mods/PLAYER/mcl_player/init.lua index 784fe0f2d..30955a645 100644 --- a/mods/PLAYER/mcl_player/init.lua +++ b/mods/PLAYER/mcl_player/init.lua @@ -171,32 +171,32 @@ 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 then + if controls.LMB and not controls.sneak and standing_on_water and is_sprinting == true then player_set_animation(player, "swim_walk_mine", animation_speed_mod) - elseif not controls.sneak and standing_on_water then + elseif not controls.sneak and standing_on_water and is_sprinting == true 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) - elseif controls.LMB and not controls.sneak and not standing_on_water then + elseif controls.LMB and not controls.sneak then player_set_animation(player, "walk_mine", animation_speed_mod) - elseif controls.LMB and controls.sneak and not standing_on_water then + elseif controls.LMB and controls.sneak and is_sprinting ~= true then player_set_animation(player, "sneak_walk_mine", animation_speed_mod) elseif is_sprinting == true and not controls.sneak and not standing_on_water then player_set_animation(player, "run_walk", animation_speed_mod) - elseif not controls.sneak and not standing_on_water then - player_set_animation(player, "walk", animation_speed_mod) - else + elseif controls.sneak and not controls.LMB then player_set_animation(player, "sneak_walk", animation_speed_mod) + else + player_set_animation(player, "walk", animation_speed_mod) end - elseif controls.LMB and not controls.sneak and standing_on_water then + elseif controls.LMB and not controls.sneak and standing_on_water and is_sprinting == true then player_set_animation(player, "swim_mine") - elseif controls.LMB and not controls.sneak and not standing_on_water then + elseif controls.LMB and not controls.sneak then player_set_animation(player, "mine") elseif controls.LMB and controls.sneak then player_set_animation(player, "sneak_mine") - elseif not controls.sneak and standing_on_water then + elseif not controls.sneak and standing_on_water and is_sprinting == true then player_set_animation(player, "swim_stand", animation_speed_mod) - elseif not controls.sneak and not standing_on_water then + elseif not controls.sneak then player_set_animation(player, "stand", animation_speed_mod) else player_set_animation(player, "sneak_stand", animation_speed_mod) diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index e588c7dad..119e55e5a 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -56,7 +56,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 then + 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 -- 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