diff --git a/README.md b/README.md index 1d37f7a..deb1554 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ Definition: definition table, containing: * description (highly recommended): description of the bow. * texture (essential): texture of the bow, shown in inventory. * groups (optional): groups of the item. + * uses: number of uses of the bow (default is 50). * allow_shot (optional): function(player, itemstack): - player: the player using the bow - itemstack: the itemstack of the bow diff --git a/init.lua b/init.lua index ace5be1..d3816f4 100644 --- a/init.lua +++ b/init.lua @@ -310,7 +310,7 @@ function throwing.register_bow(name, def) end if shoot_arrow(itemstack, user, def.throw_itself) then if not minetest.setting_getbool("creative_mode") then - itemstack:add_wear(65535/30) + itemstack:add_wear(65535 / (def.uses or 50)) end end if def.throw_itself then @@ -326,7 +326,7 @@ function throwing.register_bow(name, def) if def.itemcraft then minetest.register_craft({ - output = throwing.modname..":"..name, + output = name, recipe = { {"farming:cotton", def.itemcraft, ""}, {"farming:cotton", "", def.itemcraft}, diff --git a/registration.lua b/registration.lua index 2a7acf7..668ed29 100644 --- a/registration.lua +++ b/registration.lua @@ -1,32 +1,44 @@ throwing.register_bow("bow_wood", { itemcraft = "default:wood", description = "Wooden Bow", - texture = "throwing_bow_wood.png" + texture = "throwing_bow_wood.png", + uses = 50 }) throwing.register_bow("bow_stone", { itemcraft = "default:cobble", description = "Stone Bow", - texture = "throwing_bow_stone.png" + texture = "throwing_bow_stone.png", + uses = 100 }) throwing.register_bow("bow_steel", { itemcraft = "default:steel_ingot", description = "Steel Bow", - texture = "throwing_bow_steel.png" + texture = "throwing_bow_steel.png", + uses = 150 }) throwing.register_bow("bow_bronze", { itemcraft = "default:bronze_ingot", 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", { itemcraft = "default:mese_crystal", description = "Mese Bow", - texture = "throwing_bow_mese.png" + texture = "throwing_bow_mese.png", + uses = 300 }) throwing.register_bow("bow_diamond", { itemcraft = "default:diamond", description = "Diamond Bow", - texture = "throwing_bow_diamond.png" + texture = "throwing_bow_diamond.png", + uses = 320 }) local function get_setting(name) diff --git a/textures/throwing_bow_gold.png b/textures/throwing_bow_gold.png new file mode 100644 index 0000000..56ad7a7 Binary files /dev/null and b/textures/throwing_bow_gold.png differ