mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2025-04-21 14:55:15 +02:00
Fix bow and spear being thrown when right clicking activable blocks. (#4851)
Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4851 Reviewed-by: Mikita Wiśniewski <rudzik8@protonmail.com> Co-authored-by: Grillo del Mal <grillo@delmal.cl> Co-committed-by: Grillo del Mal <grillo@delmal.cl>
This commit is contained in:
parent
7e96774b06
commit
8e0feb5f4b
2 changed files with 11 additions and 2 deletions
|
@ -251,6 +251,10 @@ controls.register_on_release(function(player, key, time)
|
|||
local name = wielditem:get_name()
|
||||
if name == "mcl_bows:bow" or name == "mcl_bows:bow_enchanted" then
|
||||
local meta = wielditem:get_meta()
|
||||
if not core.is_yes(meta:get("active")) then
|
||||
reset_bow_state(player)
|
||||
return
|
||||
end
|
||||
local enchanted = mcl_enchanting.is_enchanted(name)
|
||||
local speed, damage
|
||||
local p_load = bow_load[player:get_player_name()]
|
||||
|
@ -315,7 +319,7 @@ controls.register_on_hold(function(player, key, time)
|
|||
local meta = wielditem:get_meta()
|
||||
if bow_load[name] == nil
|
||||
and (wielditem:get_name()=="mcl_bows:bow" or wielditem:get_name()=="mcl_bows:bow_enchanted")
|
||||
and (meta:get("active") or key == "zoom") and (creative or get_arrow(player)) then
|
||||
and (core.is_yes(meta:get("active")) or key == "zoom") and (creative or get_arrow(player)) then
|
||||
local enchanted = mcl_enchanting.is_enchanted(wielditem:get_name())
|
||||
local im_string = "mcl_bows_bow_0.png"
|
||||
if enchanted then im_string = im_string .. mcl_enchanting.overlay end
|
||||
|
|
|
@ -151,6 +151,11 @@ controls.register_on_release(function(player, key, time)
|
|||
if key~="RMB" and key~="zoom" then return end
|
||||
local wielditem = player:get_wielded_item()
|
||||
if core.get_item_group(wielditem:get_name(), "spear") < 1 then return end
|
||||
local meta = wielditem:get_meta()
|
||||
if not core.is_yes(meta:get("active")) then
|
||||
reset_spear_state(player)
|
||||
return
|
||||
end
|
||||
local pname = player:get_player_name()
|
||||
local raise_moment = spear_raise_time[pname] or 0
|
||||
local power = math.max(math.min((core.get_us_time() - raise_moment)
|
||||
|
@ -168,7 +173,7 @@ controls.register_on_hold(function(player, key, time)
|
|||
return
|
||||
end
|
||||
local meta = wielditem:get_meta()
|
||||
if spear_raise_time[name] == nil and (meta:get("active") or key == "zoom") then
|
||||
if spear_raise_time[name] == nil and (core.is_yes(meta:get("active")) or key == "zoom") then
|
||||
meta:set_string("inventory_image", wielditem:get_definition().inventory_image .. "^[transformR90")
|
||||
player:set_wielded_item(wielditem)
|
||||
if core.get_modpath("playerphysics") then
|
||||
|
|
Loading…
Add table
Reference in a new issue