Give the Player running animations

This commit is contained in:
epCode 2021-02-17 14:08:21 -08:00
parent 377c7c760d
commit 144607bc9c
4 changed files with 11 additions and 3 deletions

View File

@ -365,6 +365,8 @@ mcl_player.player_register_model("mcl_armor_character.b3d", {
swim_walk_mine = {x=389, y=408},
swim_stand = {x=434, y=434},
swim_mine = {x=411, y=430},
run_walk = {x=440, y=459},
run_walk_mine = {x=461, y=480},
},
})

View File

@ -31,6 +31,8 @@ mcl_player.player_register_model("character.b3d", {
sneak_mine = {x=346, y=366},
sneak_walk = {x=304, y=323},
sneak_walk_mine = {x=325, y=344},
run_walk = {x=440, y=460},
run_walk_mine = {x=461, y=481},
},
})
@ -155,11 +157,11 @@ minetest.register_globalstep(function(dtime)
end
-- ask if player is in a place which he should crawl
node_in_feet = minetest.registered_nodes[mcl_playerinfo[name].node_feet]
local node_in_feet = minetest.registered_nodes[mcl_playerinfo[name].node_feet]
-- ask if player is swiming
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_feet, "water") ~= 0
local is_sprinting = mcl_sprint.is_sprinting(name)
-- Apply animations based on what the player is doing
if player:get_hp() == 0 then
@ -173,10 +175,14 @@ minetest.register_globalstep(function(dtime)
player_set_animation(player, "swim_walk_mine", animation_speed_mod)
elseif not controls.sneak and standing_on_water 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
player_set_animation(player, "walk_mine", animation_speed_mod)
elseif controls.LMB and controls.sneak and not standing_on_water 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