minetest_x_bows/nodes.lua

55 lines
1.8 KiB
Lua
Raw Normal View History

2022-11-28 14:46:55 -06:00
--[[
X Bows. Adds bow and arrows with API.
Copyright (C) 2022 SaKeL <juraj.vajda@gmail.com>
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())
2021-03-13 20:39:42 -06:00
minetest.register_node('x_bows:target', {
2022-10-28 10:51:49 -05:00
description = S('Target'),
short_description = S('Target'),
2022-11-03 12:06:43 -05:00
tiles = { 'x_bows_target.png' },
2022-10-16 15:02:04 -05:00
is_ground_content = false,
2022-11-03 12:06:43 -05:00
groups = { snappy = 3, flammable = 4, fall_damage_add_percent = -30 },
2022-10-26 22:59:36 -05:00
sounds = minetest.global_exists('default') and default.node_sound_leaves_defaults() or {},
2022-11-03 12:06:43 -05:00
mesecons = { receptor = { state = 'off' } },
2022-10-20 08:13:35 -05:00
---@param pos Vector
---@param elapsed number
---@return boolean
2022-11-03 12:06:43 -05:00
on_timer = function(pos, elapsed)
2022-10-20 08:13:35 -05:00
if XBows.mesecons then
mesecon.receptor_off(pos)
end
2022-10-16 15:02:04 -05:00
return false
2022-10-20 08:13:35 -05:00
end
2021-03-13 20:39:42 -06:00
})
minetest.register_craft({
2022-10-16 15:02:04 -05:00
type = 'fuel',
recipe = 'x_bows:target',
2022-10-20 08:13:35 -05:00
burntime = 3
2021-03-13 20:39:42 -06:00
})
minetest.register_craft({
2022-10-16 15:02:04 -05:00
output = 'x_bows:target',
recipe = {
2022-11-03 12:06:43 -05:00
{ '', 'default:mese_crystal', '' },
{ 'default:mese_crystal', 'farming:straw', 'default:mese_crystal' },
{ '', 'default:mese_crystal', '' },
2022-10-16 15:02:04 -05:00
}
2021-03-13 20:39:42 -06:00
})