From d1ab5dd6972609ee37d598be4ff3ff61566f2c58 Mon Sep 17 00:00:00 2001 From: echoes91 Date: Tue, 17 Mar 2015 12:05:11 +0100 Subject: [PATCH] 1.0rc1 --- bows.lua | 142 +++++++++++++++++---------------- init.lua | 84 +++++++++++-------- textures/throwing_bow_wood.png | Bin 584 -> 581 bytes textures/throwing_longbow.png | Bin 0 -> 661 bytes throwing.conf | 1 + throwing.conf.example | 6 ++ 6 files changed, 132 insertions(+), 101 deletions(-) create mode 100644 textures/throwing_longbow.png create mode 100644 throwing.conf create mode 100644 throwing.conf.example diff --git a/bows.lua b/bows.lua index bac8893..0f9857d 100644 --- a/bows.lua +++ b/bows.lua @@ -1,4 +1,8 @@ -local stiffness= 0 +--~ +--~ Shot and reload system +--~ + +local stiffness= 0 local reload = 0 minetest.register_on_joinplayer(function(player) @@ -69,14 +73,18 @@ local function reloading (player) minetest.after(reload, reloaded, player, throwing_hud) end -if not disable_wooden_bow then +--~ +--~ Bows +--~ + +if not DISABLE_WOODEN_BOW then minetest.register_tool("throwing:bow_wood", { description = "Wooden Bow", inventory_image = "throwing_bow_wood.png", wield_scale = {x=1, y=1, z=0.5}, stack_max = 1, on_use = function(itemstack, user, pointed_thing) - stiffness = 13 + stiffness = 11 reload = 1.2 if throwing_shoot_arrow(itemstack, user, pointed_thing) then reloading(user) @@ -91,69 +99,31 @@ if not disable_wooden_bow then minetest.register_craft({ output = 'throwing:bow_wood', recipe = { - {'farming:string', 'group:wood', ''}, - {'farming:string', '', 'group:wood'}, - {'farming:string', 'group:wood', ''}, + {'', 'default:stick', ''}, + {'farming:string', '', 'default:stick'}, + {'', 'default:stick', ''}, } }) minetest.register_craft({ output = 'throwing:bow_wood', recipe = { - {'', 'group:wood', 'farming:string'}, - {'group:wood', '', 'farming:string'}, - {'', 'group:wood', 'farming:string'}, + {'', 'default:stick', ''}, + {'default:stick', '', 'farming:string'}, + {'', 'default:stick', ''}, } }) end -if not disable_golden_bow then -- To be changed soon - minetest.register_tool("throwing:bow_gold", { - description = "Golden Bow", - inventory_image = "throwing_bow_gold.png", - wield_scale = {x=1, y=1, z=0.5}, - stack_max = 1, - on_use = function(itemstack, user, pointed_thing) - stiffness = 16 - reload = 1.6 - if throwing_shoot_arrow(itemstack, user, pointed_thing) then - reloading(user) - if not minetest.setting_getbool("creative_mode") then - itemstack:add_wear(65535/400) - end - end - return itemstack - end, - }) - - minetest.register_craft({ - output = 'throwing:bow_gold', - recipe = { - {'farming:string', 'default:gold_ingot', ''}, - {'farming:string', '', 'default:gold_ingot'}, - {'farming:string', 'default:gold_ingot', ''}, - } - }) - - minetest.register_craft({ - output = 'throwing:bow_gold', - recipe = { - {'', 'default:gold_ingot', 'farming:string'}, - {'default:gold_ingot', '', 'farming:string'}, - {'', 'default:gold_ingot', 'farming:string'}, - } - }) -end - -if not disable_composite_bow then - minetest.register_tool("throwing:bow_composite", { - description = "Composite Bow", - inventory_image = "throwing_bow_composite.png", - wield_scale = {x=1, y=1, z=0.5}, +if not DISABLE_LONGBOW then + minetest.register_tool("throwing:longbow", { + description = "Longbow", + inventory_image = "throwing_longbow.png", + wield_scale = {x=1, y=2.5, z=0.5}, stack_max = 1, on_use = function(itemstack, user, pointed_thing) stiffness = 18 - reload = 1.4 + reload = 2.5 if throwing_shoot_arrow(itemstack, user, pointed_thing) then reloading(user) if not minetest.setting_getbool("creative_mode") then @@ -163,39 +133,77 @@ if not disable_composite_bow then return itemstack end, }) - + minetest.register_craft({ - output = 'throwing:bow_composite', + output = 'throwing:longbow', recipe = { {'farming:string', 'group:wood', ''}, - {'farming:string', 'default:steel_ingot', 'default:steel_ingot'}, + {'farming:string', '', 'group:wood'}, {'farming:string', 'group:wood', ''}, } }) - + minetest.register_craft({ - output = 'throwing:bow_composite', + output = 'throwing:longbow', recipe = { {'', 'group:wood', 'farming:string'}, - {'default:steel_ingot', 'default:steel_ingot', 'farming:string'}, + {'group:wood', '', 'farming:string'}, {'', 'group:wood', 'farming:string'}, } }) end -if not disable_steel_bow then - minetest.register_tool("throwing:bow_steel", { - description = "Steel Bow", - inventory_image = "throwing_bow_steel.png", - wield_scale = {x=1, y=1, z=0.5}, +if not DISABLE_COMPOSITE_BOW then + minetest.register_tool("throwing:bow_composite", { + description = "Composite Bow", + inventory_image = "throwing_bow_composite.png", + wield_scale = {x=1, y=1.4, z=0.5}, stack_max = 1, on_use = function(itemstack, user, pointed_thing) - stiffness = 20 - reload = 1.6 + stiffness = 18 + reload = 1.5 if throwing_shoot_arrow(itemstack, user, pointed_thing) then reloading(user) if not minetest.setting_getbool("creative_mode") then - itemstack:add_wear(65535/200) + itemstack:add_wear(65535/150) + end + end + return itemstack + end, + }) + + minetest.register_craft({ + output = 'throwing:bow_composite', + recipe = { + {'farming:string', 'group:wood', ''}, + {'farming:string', '', 'default:steel_ingot'}, + {'farming:string', 'group:wood', ''}, + } + }) + + minetest.register_craft({ + output = 'throwing:bow_composite', + recipe = { + {'', 'group:wood', 'farming:string'}, + {'default:steel_ingot', '', 'farming:string'}, + {'', 'group:wood', 'farming:string'}, + } + }) +end + +if not DISABLE_STEEL_BOW then + minetest.register_tool("throwing:bow_steel", { + description = "Steel Bow", + inventory_image = "throwing_bow_steel.png", + wield_scale = {x=1, y=1.4, z=0.5}, + stack_max = 1, + on_use = function(itemstack, user, pointed_thing) + stiffness = 20 + reload = 1.7 + if throwing_shoot_arrow(itemstack, user, pointed_thing) then + reloading(user) + if not minetest.setting_getbool("creative_mode") then + itemstack:add_wear(65535/250) end end return itemstack diff --git a/init.lua b/init.lua index 5ecdb89..39806fc 100644 --- a/init.lua +++ b/init.lua @@ -13,42 +13,58 @@ arrows = { {"throwing:arrow_fireworks_blue", "throwing:arrow_fireworks_blue_entity"}, } -dofile(minetest.get_modpath("throwing").."/config.lua") -dofile(minetest.get_modpath("throwing").."/bows.lua") -if not disable_steel_arrow then - dofile(minetest.get_modpath("throwing").."/steel_arrow.lua") -end -if not disable_stone_arrow then - dofile(minetest.get_modpath("throwing").."/stone_arrow.lua") -end -if not disable_stone_arrow then - dofile(minetest.get_modpath("throwing").."/obsidian_arrow.lua") -end -if not disable_fire_arrow then - dofile(minetest.get_modpath("throwing").."/fire_arrow.lua") -end -if not disable_teleport_arrow then - dofile(minetest.get_modpath("throwing").."/teleport_arrow.lua") -end -if not disable_dig_arrow then - dofile(minetest.get_modpath("throwing").."/dig_arrow.lua") -end -if not disable_build_arrow then - dofile(minetest.get_modpath("throwing").."/build_arrow.lua") -end -if not disable_tnt_arrow then - dofile(minetest.get_modpath("throwing").."/tnt_arrow.lua") -end -if not disable_torch_arrow then - dofile(minetest.get_modpath("throwing").."/torch_arrow.lua") -end -if not disable_diamond_arrow then - dofile(minetest.get_modpath("throwing").."/diamond_arrow.lua") -end -if not disable_shell_arrow then - dofile(minetest.get_modpath("throwing").."/shell_arrow.lua") +local input = io.open(minetest.get_modpath("throwing").."/throwing.conf", "r") +if input then + dofile(minetest.get_modpath("throwing").."/throwing.conf") + input:close() + input = nil end +dofile(minetest.get_modpath("throwing").."/bows.lua") + +if not DISABLE_STEEL_ARROW then + dofile(minetest.get_modpath("throwing").."/steel_arrow.lua") +end + +if not DISABLE_STONE_ARROW then + dofile(minetest.get_modpath("throwing").."/stone_arrow.lua") +end + +if not DISABLE_STONE_ARROW then + dofile(minetest.get_modpath("throwing").."/obsidian_arrow.lua") +end + +if not DISABLE_FIRE_ARROW then + dofile(minetest.get_modpath("throwing").."/fire_arrow.lua") +end + +if not DISABLE_TELEPORT_ARROW then + dofile(minetest.get_modpath("throwing").."/teleport_arrow.lua") +end + +if not DISABLE_DIG_ARROW then + dofile(minetest.get_modpath("throwing").."/dig_arrow.lua") +end + +if not DISABLE_BUILD_ARROW then + dofile(minetest.get_modpath("throwing").."/build_arrow.lua") +end + +if not DISABLE_TNT_ARROW then + dofile(minetest.get_modpath("throwing").."/tnt_arrow.lua") +end + +if not DISABLE_TORCH_ARROW then + dofile(minetest.get_modpath("throwing").."/torch_arrow.lua") +end + +if not DISABLE_DIAMOND_ARROW then + dofile(minetest.get_modpath("throwing").."/diamond_arrow.lua") +end + +if not DISABLE_SHELL_ARROW then + dofile(minetest.get_modpath("throwing").."/shell_arrow.lua") +end if minetest.setting_get("log_mods") then minetest.log("action", "throwing loaded") diff --git a/textures/throwing_bow_wood.png b/textures/throwing_bow_wood.png index cb1944e3ca7b11991f1fbc0596bd76b2bd65523b..8b0f018ba2ea1d0b753e15cc2c3d60aa298a0e89 100644 GIT binary patch delta 507 zcmVN8q#3+ao3qcUh z!op4zgp)&vO)4#{G+bkGSK3+l2L%fYi7~x47QxC!P7kz7D|(G!a}sP$NI2PJ$?V*- zn9SU+r_;>9&iD4s_kNzxW*6n_QA7!v0k0FN%DtgTkz!#gmU%)-t&ilP9Zc69KN{<{Y(EKRTlI%nYL zE^=g77<>ac_NxM`DymAFrrup}5QGg!|8Lt`8$l5PAlVN|w0&Zf{u90`ix^{~Y-_DA zkmV5O{Om@`-L1VD_=*UQ-`qZH5D|}8eap8_OMF7N z+r@;xXJdHzyj_98Pr(>J;#OTq_LGyQDa~dRxqlrkXFI?m5@#LkhpdDhAn9+z-*6CA xmKLm+;c}Gq+RBUAc9JCIc^)r@*_R_9)*pP>BG9TbVA}uy002ovPDHLkV1m@H?ezcv delta 510 zcmVO7$2As7d7Xk53Km!Bc{X<1SOhD(Xh5r23I?&TP)Q>xB2N+?w{PEA zth;%++%&tze6usZ`K_ob)p&I20GA)XqtR#pu)QuU)zL`~n_Adk!v&0)Jx+iE|EshZj?}*M+G?1AKIhl;tAqoTDfT|M1f_SgJFp_FxFd{)qhe zrrdhgnuAr9vMfmwKYdUx!lMl7^!-?SU$)kgrfD1*AgP*Ua|=0D<05{&UH-dGm?Ye$-;M1&07*qoM6N<$f~rOF Ao&W#< diff --git a/textures/throwing_longbow.png b/textures/throwing_longbow.png new file mode 100644 index 0000000000000000000000000000000000000000..040a8c167608eb445a0beb311f51dad37b2862b5 GIT binary patch literal 661 zcmV;G0&4wL}000McNliru-vbX6G!kRO=g$BD0wPI7 zK~y-)Ws*-w6j2<O zeVrqL0Wx0@5e7S@fbZ)uTnl2|SD%#Uk4N@Z4uXKDrY79n+I_ygyT{F^mO?kQM{Rnd z<1k--l;!VdkfWO!II-9BJOJEtC*j7!*s7#qODiRrnO8WHg@Yi#bzM{y$8qAuH-_Zn zgH|2ukE;}?hAB=BYf|wnEm&)@))Iyx^?E%PYV^5MwT#Xw&!)3~J|jXzh3m%+B7!l7 z#l=Nb6_X@vd&hEqY+Z`Ey$yp8stk6y v3t%(X$K{JN>9ZZjp;oJ<7ZWFvedG8CkLGVDxYLSM00000NkvXXu0mjfA2}#~ literal 0 HcmV?d00001 diff --git a/throwing.conf b/throwing.conf new file mode 100644 index 0000000..6345fe4 --- /dev/null +++ b/throwing.conf @@ -0,0 +1 @@ +DISABLE_TNT_ARROW = true \ No newline at end of file diff --git a/throwing.conf.example b/throwing.conf.example new file mode 100644 index 0000000..54dabd7 --- /dev/null +++ b/throwing.conf.example @@ -0,0 +1,6 @@ +# You can disable any bow and arrow by writing lines like these inside throwing.conf +# +# DISABLE_WOODEN_BOW = true +# +# DISABLE_TNT_ARROW = true +