From bd7524d71241c2dc36b92483e29b8dabbd266e74 Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Tue, 31 Dec 2024 02:18:54 +0100 Subject: [PATCH] Actually working spear aiming animation --- mods/PLAYER/mcl_player/init.lua | 4 +++- mods/PLAYER/mcl_playerplus/init.lua | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mods/PLAYER/mcl_player/init.lua b/mods/PLAYER/mcl_player/init.lua index 83182fcc8..391fe1081 100644 --- a/mods/PLAYER/mcl_player/init.lua +++ b/mods/PLAYER/mcl_player/init.lua @@ -14,6 +14,7 @@ local function get_mouse_button(player) local get_wielded_item_name = player:get_wielded_item():get_name() if controls.RMB and not string.find(get_wielded_item_name, "mcl_bows:bow") and not string.find(get_wielded_item_name, "mcl_bows:crossbow") and + core.get_item_group(get_wielded_item_name, "spear") == 0 and not mcl_shields.wielding_shield(player, 1) and not mcl_shields.wielding_shield(player, 2) or controls.LMB then return true else @@ -263,7 +264,8 @@ minetest.register_globalstep(function(dtime) local wielded_itemname = player:get_wielded_item():get_name() local no_arm_moving = string.find(wielded_itemname, "mcl_bows:bow") or mcl_shields.wielding_shield(player, 1) or - mcl_shields.wielding_shield(player, 2) + mcl_shields.wielding_shield(player, 2) or + core.get_item_group(wielded_itemname, "spear") > 0 if player_sneak[name] ~= controls.sneak then player_anim[name] = nil player_sneak[name] = controls.sneak diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index e5434d861..1707108f8 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -284,7 +284,9 @@ minetest.register_globalstep(function(dtime) playerphysics.remove_physics_factor(player, "gravity", "mcl_playerplus:elytra") end - if wielded_def and wielded_def._mcl_toollike_wield then + if control.RMB and core.get_item_group(wielded:get_name(), "spear") > 0 then + set_bone_pos(player, "Wield_Item", vector.new(0, 5.2, 1.2), vector.new(-1.57, 5.7, 1.57)) + elseif wielded_def and wielded_def._mcl_toollike_wield then set_bone_pos(player, "Wield_Item", vector.new(0, 4.7, 3.1), vector.new(-1.57, 3.93, 1.57)) elseif string.find(wielded:get_name(), "mcl_bows:bow") then set_bone_pos(player, "Wield_Item", vector.new(1, 4, 0), vector.new(1.57, 2.27, 2.01)) @@ -316,7 +318,7 @@ minetest.register_globalstep(function(dtime) set_bone_pos(player, "Arm_Left_Pitch_Control", nil, left_arm_rot) -- controls arm for spear throwing elseif core.get_item_group(wielded:get_name(), "spear") > 0 and control.RMB then - local right_arm_rot = vector.new(pitch + 1.57, 0, pitch * -1 * .35) + local right_arm_rot = vector.new(pitch + 1.8, 0, pitch * -1 * .35) set_bone_pos(player, "Arm_Right_Pitch_Control", nil, right_arm_rot) -- controls right and left arms pitch when loading a crossbow elseif string.find(wielded:get_name(), "mcl_bows:crossbow_") then