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
description = "Bow", for level=0, 2 do
_doc_items_create_entry = false, minetest.register_tool("mcl_throwing:bow_"..level, {
inventory_image = "mcl_throwing_bow_0.png", description = "Bow",
stack_max = 1, _doc_items_create_entry = false,
range = 0, -- Pointing range to 0 to prevent punching with bow :D inventory_image = "mcl_throwing_bow_"..level..".png",
groups = {not_in_creative_inventory=1, not_in_craft_guide=1}, stack_max = 1,
}) range = 0, -- Pointing range to 0 to prevent punching with bow :D
groups = {not_in_creative_inventory=1, not_in_craft_guide=1},
minetest.register_tool("mcl_throwing:bow_1", { on_drop = function(itemstack, dropper, pos)
description = "Bow", bow_load[player:get_player_name()] = nil
_doc_items_create_entry = false, bow_index[player:get_player_name()] = nil
inventory_image = "mcl_throwing_bow_1.png", itemstack:set_name("mcl_throwing:bow")
stack_max = 1, minetest.item_drop(itemstack, dropper, pos)
range = 0, itemstack:take_item()
groups = {not_in_creative_inventory=1, not_in_craft_guide=1}, return itemstack
}) end,
})
minetest.register_tool("mcl_throwing:bow_2", { end
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)