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:
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.
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
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

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_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