Drop charging bows as uncharged bow

This commit is contained in:
Wuzzy 2018-05-07 17:56:17 +02:00
parent adc86232ee
commit 7a208e3cd8
1 changed files with 20 additions and 26 deletions

View File

@ -89,6 +89,7 @@ local player_shoot_arrow = function(itemstack, player, power, damage)
return true return true
end end
-- Bow item, uncharged state
minetest.register_tool("mcl_throwing:bow", { minetest.register_tool("mcl_throwing:bow", {
description = "Bow", description = "Bow",
_doc_items_longdesc = [[Bows are ranged weapons to shoot arrows at your foes. _doc_items_longdesc = [[Bows are ranged weapons to shoot arrows at your foes.
@ -105,32 +106,25 @@ The speed and damage of the arrow increases the longer you charge. The regular d
groups = {weapon=1,weapon_ranged=1}, groups = {weapon=1,weapon_ranged=1},
}) })
minetest.register_tool("mcl_throwing:bow_0", { -- Bow in charging state
for level=0, 2 do
minetest.register_tool("mcl_throwing:bow_"..level, {
description = "Bow", description = "Bow",
_doc_items_create_entry = false, _doc_items_create_entry = false,
inventory_image = "mcl_throwing_bow_0.png", inventory_image = "mcl_throwing_bow_"..level..".png",
stack_max = 1, stack_max = 1,
range = 0, -- Pointing range to 0 to prevent punching with bow :D range = 0, -- Pointing range to 0 to prevent punching with bow :D
groups = {not_in_creative_inventory=1, not_in_craft_guide=1}, groups = {not_in_creative_inventory=1, not_in_craft_guide=1},
}) on_drop = function(itemstack, dropper, pos)
bow_load[player:get_player_name()] = nil
minetest.register_tool("mcl_throwing:bow_1", { bow_index[player:get_player_name()] = nil
description = "Bow", itemstack:set_name("mcl_throwing:bow")
_doc_items_create_entry = false, minetest.item_drop(itemstack, dropper, pos)
inventory_image = "mcl_throwing_bow_1.png", itemstack:take_item()
stack_max = 1, return itemstack
range = 0, end,
groups = {not_in_creative_inventory=1, not_in_craft_guide=1}, })
}) end
minetest.register_tool("mcl_throwing:bow_2", {
description = "Bow",
_doc_items_create_entry = false,
inventory_image = "mcl_throwing_bow_2.png",
stack_max = 1,
range = 0,
groups = {not_in_creative_inventory=1, not_in_craft_guide=1},
})
-- Resets all the bows in "charging" state back to their original stage -- Resets all the bows in "charging" state back to their original stage
local reset_bows = function(player) local reset_bows = function(player)