0.9.6 - configurable

This commit is contained in:
echoes91 2015-03-14 11:49:06 +01:00
parent a9b795b9f9
commit 3fc8db2ac0
5 changed files with 187 additions and 147 deletions

View File

@ -15,7 +15,7 @@ Every shoot will take 1 arrow from your inventory and wears out the bow.
License: License:
This mod was originally published by Jeija and reworked by PilzAdam This mod was originally published by Jeija and reworked by PilzAdam
Sourcecode: WTFPL (see below) 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: See also:
http://minetest.net/ http://minetest.net/
@ -32,4 +32,5 @@ http://minetest.net/
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO. 0. You just DO WHAT THE FUCK YOU WANT TO.

278
bows.lua
View File

@ -30,152 +30,162 @@ local throwing_shoot_arrow = function(itemstack, player)
return false return false
end end
local function reloading () local function reloading (user)
minetest.after(reload, function() minetest.after(reload, function()
bow_idle=true bow_idle=true
--~ minetest.chat_send_player(user:get_player_name(), "Reloaded!")
end) end)
end end
minetest.register_tool("throwing:bow_wood", { if not disable_wooden_bow then
description = "Wood Bow", minetest.register_tool("throwing:bow_wood", {
inventory_image = "throwing_bow_wood.png", description = "Wooden Bow",
wield_scale = {x=1, y=1, z=0.5}, inventory_image = "throwing_bow_wood.png",
stack_max = 1, wield_scale = {x=1, y=1, z=0.5},
on_use = function(itemstack, user, pointed_thing) stack_max = 1,
stiffness = 13 on_use = function(itemstack, user, pointed_thing)
reload = 1.1 stiffness = 13
if throwing_shoot_arrow(itemstack, user, pointed_thing) then reload = 1.1
reloading() if throwing_shoot_arrow(itemstack, user, pointed_thing) then
if not minetest.setting_getbool("creative_mode") then reloading(user)
itemstack:add_wear(65535/80) if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/80)
end
end end
end return itemstack
return itemstack end,
end, })
})
minetest.register_craft({ minetest.register_craft({
output = 'throwing:bow_wood', output = 'throwing:bow_wood',
recipe = { recipe = {
{'farming:string', 'group:wood', ''}, {'farming:string', 'group:wood', ''},
{'farming:string', '', 'group:wood'}, {'farming:string', '', 'group:wood'},
{'farming:string', 'group:wood', ''}, {'farming:string', 'group:wood', ''},
} }
}) })
minetest.register_craft({ minetest.register_craft({
output = 'throwing:bow_wood', output = 'throwing:bow_wood',
recipe = { recipe = {
{'', 'group:wood', 'farming:string'}, {'', 'group:wood', 'farming:string'},
{'group:wood', '', 'farming:string'}, {'group:wood', '', 'farming:string'},
{'', 'group:wood', 'farming:string'}, {'', 'group:wood', 'farming:string'},
} }
}) })
end
minetest.register_tool("throwing:bow_steel", { if not disable_steel_bow then
description = "Steel Bow", minetest.register_tool("throwing:bow_steel", {
inventory_image = "throwing_bow_steel.png", description = "Steel Bow",
wield_scale = {x=1, y=1, z=0.5}, inventory_image = "throwing_bow_steel.png",
stack_max = 1, wield_scale = {x=1, y=1, z=0.5},
on_use = function(itemstack, user, pointed_thing) stack_max = 1,
stiffness = 17 on_use = function(itemstack, user, pointed_thing)
reload = 1.6 stiffness = 19
if throwing_shoot_arrow(itemstack, user, pointed_thing) then reload = 1.6
reloading() if throwing_shoot_arrow(itemstack, user, pointed_thing) then
if not minetest.setting_getbool("creative_mode") then reloading()
itemstack:add_wear(65535/400) if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535/400)
end
end end
end return itemstack
return itemstack end,
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({ minetest.register_craft({
output = 'throwing:bow_steel', output = 'throwing:bow_steel',
recipe = { recipe = {
{'farming:string', 'default:steel_ingot', ''}, {'', 'default:steel_ingot', 'farming:string'},
{'farming:string', '', 'default:steel_ingot'}, {'default:steel_ingot', '', 'farming:string'},
{'farming:string', 'default:steel_ingot', ''}, {'', 'default:steel_ingot', 'farming:string'},
} }
}) })
end
minetest.register_craft({ if not disable_composite_bow then
output = 'throwing:bow_steel', minetest.register_tool("throwing:bow_composite", {
recipe = { description = "Composite Bow",
{'', 'default:steel_ingot', 'farming:string'}, inventory_image = "throwing_bow_composite.png",
{'default:steel_ingot', '', 'farming:string'}, wield_scale = {x=1, y=1, z=0.5},
{'', 'default:steel_ingot', 'farming:string'}, stack_max = 1,
} on_use = function(itemstack, user, pointed_thing)
}) stiffness = 18
reload = 1.3
minetest.register_tool("throwing:bow_composite", { if throwing_shoot_arrow(itemstack, user, pointed_thing) then
description = "Composite Bow", reloading()
inventory_image = "throwing_bow_composite.png", if not minetest.setting_getbool("creative_mode") then
wield_scale = {x=1, y=1, z=0.5}, itemstack:add_wear(65535/150)
stack_max = 1, end
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)
end end
end return itemstack
return itemstack end,
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({ if not disable_golden_bow then
output = 'throwing:bow_composite', minetest.register_tool("throwing:bow_gold", {
recipe = { description = "Golden Bow",
{'farming:string', 'group:wood', ''}, inventory_image = "throwing_bow_gold.png",
{'farming:string', 'default:steel_ingot', 'default:steel_ingot'}, wield_scale = {x=1, y=1, z=0.5},
{'farming:string', 'group:wood', ''}, stack_max = 1,
} on_use = function(itemstack, user, pointed_thing)
}) stiffness = 16
reload = 1.6
minetest.register_craft({ if throwing_shoot_arrow(itemstack, user, pointed_thing) then
output = 'throwing:bow_composite', reloading()
recipe = { if not minetest.setting_getbool("creative_mode") then
{'', 'group:wood', 'farming:string'}, itemstack:add_wear(65535/1000)
{'default:steel_ingot', 'default:steel_ingot', 'farming:string'}, end
{'', '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)
end end
end return itemstack
return itemstack end,
end, })
})
minetest.register_craft({
minetest.register_craft({ output = 'throwing:bow_gold',
output = 'throwing:bow_gold', recipe = {
recipe = { {'farming:string', 'default:gold_ingot', ''},
{'farming:string', 'default:gold_ingot', ''}, {'farming:string', '', 'default:gold_ingot'},
{'farming:string', '', 'default:gold_ingot'}, {'farming:string', 'default:gold_ingot', ''},
{'farming:string', 'default:gold_ingot', ''}, }
} })
})
minetest.register_craft({
minetest.register_craft({ output = 'throwing:bow_gold',
output = 'throwing:bow_gold', recipe = {
recipe = { {'', 'default:gold_ingot', 'farming:string'},
{'', 'default:gold_ingot', 'farming:string'}, {'default:gold_ingot', '', 'farming:string'},
{'default:gold_ingot', '', 'farming:string'}, {'', 'default:gold_ingot', 'farming:string'},
{'', 'default:gold_ingot', 'farming:string'}, }
} })
}) end

5
config.lua Normal file
View File

@ -0,0 +1,5 @@
--~ Write an (uncommented) line like these to disable any bow or arrow:
--~
--~ disable_tnt_arrow = true
--~
--~ disable_composite_bow = true

View File

@ -10,20 +10,44 @@ arrows = {
{"throwing:arrow_torch", "throwing:arrow_torch_entity"}, {"throwing:arrow_torch", "throwing:arrow_torch_entity"},
{"throwing:arrow_diamond", "throwing:arrow_diamond_entity"}, {"throwing:arrow_diamond", "throwing:arrow_diamond_entity"},
{"throwing:arrow_shell", "throwing:arrow_shell_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").."/bows.lua")
dofile(minetest.get_modpath("throwing").."/steel_arrow.lua") if not disable_steel_arrow then
dofile(minetest.get_modpath("throwing").."/stone_arrow.lua") dofile(minetest.get_modpath("throwing").."/steel_arrow.lua")
dofile(minetest.get_modpath("throwing").."/obsidian_arrow.lua") end
dofile(minetest.get_modpath("throwing").."/fire_arrow.lua") if not disable_stone_arrow then
dofile(minetest.get_modpath("throwing").."/teleport_arrow.lua") dofile(minetest.get_modpath("throwing").."/stone_arrow.lua")
dofile(minetest.get_modpath("throwing").."/dig_arrow.lua") end
dofile(minetest.get_modpath("throwing").."/build_arrow.lua") if not disable_stone_arrow then
dofile(minetest.get_modpath("throwing").."/tnt_arrow.lua") dofile(minetest.get_modpath("throwing").."/obsidian_arrow.lua")
dofile(minetest.get_modpath("throwing").."/torch_arrow.lua") end
dofile(minetest.get_modpath("throwing").."/diamond_arrow.lua") if not disable_fire_arrow then
dofile(minetest.get_modpath("throwing").."/shell_arrow.lua") 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 if minetest.setting_get("log_mods") then