From 23eb8437f4d77f9daa96a3bf89cbebd45dff6ee5 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Sun, 6 Aug 2023 13:21:45 -0400 Subject: [PATCH] default - revent knockback for attached players * backported from default game https://github.com/minetest/minetest_game/commit/fbbc7fc9969a86ad820be68b2e5ad5b495629759 --- mods/default/player.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mods/default/player.lua b/mods/default/player.lua index 7179e8e..f7c34ab 100644 --- a/mods/default/player.lua +++ b/mods/default/player.lua @@ -135,6 +135,15 @@ end) local player_set_animation = default.player_set_animation local player_attached = default.player_attached +-- Prevent knockback for attached players +local old_calculate_knockback = minetest.calculate_knockback +function minetest.calculate_knockback(player, ...) + if player_attached[player:get_player_name()] then + return 0 + end + return old_calculate_knockback(player, ...) +end + -- Check each player and apply animations minetest.register_globalstep(function(dtime) for _, player in pairs(minetest.get_connected_players()) do