From 3fc8db2ac0b023d4b99682b9847e33f3852305cf Mon Sep 17 00:00:00 2001 From: echoes91 Date: Sat, 14 Mar 2015 11:49:06 +0100 Subject: [PATCH] 0.9.6 - configurable --- README.txt | 5 +- bows.lua | 278 +++++++++--------- config.lua | 5 + init.lua | 46 ++- ...explode.ogg => throwing_shell_explode.ogg} | Bin 5 files changed, 187 insertions(+), 147 deletions(-) create mode 100644 config.lua rename sounds/{shell_explode.ogg => throwing_shell_explode.ogg} (100%) diff --git a/README.txt b/README.txt index b4b9d44..f6346ea 100644 --- a/README.txt +++ b/README.txt @@ -15,7 +15,7 @@ Every shoot will take 1 arrow from your inventory and wears out the bow. License: This mod was originally published by Jeija and reworked by PilzAdam Sourcecode: WTFPL (see below) -Grahpics & sounds: WTFPL (see below) +Grahpics & sounds: CC-BY 3.0 (see http://creativecommons.org/licenses/by/3.0/legalcode) See also: http://minetest.net/ @@ -32,4 +32,5 @@ http://minetest.net/ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - 0. You just DO WHAT THE FUCK YOU WANT TO. \ No newline at end of file + 0. You just DO WHAT THE FUCK YOU WANT TO. + diff --git a/bows.lua b/bows.lua index a200c1a..260255d 100644 --- a/bows.lua +++ b/bows.lua @@ -30,152 +30,162 @@ local throwing_shoot_arrow = function(itemstack, player) return false end -local function reloading () +local function reloading (user) minetest.after(reload, function() bow_idle=true + --~ minetest.chat_send_player(user:get_player_name(), "Reloaded!") end) end -minetest.register_tool("throwing:bow_wood", { - description = "Wood 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 - reload = 1.1 - if throwing_shoot_arrow(itemstack, user, pointed_thing) then - reloading() - if not minetest.setting_getbool("creative_mode") then - itemstack:add_wear(65535/80) +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 + reload = 1.1 + if throwing_shoot_arrow(itemstack, user, pointed_thing) then + reloading(user) + if not minetest.setting_getbool("creative_mode") then + itemstack:add_wear(65535/80) + end end - end - return itemstack - end, -}) + return itemstack + end, + }) -minetest.register_craft({ - output = 'throwing:bow_wood', - recipe = { - {'farming:string', 'group:wood', ''}, - {'farming:string', '', 'group:wood'}, - {'farming:string', 'group:wood', ''}, - } -}) + minetest.register_craft({ + output = 'throwing:bow_wood', + recipe = { + {'farming:string', 'group:wood', ''}, + {'farming:string', '', 'group:wood'}, + {'farming:string', 'group:wood', ''}, + } + }) -minetest.register_craft({ - output = 'throwing:bow_wood', - recipe = { - {'', 'group:wood', 'farming:string'}, - {'group:wood', '', 'farming:string'}, - {'', 'group:wood', 'farming:string'}, - } -}) + minetest.register_craft({ + output = 'throwing:bow_wood', + recipe = { + {'', 'group:wood', 'farming:string'}, + {'group:wood', '', 'farming:string'}, + {'', 'group:wood', 'farming:string'}, + } + }) +end -minetest.register_tool("throwing:bow_steel", { - description = "Steel Bow", - inventory_image = "throwing_bow_steel.png", - wield_scale = {x=1, y=1, z=0.5}, - stack_max = 1, - on_use = function(itemstack, user, pointed_thing) - stiffness = 17 - reload = 1.6 - if throwing_shoot_arrow(itemstack, user, pointed_thing) then - reloading() - if not minetest.setting_getbool("creative_mode") then - itemstack:add_wear(65535/400) +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}, + stack_max = 1, + on_use = function(itemstack, user, pointed_thing) + stiffness = 19 + reload = 1.6 + if throwing_shoot_arrow(itemstack, user, pointed_thing) then + reloading() + if not minetest.setting_getbool("creative_mode") then + itemstack:add_wear(65535/400) + end end - end - return itemstack - end, -}) + return itemstack + end, + }) + + minetest.register_craft({ + output = 'throwing:bow_steel', + recipe = { + {'farming:string', 'default:steel_ingot', ''}, + {'farming:string', '', 'default:steel_ingot'}, + {'farming:string', 'default:steel_ingot', ''}, + } + }) -minetest.register_craft({ - output = 'throwing:bow_steel', - recipe = { - {'farming:string', 'default:steel_ingot', ''}, - {'farming:string', '', 'default:steel_ingot'}, - {'farming:string', 'default:steel_ingot', ''}, - } -}) + minetest.register_craft({ + output = 'throwing:bow_steel', + recipe = { + {'', 'default:steel_ingot', 'farming:string'}, + {'default:steel_ingot', '', 'farming:string'}, + {'', 'default:steel_ingot', 'farming:string'}, + } + }) +end -minetest.register_craft({ - output = 'throwing:bow_steel', - recipe = { - {'', 'default:steel_ingot', 'farming:string'}, - {'default:steel_ingot', '', 'farming:string'}, - {'', 'default:steel_ingot', 'farming:string'}, - } -}) - -minetest.register_tool("throwing:bow_composite", { - description = "Composite Bow", - inventory_image = "throwing_bow_composite.png", - wield_scale = {x=1, y=1, z=0.5}, - stack_max = 1, - on_use = function(itemstack, user, pointed_thing) - stiffness = 16 - reload = 1.3 - if throwing_shoot_arrow(itemstack, user, pointed_thing) then - reloading() - if not minetest.setting_getbool("creative_mode") then - itemstack:add_wear(65535/150) +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}, + stack_max = 1, + on_use = function(itemstack, user, pointed_thing) + stiffness = 18 + reload = 1.3 + if throwing_shoot_arrow(itemstack, user, pointed_thing) then + reloading() + if not minetest.setting_getbool("creative_mode") then + itemstack:add_wear(65535/150) + end end - end - return itemstack - end, -}) + return itemstack + end, + }) + + minetest.register_craft({ + output = 'throwing:bow_composite', + recipe = { + {'farming:string', 'group:wood', ''}, + {'farming:string', 'default:steel_ingot', 'default:steel_ingot'}, + {'farming:string', 'group:wood', ''}, + } + }) + + minetest.register_craft({ + output = 'throwing:bow_composite', + recipe = { + {'', 'group:wood', 'farming:string'}, + {'default:steel_ingot', 'default:steel_ingot', 'farming:string'}, + {'', 'group:wood', 'farming:string'}, + } + }) +end -minetest.register_craft({ - output = 'throwing:bow_composite', - recipe = { - {'farming:string', 'group:wood', ''}, - {'farming:string', 'default:steel_ingot', 'default:steel_ingot'}, - {'farming:string', 'group:wood', ''}, - } -}) - -minetest.register_craft({ - output = 'throwing:bow_composite', - recipe = { - {'', 'group:wood', 'farming:string'}, - {'default:steel_ingot', 'default:steel_ingot', 'farming:string'}, - {'', 'group:wood', 'farming:string'}, - } -}) - -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() - if not minetest.setting_getbool("creative_mode") then - itemstack:add_wear(65535/1000) +if not disable_golden_bow then + 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() + if not minetest.setting_getbool("creative_mode") then + itemstack:add_wear(65535/1000) + end 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'}, - } -}) + 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 + diff --git a/config.lua b/config.lua new file mode 100644 index 0000000..4d241aa --- /dev/null +++ b/config.lua @@ -0,0 +1,5 @@ +--~ Write an (uncommented) line like these to disable any bow or arrow: +--~ +--~ disable_tnt_arrow = true +--~ +--~ disable_composite_bow = true diff --git a/init.lua b/init.lua index 6013a43..5ecdb89 100644 --- a/init.lua +++ b/init.lua @@ -10,20 +10,44 @@ arrows = { {"throwing:arrow_torch", "throwing:arrow_torch_entity"}, {"throwing:arrow_diamond", "throwing:arrow_diamond_entity"}, {"throwing:arrow_shell", "throwing:arrow_shell_entity"}, + {"throwing:arrow_fireworks_blue", "throwing:arrow_fireworks_blue_entity"}, } +dofile(minetest.get_modpath("throwing").."/config.lua") dofile(minetest.get_modpath("throwing").."/bows.lua") -dofile(minetest.get_modpath("throwing").."/steel_arrow.lua") -dofile(minetest.get_modpath("throwing").."/stone_arrow.lua") -dofile(minetest.get_modpath("throwing").."/obsidian_arrow.lua") -dofile(minetest.get_modpath("throwing").."/fire_arrow.lua") -dofile(minetest.get_modpath("throwing").."/teleport_arrow.lua") -dofile(minetest.get_modpath("throwing").."/dig_arrow.lua") -dofile(minetest.get_modpath("throwing").."/build_arrow.lua") -dofile(minetest.get_modpath("throwing").."/tnt_arrow.lua") -dofile(minetest.get_modpath("throwing").."/torch_arrow.lua") -dofile(minetest.get_modpath("throwing").."/diamond_arrow.lua") -dofile(minetest.get_modpath("throwing").."/shell_arrow.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 diff --git a/sounds/shell_explode.ogg b/sounds/throwing_shell_explode.ogg similarity index 100% rename from sounds/shell_explode.ogg rename to sounds/throwing_shell_explode.ogg