From 39dfc72ac5fcc2121672288755d61a24f290683e Mon Sep 17 00:00:00 2001 From: epCode Date: Fri, 18 Dec 2020 16:29:21 -0800 Subject: [PATCH] Utilized the sneaking animations --- mods/PLAYER/mcl_player/init.lua | 34 ++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/mods/PLAYER/mcl_player/init.lua b/mods/PLAYER/mcl_player/init.lua index d2dca49ca3..2738d667e0 100644 --- a/mods/PLAYER/mcl_player/init.lua +++ b/mods/PLAYER/mcl_player/init.lua @@ -21,12 +21,16 @@ mcl_player.player_register_model("character.b3d", { textures = {"character.png", }, animations = { -- Standard animations. - stand = { x= 0, y= 79, }, - lay = { x=162, y=166, }, - walk = { x=168, y=187, }, - mine = { x=189, y=198, }, - walk_mine = { x=200, y=219, }, - sit = { x= 81, y=160, }, + stand = {x=0, y=79}, + lay = {x=162, y=166}, + walk = {x=168, y=187}, + mine = {x=189, y=198}, + walk_mine = {x=200, y=219}, + sit = {x=81, y=160}, + sneak_stand = {x=222, y=302}, + sneak_mine = {x=346, y=366}, + sneak_walk = {x=304, y=323}, + sneak_walk_mine = {x=325, y=345}, }, }) @@ -106,7 +110,7 @@ end minetest.register_on_joinplayer(function(player) mcl_player.player_attached[player:get_player_name()] = false mcl_player.player_set_model(player, "character.b3d") - player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30) + --player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30) player:set_fov(86.1) -- see >>> end) @@ -150,15 +154,23 @@ minetest.register_globalstep(function(dtime) player_anim[name] = nil player_sneak[name] = controls.sneak end - if controls.LMB then + if controls.LMB and not controls.sneak then player_set_animation(player, "walk_mine", animation_speed_mod) - else + elseif controls.LMB and controls.sneak then + player_set_animation(player, "sneak_walk_mine", animation_speed_mod) + elseif not controls.sneak then player_set_animation(player, "walk", animation_speed_mod) + else + player_set_animation(player, "sneak_walk", animation_speed_mod) end - elseif controls.LMB then + elseif controls.LMB and not controls.sneak then player_set_animation(player, "mine") - else + elseif controls.LMB and controls.sneak then + player_set_animation(player, "sneak_mine") + elseif not controls.sneak then player_set_animation(player, "stand", animation_speed_mod) + else + player_set_animation(player, "sneak_stand", animation_speed_mod) end end end