2017-02-01 15:31:27 +00:00
|
|
|
-- Flint and Steel
|
|
|
|
minetest.register_tool("mcl_fire:flint_and_steel", {
|
|
|
|
description = "Flint and Steel",
|
|
|
|
inventory_image = "mcl_fire_flint_and_steel.png",
|
|
|
|
liquids_pointable = false,
|
|
|
|
stack_max = 1,
|
|
|
|
groups = { tool = 1 },
|
2017-03-11 01:51:31 +00:00
|
|
|
on_place = function(itemstack, user, pointed_thing)
|
2017-02-19 19:23:33 +00:00
|
|
|
local idef = itemstack:get_definition()
|
2017-02-19 21:58:51 +00:00
|
|
|
minetest.sound_play(
|
|
|
|
"fire_flint_and_steel",
|
|
|
|
{pos = pointed_thing.above, gain = 0.5, max_hear_distance = 8}
|
|
|
|
)
|
2017-02-01 15:31:27 +00:00
|
|
|
if pointed_thing.type == "node" then
|
|
|
|
if minetest.get_node(pointed_thing.under).name == "mcl_tnt:tnt" then
|
|
|
|
tnt.ignite(pointed_thing.under)
|
2017-02-01 18:50:39 +00:00
|
|
|
if not minetest.setting_getbool("creative_mode") then
|
2017-02-03 01:20:47 +00:00
|
|
|
itemstack:add_wear(65535/65) -- 65 uses
|
2017-02-01 18:50:39 +00:00
|
|
|
end
|
2017-02-01 15:31:27 +00:00
|
|
|
else
|
2017-02-01 15:43:05 +00:00
|
|
|
mcl_fire.set_fire(pointed_thing)
|
2017-02-01 18:50:39 +00:00
|
|
|
if not minetest.setting_getbool("creative_mode") then
|
2017-02-03 01:20:47 +00:00
|
|
|
itemstack:add_wear(65535/65) -- 65 uses
|
2017-02-01 18:50:39 +00:00
|
|
|
end
|
2017-02-01 15:31:27 +00:00
|
|
|
end
|
|
|
|
end
|
2017-02-19 19:23:33 +00:00
|
|
|
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
|
|
|
|
minetest.sound_play(idef.sound.breaks, {pos=user:getpos(), gain=0.5})
|
|
|
|
end
|
2017-02-01 15:45:49 +00:00
|
|
|
return itemstack
|
2017-02-01 15:31:27 +00:00
|
|
|
end,
|
2017-02-19 19:23:33 +00:00
|
|
|
sound = { breaks = "default_tool_breaks" },
|
2017-02-01 15:31:27 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
type = 'shapeless',
|
2017-02-01 15:39:51 +00:00
|
|
|
output = 'mcl_fire:flint_and_steel',
|
2017-02-11 20:14:40 +00:00
|
|
|
recipe = { 'mcl_core:iron_ingot', 'mcl_core:flint'},
|
2017-02-01 15:31:27 +00:00
|
|
|
})
|