From 541f102b15ab8ddfd2c70e22a4528e5b0b01f4f2 Mon Sep 17 00:00:00 2001 From: upsilon Date: Tue, 20 Jun 2017 17:32:00 +0200 Subject: [PATCH] Add a "uses" field, add a gold bow --- README.md | 1 + init.lua | 4 ++-- registration.lua | 24 ++++++++++++++++++------ textures/throwing_bow_gold.png | Bin 0 -> 466 bytes 4 files changed, 21 insertions(+), 8 deletions(-) create mode 100644 textures/throwing_bow_gold.png 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 0000000000000000000000000000000000000000..56ad7a7a48ef9d1cd923f3cb8bb69bc9a47970ce GIT binary patch literal 466 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbMf)c~Im*Q+lT{bU$|6c~c#8N!tr zBjgz(6d59v7$Q`dA{7{-R2XBF8DdlzVpN%8l^9~RIO9|p;(TOXyP@&muJogu znvbt3J%0T7$&)8fZ>v3j{`>_Hd^LV~ng8X>m#<#Edi_xP^=qv+Z{ECptNj)TzKFm5 zul422m#_C_zJC4s{rmTyuS9=6(){&8`PZ*sf1auQc`Negoxz_^x_|x~{(Z0a_otTs zzLh_L9%L*D@(X5gcy=QV#7XjYcVXyYmGuB}I14-?iy0WWg+Z8+Vb&Z8pdfpRr>`sf zLpBk98E$L7DeOR@GEW!B5Q)pl2?|0l8U-bo8+WiY%ZWI!sN9TPsFS>cO-*h^gRP4_ z2Z!=%2Cw46&y5jX1&nNQVuA`Qd9E@k%{=-;QeusumV|_btEB`_%0w0kmKKT9B`Fht zjGH1$9JjP>Qxk}Y)OamDW6=+Hzc9YD?Vl8w7})Z-vL>s%Uj=jlgQu&X%Q~loCIDE8 BxF!Gq literal 0 HcmV?d00001