minetest_x_bows/items.lua

176 lines
5.0 KiB
Lua
Raw Normal View History

2022-11-28 14:46:55 -06:00
--[[
X Bows. Adds bow and arrows with API.
2024-01-04 17:11:46 -06:00
Copyright (C) 2024 SaKeL
2022-11-28 14:46:55 -06:00
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to juraj.vajda@gmail.com
--]]
2022-10-28 10:51:49 -05:00
local S = minetest.get_translator(minetest.get_current_modname())
local arrow_tail_recipe_material = 'group:wool'
if minetest.get_modpath('animalia') then
arrow_tail_recipe_material = 'group:feather'
end
2022-10-20 08:13:35 -05:00
XBows:register_bow('bow_wood', {
2022-10-28 10:51:49 -05:00
description = S('Wooden Bow'),
short_description = S('Wooden Bow'),
2022-10-20 08:13:35 -05:00
custom = {
uses = 385,
crit_chance = 10,
recipe = {
2022-11-03 12:06:43 -05:00
{ '', 'default:stick', 'farming:string' },
{ 'default:stick', '', 'farming:string' },
{ '', 'default:stick', 'farming:string' }
2022-10-20 08:13:35 -05:00
},
fuel_burntime = 3,
allowed_ammunition = {
'x_bows:arrow_wood',
'x_bows:arrow_stone',
'x_bows:arrow_bronze',
'x_bows:arrow_steel',
'x_bows:arrow_mese',
2022-10-21 12:37:35 -05:00
'x_bows:arrow_diamond'
2022-10-20 08:13:35 -05:00
}
2022-10-16 15:02:04 -05:00
}
2021-03-13 20:39:42 -06:00
})
2022-10-20 08:13:35 -05:00
XBows:register_arrow('arrow_wood', {
2022-10-28 10:51:49 -05:00
description = S('Arrow Wood'),
short_description = S('Arrow Wood'),
2022-10-16 15:02:04 -05:00
inventory_image = 'x_bows_arrow_wood.png',
2022-10-20 08:13:35 -05:00
custom = {
recipe = {
2022-11-03 12:06:43 -05:00
{ 'default:flint' },
{ 'group:stick' },
{ arrow_tail_recipe_material }
2022-10-20 08:13:35 -05:00
},
tool_capabilities = {
full_punch_interval = 1,
max_drop_level = 0,
2022-11-03 12:06:43 -05:00
damage_groups = { fleshy = 2 }
2022-10-20 08:13:35 -05:00
},
fuel_burntime = 1
2022-10-16 15:02:04 -05:00
}
2021-03-13 20:39:42 -06:00
})
2022-10-20 08:13:35 -05:00
XBows:register_arrow('arrow_stone', {
2022-10-28 10:51:49 -05:00
description = S('Arrow Stone'),
short_description = S('Arrow Stone'),
2022-10-16 15:02:04 -05:00
inventory_image = 'x_bows_arrow_stone.png',
2022-10-20 08:13:35 -05:00
custom = {
recipe = {
2022-11-03 12:06:43 -05:00
{ 'default:flint' },
{ 'group:stone' },
{ arrow_tail_recipe_material }
2022-10-20 08:13:35 -05:00
},
tool_capabilities = {
full_punch_interval = 1.2,
max_drop_level = 0,
2022-11-03 12:06:43 -05:00
damage_groups = { fleshy = 4 }
2022-10-20 08:13:35 -05:00
}
2022-10-16 15:02:04 -05:00
}
2021-03-13 20:39:42 -06:00
})
2022-10-20 08:13:35 -05:00
XBows:register_arrow('arrow_bronze', {
2022-10-28 10:51:49 -05:00
description = S('Arrow Bronze'),
short_description = S('Arrow Bronze'),
2022-10-16 15:02:04 -05:00
inventory_image = 'x_bows_arrow_bronze.png',
2022-10-20 08:13:35 -05:00
custom = {
recipe = {
2022-11-03 12:06:43 -05:00
{ 'default:flint' },
{ 'default:bronze_ingot' },
{ arrow_tail_recipe_material }
2022-10-20 08:13:35 -05:00
},
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level = 1,
2022-11-03 12:06:43 -05:00
damage_groups = { fleshy = 6 }
2022-10-20 08:13:35 -05:00
}
2022-10-16 15:02:04 -05:00
}
2021-03-13 20:39:42 -06:00
})
2022-10-20 08:13:35 -05:00
XBows:register_arrow('arrow_steel', {
2022-10-28 10:51:49 -05:00
description = S('Arrow Steel'),
short_description = S('Arrow Steel'),
2022-10-16 15:02:04 -05:00
inventory_image = 'x_bows_arrow_steel.png',
2022-10-20 08:13:35 -05:00
custom = {
recipe = {
2022-11-03 12:06:43 -05:00
{ 'default:flint' },
{ 'default:steel_ingot' },
{ arrow_tail_recipe_material }
2022-10-20 08:13:35 -05:00
},
tool_capabilities = {
full_punch_interval = 0.7,
max_drop_level = 1,
2022-11-03 12:06:43 -05:00
damage_groups = { fleshy = 6 }
2022-10-20 08:13:35 -05:00
}
2022-10-16 15:02:04 -05:00
}
2021-03-13 20:39:42 -06:00
})
2022-10-20 08:13:35 -05:00
XBows:register_arrow('arrow_mese', {
2022-10-28 10:51:49 -05:00
description = S('Arrow Mese'),
short_description = S('Arrow Mese'),
2022-10-16 15:02:04 -05:00
inventory_image = 'x_bows_arrow_mese.png',
2022-10-20 08:13:35 -05:00
custom = {
recipe = {
2022-11-03 12:06:43 -05:00
{ 'default:flint' },
{ 'default:mese_crystal' },
{ arrow_tail_recipe_material }
2022-10-20 08:13:35 -05:00
},
tool_capabilities = {
full_punch_interval = 0.7,
max_drop_level = 1,
2022-11-03 12:06:43 -05:00
damage_groups = { fleshy = 7 }
2022-10-20 08:13:35 -05:00
}
2022-10-16 15:02:04 -05:00
}
2021-03-13 20:39:42 -06:00
})
2022-10-20 08:13:35 -05:00
XBows:register_arrow('arrow_diamond', {
2022-10-28 10:51:49 -05:00
description = S('Arrow Diamond'),
short_description = S('Arrow Diamond'),
2022-10-16 15:02:04 -05:00
inventory_image = 'x_bows_arrow_diamond.png',
2022-10-20 08:13:35 -05:00
custom = {
recipe = {
2022-11-03 12:06:43 -05:00
{ 'default:flint' },
{ 'default:diamond' },
{ arrow_tail_recipe_material }
2022-10-20 08:13:35 -05:00
},
tool_capabilities = {
full_punch_interval = 0.7,
max_drop_level = 1,
2022-11-03 12:06:43 -05:00
damage_groups = { fleshy = 8 }
2022-10-20 08:13:35 -05:00
}
2022-10-16 15:02:04 -05:00
}
2021-03-13 20:39:42 -06:00
})
2022-10-20 08:13:35 -05:00
XBows:register_quiver('quiver', {
2022-11-03 12:06:43 -05:00
description = S('Quiver') .. '\n\n' .. S('Empty') .. '\n',
2022-10-28 10:51:49 -05:00
short_description = S('Quiver'),
2022-10-20 08:13:35 -05:00
custom = {
2022-11-03 12:06:43 -05:00
description = S('Quiver') .. '\n\n' .. S('Empty') .. '\n',
2022-10-28 10:51:49 -05:00
short_description = S('Quiver'),
2022-10-20 08:13:35 -05:00
recipe = {
2022-11-03 12:06:43 -05:00
{ 'group:arrow', 'group:arrow', 'group:arrow' },
{ 'group:arrow', 'wool:brown', 'group:arrow' },
{ 'group:arrow', 'group:arrow', 'group:arrow' }
2022-10-20 08:13:35 -05:00
},
recipe_count = 1,
faster_arrows = 5,
add_damage = 2,
2022-10-21 12:37:35 -05:00
fuel_burntime = 3
2022-10-20 08:13:35 -05:00
}
2021-03-13 20:39:42 -06:00
})