mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 00:19:32 +01:00
_on_ignite, +eternal fire when igniting netherrack
This commit is contained in:
parent
bcc185f83f
commit
a8dd5f42c4
4 changed files with 34 additions and 9 deletions
|
@ -1,2 +1,3 @@
|
||||||
mcl_core
|
mcl_core
|
||||||
mcl_sounds
|
mcl_sounds
|
||||||
|
mcl_nether?
|
||||||
|
|
|
@ -13,22 +13,22 @@ minetest.register_tool("mcl_fire:flint_and_steel", {
|
||||||
"fire_flint_and_steel",
|
"fire_flint_and_steel",
|
||||||
{pos = pointed_thing.above, gain = 0.5, max_hear_distance = 8}
|
{pos = pointed_thing.above, gain = 0.5, max_hear_distance = 8}
|
||||||
)
|
)
|
||||||
|
local used = false
|
||||||
if pointed_thing.type == "node" then
|
if pointed_thing.type == "node" then
|
||||||
if minetest.get_node(pointed_thing.under).name == "mcl_tnt:tnt" then
|
local nodedef = minetest.registered_nodes[minetest.get_node(pointed_thing.under).name]
|
||||||
tnt.ignite(pointed_thing.under)
|
if nodedef._on_ignite then
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
nodedef._on_ignite(pointed_thing.under, user)
|
||||||
itemstack:add_wear(65535/65) -- 65 uses
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
mcl_fire.set_fire(pointed_thing)
|
mcl_fire.set_fire(pointed_thing)
|
||||||
if not minetest.setting_getbool("creative_mode") then
|
|
||||||
itemstack:add_wear(65535/65) -- 65 uses
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
used = true
|
||||||
end
|
end
|
||||||
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
|
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})
|
minetest.sound_play(idef.sound.breaks, {pos=user:getpos(), gain=0.5})
|
||||||
end
|
end
|
||||||
|
if not minetest.setting_getbool("creative_mode") and used == true then
|
||||||
|
itemstack:add_wear(65535/65) -- 65 uses
|
||||||
|
end
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
sound = { breaks = "default_tool_breaks" },
|
sound = { breaks = "default_tool_breaks" },
|
||||||
|
|
|
@ -291,7 +291,28 @@ else -- Fire enabled
|
||||||
|
|
||||||
end
|
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)
|
mcl_fire.set_fire = function(pointed_thing)
|
||||||
local n = minetest.get_node(pointed_thing.above)
|
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
|
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 = {
|
mesecons = {effector = {
|
||||||
action_on = tnt.ignite
|
action_on = tnt.ignite
|
||||||
}},
|
}},
|
||||||
|
_on_ignite = function(pos, player)
|
||||||
|
tnt.ignite(pos)
|
||||||
|
end,
|
||||||
sounds = mcl_sounds.node_sound_wood_defaults(),
|
sounds = mcl_sounds.node_sound_wood_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue