Fix sprint activation

This commit is contained in:
epCode 2021-02-17 14:31:40 -08:00
parent 144607bc9c
commit af9646ec07
2 changed files with 12 additions and 12 deletions

View File

@ -171,32 +171,32 @@ minetest.register_globalstep(function(dtime)
player_anim[name] = nil player_anim[name] = nil
player_sneak[name] = controls.sneak player_sneak[name] = controls.sneak
end 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) 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) 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 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) 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) 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) player_set_animation(player, "sneak_walk_mine", animation_speed_mod)
elseif is_sprinting == true and not controls.sneak and not standing_on_water then elseif is_sprinting == true and not controls.sneak and not standing_on_water then
player_set_animation(player, "run_walk", animation_speed_mod) player_set_animation(player, "run_walk", animation_speed_mod)
elseif not controls.sneak and not standing_on_water then elseif controls.sneak and not controls.LMB then
player_set_animation(player, "walk", animation_speed_mod)
else
player_set_animation(player, "sneak_walk", animation_speed_mod) player_set_animation(player, "sneak_walk", animation_speed_mod)
else
player_set_animation(player, "walk", animation_speed_mod)
end 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") 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") player_set_animation(player, "mine")
elseif controls.LMB and controls.sneak then elseif controls.LMB and controls.sneak then
player_set_animation(player, "sneak_mine") 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) 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) player_set_animation(player, "stand", animation_speed_mod)
else else
player_set_animation(player, "sneak_stand", animation_speed_mod) player_set_animation(player, "sneak_stand", animation_speed_mod)

View File

@ -56,7 +56,7 @@ minetest.register_globalstep(function(dtime)
-- sets eye height, and nametag color accordingly -- 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 }}) 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 -- controls head pitch when swiming
player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90,0,0)) player:set_bone_position("Head", vector.new(0,6.3,0), vector.new(pitch+90,0,0))
-- sets eye height, and nametag color accordingly -- sets eye height, and nametag color accordingly