forked from MineClone5/MineClone5
_on_ignite, +eternal fire when igniting netherrack
This commit is contained in:
parent
bcc185f83f
commit
a8dd5f42c4
|
@ -1,2 +1,3 @@
|
|||
mcl_core
|
||||
mcl_sounds
|
||||
mcl_nether?
|
||||
|
|
|
@ -13,22 +13,22 @@ minetest.register_tool("mcl_fire:flint_and_steel", {
|
|||
"fire_flint_and_steel",
|
||||
{pos = pointed_thing.above, gain = 0.5, max_hear_distance = 8}
|
||||
)
|
||||
local used = false
|
||||
if pointed_thing.type == "node" then
|
||||
if minetest.get_node(pointed_thing.under).name == "mcl_tnt:tnt" then
|
||||
tnt.ignite(pointed_thing.under)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:add_wear(65535/65) -- 65 uses
|
||||
end
|
||||
local nodedef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
|
||||
if nodedef._on_ignite then
|
||||
nodedef._on_ignite(pointed_thing.under, user)
|
||||
else
|
||||
mcl_fire.set_fire(pointed_thing)
|
||||
if not minetest.setting_getbool("creative_mode") then
|
||||
itemstack:add_wear(65535/65) -- 65 uses
|
||||
end
|
||||
end
|
||||
used = true
|
||||
end
|
||||
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
|
||||
if not minetest.setting_getbool("creative_mode") and used == true then
|
||||
itemstack:add_wear(65535/65) -- 65 uses
|
||||
end
|
||||
return itemstack
|
||||
end,
|
||||
sound = { breaks = "default_tool_breaks" },
|
||||
|
|
|
@ -291,7 +291,28 @@ else -- Fire enabled
|
|||
|
||||
end
|
||||
|
||||
-- Set pointed_thing on fire
|
||||
-- Spawn eternal fire when using flint and steel on netherrack
|
||||
|
||||
local eternal_override = {
|
||||
after_destruct = function(pos, oldnode)
|
||||
pos.y = pos.y + 1
|
||||
if minetest.get_node(pos).name == "mcl_fire:eternal_fire" then
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
end,
|
||||
_on_ignite = function(pos, player)
|
||||
local flame_pos = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||
if minetest.get_node(flame_pos).name == "air" then
|
||||
minetest.set_node(flame_pos, {name = "mcl_fire:eternal_fire"})
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
if minetest.get_modpath("mcl_nether") then
|
||||
minetest.override_item("mcl_nether:netherrack", eternal_override)
|
||||
end
|
||||
|
||||
-- Set pointed_thing on (normal) fire
|
||||
mcl_fire.set_fire = function(pointed_thing)
|
||||
local n = minetest.get_node(pointed_thing.above)
|
||||
if n.name ~= "" and n.name == "air" and not minetest.is_protected(pointed_thing.above, "fire") then
|
||||
|
|
|
@ -54,6 +54,9 @@ minetest.register_node("mcl_tnt:tnt", {
|
|||
mesecons = {effector = {
|
||||
action_on = tnt.ignite
|
||||
}},
|
||||
_on_ignite = function(pos, player)
|
||||
tnt.ignite(pos)
|
||||
end,
|
||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue