diff --git a/defaults.lua b/defaults.lua index 912c49b..ef6833e 100755 --- a/defaults.lua +++ b/defaults.lua @@ -33,3 +33,5 @@ DISABLE_MITHRIL_ARROW = minetest.settings:get("DISABLE_MITHRIL_ARROW") or false -- Other THROWING_RECOVERY_CHANCE = minetest.settings:get("THROWING_RECOVERY_CHANCE") or 0.5 +DISABLE_MOREBLOCKS_CRAFT = minetest.settings:get("DISABLE_MOREBLOCKS_CRAFT") or false +DISABLE_VINES_CRAFT = minetest.settings:get("DISABLE_VINES_CRAFT") or false diff --git a/dig_arrow.lua b/dig_arrow.lua index a728f95..695e233 100755 --- a/dig_arrow.lua +++ b/dig_arrow.lua @@ -120,10 +120,3 @@ minetest.register_craft({ {'default:stick', 'default:stick', 'default:pick_steel'}, } }) - -minetest.register_craft({ - output = 'throwing:arrow_dig 4', - recipe = { - {'default:pick_steel', 'default:stick', 'default:stick'}, - } -}) diff --git a/fireworks_arrows.lua b/fireworks_arrows.lua index 0d405c9..a496c6a 100755 --- a/fireworks_arrows.lua +++ b/fireworks_arrows.lua @@ -151,12 +151,6 @@ local function throwing_register_fireworks(color, color2, desc) } }) - minetest.register_craft({ - output = 'throwing:arrow_fireworks_' .. color, - recipe = { - {'dye:' .. color, 'group:coal', 'default:stick'}, - } - }) end --~ Arrows diff --git a/functions.lua b/functions.lua index ca3677f..c9f599c 100755 --- a/functions.lua +++ b/functions.lua @@ -161,31 +161,24 @@ function throwing_register_bow (name, desc, scale, stiffness, reload_time, tough end, groups = {not_in_creative_inventory=1}, }) - - minetest.register_craft({ - output = 'throwing:' .. name, - recipe = craft - }) - - local craft_width = 1 - -- Since # isn't stable especially when there are nils in the table, count by hand - for _,v in ipairs(craft) do - for i,__ in ipairs(v) do - if i > craft_width then - craft_width = i - end + + for k,v in pairs(craft) do + if v ~= nil then + minetest.register_craft({ + output = 'throwing:' .. name, + recipe = v + }) end end - local rev_craft = {} - for i,y in ipairs(craft) do - rev_craft[i] = {} - for j,x in ipairs(y) do - rev_craft[i][craft_width-j+1] = x - end - end - minetest.register_craft({ - output = 'throwing:' .. name, - recipe = rev_craft - }) + end +function retrieveCraft(schematic, modname) + if modname ~= nil then + if minetest.get_modpath(modname) then + return schematic + end + else + return schematic + end +end diff --git a/init.lua b/init.lua index 201316f..e6add91 100755 --- a/init.lua +++ b/init.lua @@ -51,6 +51,6 @@ if minetest.get_modpath('vines') and not DISABLE_ROPE_ARROW then dofile(minetest.get_modpath("throwing").."/rope_arrow.lua") end -if minetest.get_modpath('lightning') and not DISABLE_LIGHTNING_ARROW then +if minetest.get_modpath('lightning') and minetest.get_modpath('lightning') and not DISABLE_LIGHTNING_ARROW then dofile(minetest.get_modpath("throwing").."/lightning_arrow.lua") end diff --git a/lightning_arrow.lua b/lightning_arrow.lua index d49b6c8..f91e413 100755 --- a/lightning_arrow.lua +++ b/lightning_arrow.lua @@ -125,7 +125,7 @@ THROWING_ARROW_ENTITY.on_step = function(self, dtime) puncher = minetest.get_player_by_name(self.player) end local speed = vector.length(self.object:getvelocity()) - local damage = ((speed + 20)^1.2)/10 + local damage = ((speed + 25)^1.2)/10 obj:punch(puncher, 1.0, { full_punch_interval=1.0, damage_groups={fleshy=damage}, @@ -161,9 +161,3 @@ minetest.register_craft({ } }) -minetest.register_craft({ - output = 'throwing:arrow_lightning', - recipe = { - {'default:obsidian_shard', 'default:mese_crystal', 'default:stick'}, - } -}) diff --git a/rope_arrow.lua b/rope_arrow.lua index 3647bf1..f0cef9a 100755 --- a/rope_arrow.lua +++ b/rope_arrow.lua @@ -131,9 +131,3 @@ minetest.register_craft({ } }) -minetest.register_craft({ - output = 'throwing:arrow_rope', - recipe = { - {'vines:rope_block', 'default:stick', 'default:stick'}, - } -}) diff --git a/settingtypes.txt b/settingtypes.txt index a8ab3e0..3bd2644 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -27,3 +27,7 @@ DISABLE_DIAMOND_ARROW (Disable Diamond Arrow) bool false DISABLE_MITHRIL_ARROW (Disable Mithril Arrow) bool false THROWING_RECOVERY_CHANCE (Arrow Recovery Chance) float 0.3 + +DISABLE_MOREBLOCKS_CRAFT (Low level bow crafting with ropes from moreblocks) bool false + +DISABLE_VINES_CRAFT (Low level bow crafting with vines from vines) bool false diff --git a/standard_arrows.lua b/standard_arrows.lua index f5b3893..36fcd9a 100755 --- a/standard_arrows.lua +++ b/standard_arrows.lua @@ -123,13 +123,6 @@ end {'default:stick', 'default:stick', craft}, } }) - - minetest.register_craft({ - output = 'throwing:arrow_' .. kind .. ' 4', - recipe = { - {craft, 'default:stick', 'default:stick'}, - } - }) end if not DISABLE_STONE_ARROW then @@ -137,15 +130,15 @@ if not DISABLE_STONE_ARROW then end if not DISABLE_STEEL_ARROW then - throwing_register_arrow_standard ('steel', 'Steel', 10, 'default:steel_ingot') + throwing_register_arrow_standard ('steel', 'Steel', 12, 'default:steel_ingot') end if not DISABLE_OBSIDIAN_ARROW then - throwing_register_arrow_standard ('obsidian', 'Obsidian', 15, 'default:obsidian') + throwing_register_arrow_standard ('obsidian', 'Obsidian', 18, 'default:obsidian') end if not DISABLE_DIAMOND_ARROW then - throwing_register_arrow_standard ('diamond', 'Diamond', 20, 'default:diamond') + throwing_register_arrow_standard ('diamond', 'Diamond', 25, 'default:diamond') end if minetest.get_modpath('moreores') and not DISABLE_MITHRIL_ARROW then diff --git a/teleport_arrow.lua b/teleport_arrow.lua index 02f8ec6..0fcfceb 100755 --- a/teleport_arrow.lua +++ b/teleport_arrow.lua @@ -121,13 +121,6 @@ minetest.register_entity("throwing:arrow_teleport_entity", THROWING_ARROW_ENTITY minetest.register_craft({ output = 'throwing:arrow_teleport', recipe = { - {'default:stick', 'default:stick', 'default:mese_crystal'} - } -}) - -minetest.register_craft({ - output = 'throwing:arrow_teleport', - recipe = { - {'default:mese_crystal', 'default:stick', 'default:stick'} + {'default:stick', 'default:copper_ingot', 'default:mese_crystal'} } }) diff --git a/textures/throwing_arrow_dig.png b/textures/throwing_arrow_dig.png index 6a1d443..32b9903 100755 Binary files a/textures/throwing_arrow_dig.png and b/textures/throwing_arrow_dig.png differ diff --git a/tnt_arrow.lua b/tnt_arrow.lua index 92dc4e7..ec5cd1d 100755 --- a/tnt_arrow.lua +++ b/tnt_arrow.lua @@ -180,9 +180,3 @@ minetest.register_craft({ } }) -minetest.register_craft({ - output = 'throwing:arrow_tnt', - recipe = { - {'default:bronze_ingot', 'group:coal', 'default:stick'}, - } -}) diff --git a/tools.lua b/tools.lua index dd67769..301296c 100755 --- a/tools.lua +++ b/tools.lua @@ -1,73 +1,119 @@ if not DISABLE_WOODEN_BOW then - throwing_register_bow ('bow_wood', 'Wooden bow', {x=1, y=1, z=0.5}, 20, 1, 25, false, { - {'', 'default:stick', ''}, - {'farming:string', '', 'default:stick'}, - {'', 'default:stick', ''}, - }) + throwing_register_bow ('bow_wood', 'Wooden bow', {x=1, y=1, z=0.5}, 18, 1, 50, false, { + retrieveCraft({ + {'', 'default:stick', ''}, + {'default:junglegrass', '', 'default:stick'}, + {'', 'default:stick', ''}, + }), + retrieveCraft({ + {'', 'default:stick', ''}, + {'farming:string', '', 'default:stick'}, + {'', 'default:stick', ''}, + }), + retrieveCraft({ + {'', 'default:stick', ''}, + {'group:vines', '', 'default:stick'}, + {'', 'default:stick', ''}, + }, "vines"), + retrieveCraft({ + {'', 'default:stick', ''}, + {'moreblocks:rope', '', 'default:stick'}, + {'', 'default:stick', ''}, + }, "moreblocks"), + }) end if not DISABLE_LONGBOW then - throwing_register_bow ('longbow', 'Longbow', {x=1, y=2.5, z=0.5}, 23, 2, 50, false, { - {'farming:string', 'group:wood', ''}, - {'farming:string', '', 'group:wood'}, - {'farming:string', 'group:wood', ''}, - }) + throwing_register_bow ('longbow', 'Longbow', {x=1, y=2.5, z=0.5}, 21, 2, 75, false, { + retrieveCraft({ + {'default:junglegrass', 'group:wood', ''}, + {'default:junglegrass', '', 'group:wood'}, + {'default:junglegrass', 'group:wood', ''}, + }), + retrieveCraft({ + {'farming:string', 'group:wood', ''}, + {'farming:string', '', 'group:wood'}, + {'farming:string', 'group:wood', ''}, + }), + retrieveCraft({ + {'group:vines', 'group:wood', ''}, + {'group:vines', '', 'group:wood'}, + {'group:vines', 'group:wood', ''}, + }, "vines"), + retrieveCraft({ + {'moreblocks:rope', 'group:wood', ''}, + {'moreblocks:rope', '', 'group:wood'}, + {'moreblocks:rope', 'group:wood', ''}, + }, "moreblocks"), + }) end if not DISABLE_COMPOSITE_BOW then - throwing_register_bow ('bow_composite', 'Composite bow', {x=1, y=1.4, z=0.5}, 25, 1.5, 100, false, { - {'farming:string', 'group:wood', ''}, - {'farming:string', '', 'default:steel_ingot'}, - {'farming:string', 'group:wood', ''}, - }) + throwing_register_bow ('bow_composite', 'Composite bow', {x=1, y=1.4, z=0.5}, 25, 1.5, 150, false, { + retrieveCraft({ + {'farming:string', 'group:wood', ''}, + {'farming:string', '', 'default:steel_ingot'}, + {'farming:string', 'group:wood', ''}, + }), + }) end if not DISABLE_STEEL_BOW then - throwing_register_bow ('bow_steel', 'Steel bow', {x=1, y=1.4, z=0.5}, 30, 2, 200, false, { - {'farming:string', 'default:steel_ingot', ''}, - {'farming:string', '', 'default:steel_ingot'}, - {'farming:string', 'default:steel_ingot', ''}, - }) + throwing_register_bow ('bow_steel', 'Steel bow', {x=1, y=1.4, z=0.5}, 30, 2, 300, false, { + retrieveCraft({ + {'farming:string', 'default:steel_ingot', ''}, + {'farming:string', '', 'default:steel_ingot'}, + {'farming:string', 'default:steel_ingot', ''}, + }), + }) end if not DISABLE_COMPOUND_BOW then throwing_register_bow ('compound_bow', 'Compound bow', {x=1, y=1.5, z=0.5}, 35, 1, 500, false, { - {'farming:string', 'default:steel_ingot', 'default:steel_ingot'}, - {'farming:string', '', 'default:steelblock'}, - {'farming:string', 'default:steel_ingot', 'default:steel_ingot'}, - }) + retrieveCraft({ + {'farming:string', 'default:steel_ingot', 'default:steel_ingot'}, + {'farming:string', '', 'default:steelblock'}, + {'farming:string', 'default:steel_ingot', 'default:steel_ingot'}, + }), + }) end ---function throwing_register_bow (name, desc, scale, stiffness, reload_time, toughness, is_cross, craft) - if not DISABLE_CROSSBOW then - throwing_register_bow ('crossbow', 'Crossbow', {x=1, y=1.3, z=0.5}, 45, 3.5, 150, true, { - {'default:steel_ingot', 'farming:string', ''}, - {'group:wood', 'farming:string', 'default:steelblock'}, - {'default:steel_ingot', 'farming:string', ''}, - }) + throwing_register_bow ('crossbow', 'Crossbow', {x=1, y=1.3, z=0.5}, 45, 3.5, 200, true, { + retrieveCraft({ + {'default:steel_ingot', 'farming:string', ''}, + {'group:wood', 'farming:string', 'default:steelblock'}, + {'default:steel_ingot', 'farming:string', ''}, + }), + }) end if not DISABLE_REPEATING_CROSSBOW then throwing_register_bow ('repeating_crossbow', 'Repeating crossbow', {x=1, y=1.3, z=0.5}, 25, 0.4, 100, true, { - {'group:wood', 'farming:string', 'group:wood'}, - {'default:steel_ingot', 'farming:string', 'default:steelblock'}, - {'group:wood', 'farming:string', 'group:wood'}, - }) + retrieveCraft({ + {'group:wood', 'farming:string', 'group:wood'}, + {'default:steel_ingot', 'farming:string', 'default:steelblock'}, + {'group:wood', 'farming:string', 'group:wood'}, + }), + }) end if not DISABLE_ARBALEST then - throwing_register_bow ('arbalest', 'Arbalest', {x=1, y=1.3, z=0.5}, 60, 5, 200, true, { - {'default:steel_ingot', 'farming:string', 'default:steel_ingot'}, - {'default:steelblock', 'farming:string', 'default:steelblock'}, - {'default:steel_ingot', 'farming:string', 'default:steel_ingot'}, - }) + throwing_register_bow ('arbalest', 'Arbalest', {x=1, y=1.3, z=0.5}, 60, 5, 500, true, { + retrieveCraft({ + {'default:steel_ingot', 'farming:string', 'default:steel_ingot'}, + {'default:steelblock', 'farming:string', 'default:steelblock'}, + {'default:steel_ingot', 'farming:string', 'default:steel_ingot'}, + }), + }) end if not DISABLE_AUTOMATED_ARBALEST then - throwing_register_bow ('arbalest_auto', 'Automated arbalest', {x=1, y=1.3, z=0.5}, 60, 2, 200, true, { - {'default:steel_ingot', 'farming:string', 'default:steelblock'}, - {'default:steelblock', 'farming:string', 'default:steelblock'}, - {'default:steel_ingot', 'farming:string', 'default:steelblock'}, - }) + throwing_register_bow ('arbalest_auto', 'Automated arbalest', {x=1, y=1.3, z=0.5}, 60, 2, 500, true, { + retrieveCraft({ + {'default:steel_ingot', 'farming:string', 'default:steelblock'}, + {'default:steelblock', 'farming:string', 'default:steelblock'}, + {'default:steel_ingot', 'farming:string', 'default:steelblock'}, + }), + }) end diff --git a/torch_arrow.lua b/torch_arrow.lua index b219098..8144a80 100755 --- a/torch_arrow.lua +++ b/torch_arrow.lua @@ -141,9 +141,3 @@ minetest.register_craft({ } }) -minetest.register_craft({ - output = 'throwing:arrow_torch 4', - recipe = { - {'group:coal', 'default:stick', 'default:stick'}, - } -})