forked from VoxeLibre/VoxeLibre
Stop fire spread if enable_fire=false
This commit is contained in:
parent
fbba40fe5c
commit
ab81dfb4b4
|
@ -145,12 +145,20 @@ minetest.register_node("mcl_core:lava_flowing", {
|
||||||
_mcl_hardness = -1,
|
_mcl_hardness = -1,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
local fire_text
|
||||||
|
local fire_enabled = minetest.settings:get_bool("enable_fire", true)
|
||||||
|
if fire_enabled then
|
||||||
|
fire_text = S("A lava source sets fire to a couple of air blocks above when they're next to a flammable block.")
|
||||||
|
else
|
||||||
|
fire_text = ""
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_node("mcl_core:lava_source", {
|
minetest.register_node("mcl_core:lava_source", {
|
||||||
description = S("Lava Source"),
|
description = S("Lava Source"),
|
||||||
_doc_items_entry_name = "Lava",
|
_doc_items_entry_name = "Lava",
|
||||||
_doc_items_longdesc =
|
_doc_items_longdesc =
|
||||||
S("Lava is hot and rather dangerous. Don't touch it, it will hurt you a lot and it is hard to get out.").."\n"..
|
S("Lava is hot and rather dangerous. Don't touch it, it will hurt you a lot and it is hard to get out.").."\n"..
|
||||||
S("A lava source sets fire to a couple of air blocks above when they're next to a flammable block.").."\n\n"..
|
fire_text.."\n\n"..
|
||||||
S("Lava interacts with water various ways:").."\n"..
|
S("Lava interacts with water various ways:").."\n"..
|
||||||
S("• When a lava source is directly below or horizontally next to water, the lava turns into obsidian.").."\n"..
|
S("• When a lava source is directly below or horizontally next to water, the lava turns into obsidian.").."\n"..
|
||||||
S("• When flowing water touches flowing lava either from above or horizontally, the lava turns into cobblestone.").."\n"..
|
S("• When flowing water touches flowing lava either from above or horizontally, the lava turns into cobblestone.").."\n"..
|
||||||
|
|
|
@ -14,30 +14,24 @@ local N = function(s) return s end
|
||||||
-- Fire settings
|
-- Fire settings
|
||||||
|
|
||||||
-- When enabled, fire destroys other blocks.
|
-- When enabled, fire destroys other blocks.
|
||||||
local fire_enabled = minetest.settings:get_bool("enable_fire")
|
local fire_enabled = minetest.settings:get_bool("enable_fire", true)
|
||||||
if fire_enabled == nil then
|
|
||||||
-- New setting not specified, check for old setting.
|
|
||||||
-- If old setting is also not specified, 'not nil' is true.
|
|
||||||
fire_enabled = not minetest.settings:get_bool("disable_fire")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Enable sound
|
-- Enable sound
|
||||||
local flame_sound = minetest.settings:get_bool("flame_sound")
|
local flame_sound = minetest.settings:get_bool("flame_sound", true)
|
||||||
if flame_sound == nil then
|
|
||||||
-- Enable if no setting present
|
|
||||||
flame_sound = true
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
-- Help texts
|
-- Help texts
|
||||||
local fire_help
|
local fire_help, eternal_fire_help
|
||||||
if fire_enabled then
|
if fire_enabled then
|
||||||
fire_help = S("Fire is a damaging and destructive but short-lived kind of block. It will destroy and spread towards near flammable blocks, but fire will disappear when there is nothing to burn left. It will be extinguished by nearby water and rain. Fire can be destroyed safely by punching it, but it is hurtful if you stand directly in it. If a fire is started above netherrack or a magma block, it will immediately turn into an eternal fire.")
|
fire_help = S("Fire is a damaging and destructive but short-lived kind of block. It will destroy and spread towards near flammable blocks, but fire will disappear when there is nothing to burn left. It will be extinguished by nearby water and rain. Fire can be destroyed safely by punching it, but it is hurtful if you stand directly in it. If a fire is started above netherrack or a magma block, it will immediately turn into an eternal fire.")
|
||||||
else
|
else
|
||||||
fire_help = S("Fire is a damaging but non-destructive short-lived kind of block. It will disappear when there is no flammable block around. Fire does not destroy blocks, at least not in this world. It will be extinguished by nearby water and rain. Fire can be destroyed safely by punching it, but it is hurtful if you stand directly in it. If a fire is started above netherrack or a magma block, it will immediately turn into an eternal fire.")
|
fire_help = S("Fire is a damaging but non-destructive short-lived kind of block. It will disappear when there is no flammable block around. Fire does not destroy blocks, at least not in this world. It will be extinguished by nearby water and rain. Fire can be destroyed safely by punching it, but it is hurtful if you stand directly in it. If a fire is started above netherrack or a magma block, it will immediately turn into an eternal fire.")
|
||||||
end
|
end
|
||||||
|
|
||||||
local eternal_fire_help = S("Eternal fire is a damaging block that might create more fire. It will create fire around it when flammable blocks are nearby. Eternal fire can be extinguished by punches and nearby water blocks. Other than (normal) fire, eternal fire does not get extinguished on its own and also continues to burn under rain. Punching eternal fire is safe, but it hurts if you stand inside.")
|
if fire_enabled then
|
||||||
|
eternal_fire_help = S("Eternal fire is a damaging block that might create more fire. It will create fire around it when flammable blocks are nearby. Eternal fire can be extinguished by punches and nearby water blocks. Other than (normal) fire, eternal fire does not get extinguished on its own and also continues to burn under rain. Punching eternal fire is safe, but it hurts if you stand inside.")
|
||||||
|
else
|
||||||
|
eternal_fire_help = S("Eternal fire is a damaging block. Eternal fire can be extinguished by punches and nearby water blocks. Other than (normal) fire, eternal fire does not get extinguished on its own and also continues to burn under rain. Punching eternal fire is safe, but it hurts if you stand inside.")
|
||||||
|
end
|
||||||
|
|
||||||
local fire_death_messages = {
|
local fire_death_messages = {
|
||||||
N("@1 has been cooked crisp."),
|
N("@1 has been cooked crisp."),
|
||||||
|
@ -79,10 +73,15 @@ minetest.register_node("mcl_fire:fire", {
|
||||||
end,
|
end,
|
||||||
on_timer = function(pos)
|
on_timer = function(pos)
|
||||||
local airs = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+4, z=pos.z+1}, {"air"})
|
local airs = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+4, z=pos.z+1}, {"air"})
|
||||||
if #airs == 0 then
|
if (#airs == 0) or ((not fire_enabled) and math.random(1,3) == 1) then
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if (not fire_enabled) then
|
||||||
|
-- Restart timer
|
||||||
|
minetest.get_node_timer(pos):start(math.random(3, 7))
|
||||||
|
return
|
||||||
|
end
|
||||||
local burned = false
|
local burned = false
|
||||||
if math.random(1,2) == 1 then
|
if math.random(1,2) == 1 then
|
||||||
while #airs > 0 do
|
while #airs > 0 do
|
||||||
|
@ -158,14 +157,16 @@ minetest.register_node("mcl_fire:eternal_fire", {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_timer = function(pos)
|
on_timer = function(pos)
|
||||||
local airs = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+4, z=pos.z+1}, {"air"})
|
if fire_enabled then
|
||||||
while #airs > 0 do
|
local airs = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y-1, z=pos.z-1}, {x=pos.x+1, y=pos.y+4, z=pos.z+1}, {"air"})
|
||||||
local r = math.random(1, #airs)
|
while #airs > 0 do
|
||||||
if minetest.find_node_near(airs[r], 1, {"group:flammable"}) then
|
local r = math.random(1, #airs)
|
||||||
minetest.set_node(airs[r], {name="mcl_fire:fire"})
|
if minetest.find_node_near(airs[r], 1, {"group:flammable"}) then
|
||||||
break
|
minetest.set_node(airs[r], {name="mcl_fire:fire"})
|
||||||
else
|
break
|
||||||
table.remove(airs, r)
|
else
|
||||||
|
table.remove(airs, r)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Restart timer
|
-- Restart timer
|
||||||
|
@ -184,36 +185,6 @@ minetest.register_node("mcl_fire:eternal_fire", {
|
||||||
_mcl_blast_resistance = 0,
|
_mcl_blast_resistance = 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Also make lava set fire to air blocks above
|
|
||||||
minetest.override_item("mcl_core:lava_source", {
|
|
||||||
on_timer = function(pos)
|
|
||||||
local function try_ignite(airs)
|
|
||||||
while #airs > 0 do
|
|
||||||
local r = math.random(1, #airs)
|
|
||||||
if minetest.find_node_near(airs[r], 1, {"group:flammable", "group:flammable_lava"}) then
|
|
||||||
minetest.set_node(airs[r], {name="mcl_fire:fire"})
|
|
||||||
return true
|
|
||||||
else
|
|
||||||
table.remove(airs, r)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
local airs1 = minetest.find_nodes_in_area({x=pos.x-1, y=pos.y+1, z=pos.z-1}, {x=pos.x+1, y=pos.y+1, z=pos.z+1}, {"air"})
|
|
||||||
local ok = try_ignite(airs1)
|
|
||||||
if not ok then
|
|
||||||
local airs2 = minetest.find_nodes_in_area({x=pos.x-2, y=pos.y+2, z=pos.z-2}, {x=pos.x+2, y=pos.y+2, z=pos.z+2}, {"air"})
|
|
||||||
try_ignite(airs2)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Restart timer
|
|
||||||
minetest.get_node_timer(pos):start(math.random(5, 10))
|
|
||||||
end,
|
|
||||||
on_construct = function(pos)
|
|
||||||
minetest.get_node_timer(pos):start(math.random(5, 10))
|
|
||||||
end
|
|
||||||
})
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Sound
|
-- Sound
|
||||||
--
|
--
|
||||||
|
@ -350,28 +321,37 @@ minetest.register_abm({
|
||||||
|
|
||||||
if not fire_enabled then
|
if not fire_enabled then
|
||||||
|
|
||||||
-- Remove fire only if fire disabled
|
-- Occasionally remove fire if fire disabled
|
||||||
|
-- NOTE: Fire is normally extinguished in timer function
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Remove disabled fire",
|
label = "Remove disabled fire",
|
||||||
nodenames = {"mcl_fire:fire"},
|
nodenames = {"mcl_fire:fire"},
|
||||||
interval = 7,
|
interval = 10,
|
||||||
chance = 3,
|
chance = 10,
|
||||||
catch_up = false,
|
catch_up = false,
|
||||||
action = minetest.remove_node,
|
action = minetest.remove_node,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
else -- Fire enabled
|
||||||
|
|
||||||
-- Set fire to air nodes (inverse pyramid pattern) above lava source
|
-- Set fire to air nodes (inverse pyramid pattern) above lava source
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Ignite fire by lava",
|
label = "Ignite fire by lava",
|
||||||
nodenames = {"mcl_core:lava_source"},
|
nodenames = {"group:lava"},
|
||||||
interval = 7,
|
interval = 7,
|
||||||
chance = 2,
|
chance = 2,
|
||||||
catch_up = false,
|
catch_up = false,
|
||||||
action = function(pos)
|
action = function(pos)
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local def = minetest.registered_nodes[node.name]
|
||||||
|
-- Check if liquid source node
|
||||||
|
if def and def.liquidtype ~= "source" then
|
||||||
|
return
|
||||||
|
end
|
||||||
local function try_ignite(airs)
|
local function try_ignite(airs)
|
||||||
while #airs > 0 do
|
while #airs > 0 do
|
||||||
local r = math.random(1, #airs)
|
local r = math.random(1, #airs)
|
||||||
if minetest.find_node_near(airs[r], 1, {"group:flammable", "group:flammable_lava"}) then
|
if minetest.find_node_near(airs[r], 1, {"group:flammable"}) then
|
||||||
minetest.set_node(airs[r], {name="mcl_fire:fire"})
|
minetest.set_node(airs[r], {name="mcl_fire:fire"})
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
|
@ -389,8 +369,6 @@ if not fire_enabled then
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
else -- Fire enabled
|
|
||||||
|
|
||||||
-- Turn flammable nodes around fire into fire
|
-- Turn flammable nodes around fire into fire
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Remove flammable nodes",
|
label = "Remove flammable nodes",
|
||||||
|
|
|
@ -8,6 +8,7 @@ Rightclick the surface of a block to attempt to light a fire in front of it or i
|
||||||
Fire is a damaging and destructive but short-lived kind of block. It will destroy and spread towards near flammable blocks, but fire will disappear when there is nothing to burn left. It will be extinguished by nearby water and rain. Fire can be destroyed safely by punching it, but it is hurtful if you stand directly in it. If a fire is started above netherrack or a magma block, it will immediately turn into an eternal fire.=Feuer ist ein schädlicher und destruktiver aber kurzlebiger Block. Es wird sich zu entzündlichen Blöcken ausbreiten und sie zerstören, aber Feuer wird verschwinden, wenn es nichts brennbares mehr gibt. Es wird von Wasser und Regen gelöscht. Feuer kann sicher mit einem Schlag zerstört werden, aber es tut weh, wenn man direkt in ihm steht. Wird ein Feuer über Netherrack oder einem Magmablock entfacht, wird er sich sofort zu einem ewigen Feuer verwandeln.
|
Fire is a damaging and destructive but short-lived kind of block. It will destroy and spread towards near flammable blocks, but fire will disappear when there is nothing to burn left. It will be extinguished by nearby water and rain. Fire can be destroyed safely by punching it, but it is hurtful if you stand directly in it. If a fire is started above netherrack or a magma block, it will immediately turn into an eternal fire.=Feuer ist ein schädlicher und destruktiver aber kurzlebiger Block. Es wird sich zu entzündlichen Blöcken ausbreiten und sie zerstören, aber Feuer wird verschwinden, wenn es nichts brennbares mehr gibt. Es wird von Wasser und Regen gelöscht. Feuer kann sicher mit einem Schlag zerstört werden, aber es tut weh, wenn man direkt in ihm steht. Wird ein Feuer über Netherrack oder einem Magmablock entfacht, wird er sich sofort zu einem ewigen Feuer verwandeln.
|
||||||
Fire is a damaging but non-destructive short-lived kind of block. It will disappear when there is no flammable block around. Fire does not destroy blocks, at least not in this world. It will be extinguished by nearby water and rain. Fire can be destroyed safely by punching it, but it is hurtful if you stand directly in it. If a fire is started above netherrack or a magma block, it will immediately turn into an eternal fire.=Feuer ist ein schädlicher aber nicht-destruktiver kurzlebiger Block. Es wird verschwinden, wenn sich keine entzündlichen Blöcke in der Nähe befinden. Feuer breitet sich nicht aus und zerstört keine Blöcke, zumindest nicht in dieser Welt. Es wird von Wasser und Regen gelöscht. Feuer kann sicher mit einem Schlag zerstört werden, aber es tut weh, wenn man direkt in ihm steht. Wird ein Feuer über Netherrack oder einem Magmablock entfacht, wird er sich sofort zu einem ewigen Feuer verwandeln.
|
Fire is a damaging but non-destructive short-lived kind of block. It will disappear when there is no flammable block around. Fire does not destroy blocks, at least not in this world. It will be extinguished by nearby water and rain. Fire can be destroyed safely by punching it, but it is hurtful if you stand directly in it. If a fire is started above netherrack or a magma block, it will immediately turn into an eternal fire.=Feuer ist ein schädlicher aber nicht-destruktiver kurzlebiger Block. Es wird verschwinden, wenn sich keine entzündlichen Blöcke in der Nähe befinden. Feuer breitet sich nicht aus und zerstört keine Blöcke, zumindest nicht in dieser Welt. Es wird von Wasser und Regen gelöscht. Feuer kann sicher mit einem Schlag zerstört werden, aber es tut weh, wenn man direkt in ihm steht. Wird ein Feuer über Netherrack oder einem Magmablock entfacht, wird er sich sofort zu einem ewigen Feuer verwandeln.
|
||||||
Eternal fire is a damaging block that might create more fire. It will create fire around it when flammable blocks are nearby. Eternal fire can be extinguished by punches and nearby water blocks. Other than (normal) fire, eternal fire does not get extinguished on its own and also continues to burn under rain. Punching eternal fire is safe, but it hurts if you stand inside.=Ewiges Feuer ist ein schädlicher Block, der mehr Feuer machen kann. Er wird um sich Feuer machen, wenn entflammbare Blöcke in der Nähe sind. Ewiges Feuer kann von Schlägen und Wasserblöcken in der Nähe gelöscht werden. Anders als (normales) Feuer geht ein ewiges Feuer nicht von alleine aus, auch nicht unter Regen. Es ist sicher, ein ewiges Feuer zu schlagen, aber es tut weh, wenn man direkt in einem steht.
|
Eternal fire is a damaging block that might create more fire. It will create fire around it when flammable blocks are nearby. Eternal fire can be extinguished by punches and nearby water blocks. Other than (normal) fire, eternal fire does not get extinguished on its own and also continues to burn under rain. Punching eternal fire is safe, but it hurts if you stand inside.=Ewiges Feuer ist ein schädlicher Block, der mehr Feuer machen kann. Er wird um sich Feuer machen, wenn entflammbare Blöcke in der Nähe sind. Ewiges Feuer kann von Schlägen und Wasserblöcken in der Nähe gelöscht werden. Anders als (normales) Feuer geht ein ewiges Feuer nicht von alleine aus, auch nicht unter Regen. Es ist sicher, ein ewiges Feuer zu schlagen, aber es tut weh, wenn man direkt in einem steht.
|
||||||
|
Eternal fire is a damaging block. Eternal fire can be extinguished by punches and nearby water blocks. Other than (normal) fire, eternal fire does not get extinguished on its own and also continues to burn under rain. Punching eternal fire is safe, but it hurts if you stand inside.=Ewiges Feuer ist ein schädlicher Block. Ewiges Feuer kann von Schlägen und Wasserblöcken in der Nähe gelöscht werden. Anders als (normales) Feuer geht ein ewiges Feuer nicht von alleine aus, auch nicht unter Regen. Es ist sicher, ein ewiges Feuer zu schlagen, aber es tut weh, wenn man direkt in einem steht.
|
||||||
@1 has been cooked crisp.=@1 wurde knusprig gebraten.
|
@1 has been cooked crisp.=@1 wurde knusprig gebraten.
|
||||||
@1 felt the burn.=@1 ist völlig verbrannt.
|
@1 felt the burn.=@1 ist völlig verbrannt.
|
||||||
@1 died in the flames.=@1 starb in den Flammen.
|
@1 died in the flames.=@1 starb in den Flammen.
|
||||||
|
|
|
@ -8,6 +8,7 @@ Rightclick the surface of a block to attempt to light a fire in front of it or i
|
||||||
Fire is a damaging and destructive but short-lived kind of block. It will destroy and spread towards near flammable blocks, but fire will disappear when there is nothing to burn left. It will be extinguished by nearby water and rain. Fire can be destroyed safely by punching it, but it is hurtful if you stand directly in it. If a fire is started above netherrack or a magma block, it will immediately turn into an eternal fire.=
|
Fire is a damaging and destructive but short-lived kind of block. It will destroy and spread towards near flammable blocks, but fire will disappear when there is nothing to burn left. It will be extinguished by nearby water and rain. Fire can be destroyed safely by punching it, but it is hurtful if you stand directly in it. If a fire is started above netherrack or a magma block, it will immediately turn into an eternal fire.=
|
||||||
Fire is a damaging but non-destructive short-lived kind of block. It will disappear when there is no flammable block around. Fire does not destroy blocks, at least not in this world. It will be extinguished by nearby water and rain. Fire can be destroyed safely by punching it, but it is hurtful if you stand directly in it. If a fire is started above netherrack or a magma block, it will immediately turn into an eternal fire.=
|
Fire is a damaging but non-destructive short-lived kind of block. It will disappear when there is no flammable block around. Fire does not destroy blocks, at least not in this world. It will be extinguished by nearby water and rain. Fire can be destroyed safely by punching it, but it is hurtful if you stand directly in it. If a fire is started above netherrack or a magma block, it will immediately turn into an eternal fire.=
|
||||||
Eternal fire is a damaging block that might create more fire. It will create fire around it when flammable blocks are nearby. Eternal fire can be extinguished by punches and nearby water blocks. Other than (normal) fire, eternal fire does not get extinguished on its own and also continues to burn under rain. Punching eternal fire is safe, but it hurts if you stand inside.=
|
Eternal fire is a damaging block that might create more fire. It will create fire around it when flammable blocks are nearby. Eternal fire can be extinguished by punches and nearby water blocks. Other than (normal) fire, eternal fire does not get extinguished on its own and also continues to burn under rain. Punching eternal fire is safe, but it hurts if you stand inside.=
|
||||||
|
Eternal fire is a damaging block. Eternal fire can be extinguished by punches and nearby water blocks. Other than (normal) fire, eternal fire does not get extinguished on its own and also continues to burn under rain. Punching eternal fire is safe, but it hurts if you stand inside.=
|
||||||
@1 has been cooked crisp.=
|
@1 has been cooked crisp.=
|
||||||
@1 felt the burn.=
|
@1 felt the burn.=
|
||||||
@1 died in the flames.=
|
@1 died in the flames.=
|
||||||
|
|
|
@ -13,9 +13,9 @@ creative_mode (Creative mode) bool false
|
||||||
|
|
||||||
# Fire spreads and flammable blocks might be destroyed by nearby fire.
|
# Fire spreads and flammable blocks might be destroyed by nearby fire.
|
||||||
# Destructive fire may cause severe destruction.
|
# Destructive fire may cause severe destruction.
|
||||||
# Fire blocks will be non-destructive when this setting is disabled, but they
|
# Fire blocks will be non-destructive and stops spreading when this
|
||||||
# still deal damage to creatures. Eternal fire is unaffected.
|
# setting is disabled, but they still deal damage to creatures.
|
||||||
enable_fire (Destructive fire) bool true
|
enable_fire (Destructive and spreading fire) bool true
|
||||||
|
|
||||||
# If enabled, the weather will change naturally over time.
|
# If enabled, the weather will change naturally over time.
|
||||||
mcl_doWeatherCycle (Change weather) bool true
|
mcl_doWeatherCycle (Change weather) bool true
|
||||||
|
|
Loading…
Reference in New Issue