Enable player animation when Right Click (#2622)
authorMaksim <MoNTE48@mail.ua>
Mon, 6 Apr 2020 13:22:08 +0000 (15:22 +0200)
committerGitHub <noreply@github.com>
Mon, 6 Apr 2020 13:22:08 +0000 (15:22 +0200)
mods/player_api/api.lua

index 4cb3944b71966ea31ed33f415d1b369ea0eea49b..c1e578c9ac2fda2437afaf66568fe9aafb9a1dd5 100644 (file)
@@ -106,7 +106,7 @@ function minetest.calculate_knockback(player, ...)
 end
 
 -- Check each player and apply animations
-minetest.register_globalstep(function(dtime)
+minetest.register_globalstep(function()
        for _, player in pairs(minetest.get_connected_players()) do
                local name = player:get_player_name()
                local model_name = player_model[name]
@@ -134,13 +134,13 @@ minetest.register_globalstep(function(dtime)
                                        player_anim[name] = nil
                                        player_sneak[name] = controls.sneak
                                end
-                               if controls.LMB then
+                               if controls.LMB or controls.RMB then
                                        player_set_animation(player, "walk_mine", animation_speed_mod)
                                else
                                        player_set_animation(player, "walk", animation_speed_mod)
                                end
-                       elseif controls.LMB then
-                               player_set_animation(player, "mine")
+                       elseif controls.LMB or controls.RMB then
+                               player_set_animation(player, "mine", animation_speed_mod)
                        else
                                player_set_animation(player, "stand", animation_speed_mod)
                        end