Add a "uses" field, add a gold bow

This commit is contained in:
upsilon 2017-06-20 17:32:00 +02:00
parent ccd667f9b7
commit 541f102b15
No known key found for this signature in database
GPG Key ID: A80DAE1F266E1C3C
4 changed files with 21 additions and 8 deletions

View File

@ -36,6 +36,7 @@ Definition: definition table, containing:
* description (highly recommended): description of the bow. * description (highly recommended): description of the bow.
* texture (essential): texture of the bow, shown in inventory. * texture (essential): texture of the bow, shown in inventory.
* groups (optional): groups of the item. * groups (optional): groups of the item.
* uses: number of uses of the bow (default is 50).
* allow_shot (optional): function(player, itemstack): * allow_shot (optional): function(player, itemstack):
- player: the player using the bow - player: the player using the bow
- itemstack: the itemstack of the bow - itemstack: the itemstack of the bow

View File

@ -310,7 +310,7 @@ function throwing.register_bow(name, def)
end end
if shoot_arrow(itemstack, user, def.throw_itself) then if shoot_arrow(itemstack, user, def.throw_itself) then
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/30) itemstack:add_wear(65535 / (def.uses or 50))
end end
end end
if def.throw_itself then if def.throw_itself then
@ -326,7 +326,7 @@ function throwing.register_bow(name, def)
if def.itemcraft then if def.itemcraft then
minetest.register_craft({ minetest.register_craft({
output = throwing.modname..":"..name, output = name,
recipe = { recipe = {
{"farming:cotton", def.itemcraft, ""}, {"farming:cotton", def.itemcraft, ""},
{"farming:cotton", "", def.itemcraft}, {"farming:cotton", "", def.itemcraft},

View File

@ -1,32 +1,44 @@
throwing.register_bow("bow_wood", { throwing.register_bow("bow_wood", {
itemcraft = "default:wood", itemcraft = "default:wood",
description = "Wooden Bow", description = "Wooden Bow",
texture = "throwing_bow_wood.png" texture = "throwing_bow_wood.png",
uses = 50
}) })
throwing.register_bow("bow_stone", { throwing.register_bow("bow_stone", {
itemcraft = "default:cobble", itemcraft = "default:cobble",
description = "Stone Bow", description = "Stone Bow",
texture = "throwing_bow_stone.png" texture = "throwing_bow_stone.png",
uses = 100
}) })
throwing.register_bow("bow_steel", { throwing.register_bow("bow_steel", {
itemcraft = "default:steel_ingot", itemcraft = "default:steel_ingot",
description = "Steel Bow", description = "Steel Bow",
texture = "throwing_bow_steel.png" texture = "throwing_bow_steel.png",
uses = 150
}) })
throwing.register_bow("bow_bronze", { throwing.register_bow("bow_bronze", {
itemcraft = "default:bronze_ingot", itemcraft = "default:bronze_ingot",
description = "Bronze Bow", description = "Bronze Bow",
texture = "throwing_bow_bronze.png" texture = "throwing_bow_bronze.png",
uses = 200
})
throwing.register_bow("bow_gold", {
itemcraft = "default:gold_ingot",
description = "Gold Bow",
texture = "throwing_bow_gold.png",
uses = 250
}) })
throwing.register_bow("bow_mese", { throwing.register_bow("bow_mese", {
itemcraft = "default:mese_crystal", itemcraft = "default:mese_crystal",
description = "Mese Bow", description = "Mese Bow",
texture = "throwing_bow_mese.png" texture = "throwing_bow_mese.png",
uses = 300
}) })
throwing.register_bow("bow_diamond", { throwing.register_bow("bow_diamond", {
itemcraft = "default:diamond", itemcraft = "default:diamond",
description = "Diamond Bow", description = "Diamond Bow",
texture = "throwing_bow_diamond.png" texture = "throwing_bow_diamond.png",
uses = 320
}) })
local function get_setting(name) local function get_setting(name)

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B