mirror of
https://git.minetest.land/Mineclonia/Mineclonia.git
synced 2024-11-19 10:55:09 +00:00
Allow rightclicking for bows at any time
This commit is contained in:
parent
4d0e1eb2e9
commit
64ae08073a
1 changed files with 20 additions and 23 deletions
|
@ -41,16 +41,21 @@ local player_shoot_arrow = function(itemstack, player)
|
|||
return false
|
||||
end
|
||||
|
||||
local powerup_function = function(nextbow)
|
||||
return function(itemstack, placer, pointed_thing)
|
||||
local wear = itemstack:get_wear()
|
||||
itemstack:replace(nextbow)
|
||||
itemstack:add_wear(wear)
|
||||
return itemstack
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_tool("mcl_throwing:bow", {
|
||||
description = "Bow",
|
||||
inventory_image = "mcl_throwing_bow.png",
|
||||
stack_max = 1,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local wear = itemstack:get_wear()
|
||||
itemstack:replace("mcl_throwing:bow_0")
|
||||
itemstack:add_wear(wear)
|
||||
return itemstack
|
||||
end,
|
||||
on_place = powerup_function("mcl_throwing:bow_0"),
|
||||
on_secondary_use = powerup_function("mcl_throwing:bow_0"),
|
||||
groups = {weapon=1,weapon_ranged=1},
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local wear = itemstack:get_wear()
|
||||
|
@ -69,12 +74,8 @@ minetest.register_tool("mcl_throwing:bow_0", {
|
|||
inventory_image = "mcl_throwing_bow_0.png",
|
||||
stack_max = 1,
|
||||
groups = {not_in_creative_inventory=1, not_in_craft_guide=1},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local wear = itemstack:get_wear()
|
||||
itemstack:replace("mcl_throwing:bow_1")
|
||||
itemstack:add_wear(wear)
|
||||
return itemstack
|
||||
end,
|
||||
on_place = powerup_function("mcl_throwing:bow_1"),
|
||||
on_secondary_use = powerup_function("mcl_throwing:bow_1"),
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local wear = itemstack:get_wear()
|
||||
itemstack:add_wear(wear)
|
||||
|
@ -92,12 +93,8 @@ minetest.register_tool("mcl_throwing:bow_1", {
|
|||
inventory_image = "mcl_throwing_bow_1.png",
|
||||
stack_max = 1,
|
||||
groups = {not_in_creative_inventory=1, not_in_craft_guide=1},
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
local wear = itemstack:get_wear()
|
||||
itemstack:replace("mcl_throwing:bow_2")
|
||||
itemstack:add_wear(wear)
|
||||
return itemstack
|
||||
end,
|
||||
on_place = powerup_function("mcl_throwing:bow_2"),
|
||||
on_secondary_use = powerup_function("mcl_throwing:bow_2"),
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local wear = itemstack:get_wear()
|
||||
itemstack:add_wear(wear)
|
||||
|
|
Loading…
Reference in a new issue