mirror of
https://git.minetest.land/Mineclonia/Mineclonia.git
synced 2024-11-24 12:25:13 +00:00
38 lines
1.6 KiB
Lua
38 lines
1.6 KiB
Lua
-- Fire Charge
|
|
minetest.register_craftitem("mcl_fire:fire_charge", {
|
|
description = "Fire Charge",
|
|
_doc_items_longdesc = "Fire charges are primarily projectiles which can be launched from dispensers, they will fly in a straight line and burst into a fire on impact. Alternatively, they can be used to ignite fires directly.",
|
|
_doc_items_usagehelp = "Put the fire charge into a dispenser and supply it with redstone power to launch it. To ignite a fire directly, simply place the fire charge on the ground, which uses it up.",
|
|
inventory_image = "mcl_fire_fire_charge.png",
|
|
liquids_pointable = false,
|
|
stack_max = 64,
|
|
on_place = function(itemstack, user, pointed_thing)
|
|
-- Use pointed node's on_rightclick function first, if present
|
|
local node = minetest.get_node(pointed_thing.under)
|
|
if user and not user:get_player_control().sneak then
|
|
if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then
|
|
return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, user, itemstack) or itemstack
|
|
end
|
|
end
|
|
|
|
-- Ignite/light fire
|
|
if pointed_thing.type == "node" then
|
|
local nodedef = minetest.registered_nodes[node.name]
|
|
if nodedef and nodedef._on_ignite then
|
|
nodedef._on_ignite(user, pointed_thing)
|
|
else
|
|
mcl_fire.set_fire(pointed_thing)
|
|
end
|
|
if not minetest.settings:get_bool("creative_mode") then
|
|
itemstack:take_item()
|
|
end
|
|
end
|
|
return itemstack
|
|
end,
|
|
})
|
|
|
|
minetest.register_craft({
|
|
type = 'shapeless',
|
|
output = 'mcl_fire:fire_charge 3',
|
|
recipe = { 'mcl_mobitems:blaze_powder', 'group:coal', 'mcl_mobitems:gunpowder' },
|
|
})
|