mirror of
https://github.com/minetest/minetest_game.git
synced 2024-11-05 15:23:51 +01:00
Fire: Add 'permanent flame' node
Update 'disable fire' documentation in conf.example
This commit is contained in:
parent
7c0abe9366
commit
6f6d46ddfc
@ -9,7 +9,8 @@
|
|||||||
# 0 to disable
|
# 0 to disable
|
||||||
#share_bones_time = 1200
|
#share_bones_time = 1200
|
||||||
|
|
||||||
# Whether fire should be disabled (all fire nodes will instantly disappear)
|
# Whether standard fire should be disabled ('basic flame' nodes will disappear)
|
||||||
|
# 'permanent flame' nodes will remain with either setting
|
||||||
#disable_fire = false
|
#disable_fire = false
|
||||||
|
|
||||||
# Whether steel tools, torches and cobblestone should be given to new players
|
# Whether steel tools, torches and cobblestone should be given to new players
|
||||||
|
@ -5,25 +5,31 @@
|
|||||||
fire = {}
|
fire = {}
|
||||||
|
|
||||||
|
|
||||||
-- Register flame node
|
-- Register flame nodes
|
||||||
|
|
||||||
minetest.register_node("fire:basic_flame", {
|
minetest.register_node("fire:basic_flame", {
|
||||||
description = "Fire",
|
description = "Basic Flame",
|
||||||
drawtype = "firelike",
|
drawtype = "firelike",
|
||||||
tiles = {{
|
tiles = {
|
||||||
|
{
|
||||||
name = "fire_basic_flame_animated.png",
|
name = "fire_basic_flame_animated.png",
|
||||||
animation = {type = "vertical_frames",
|
animation = {
|
||||||
aspect_w = 16, aspect_h = 16, length = 1},
|
type = "vertical_frames",
|
||||||
}},
|
aspect_w = 16,
|
||||||
|
aspect_h = 16,
|
||||||
|
length = 1
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
inventory_image = "fire_basic_flame.png",
|
inventory_image = "fire_basic_flame.png",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
light_source = 14,
|
light_source = 14,
|
||||||
groups = {igniter = 2, dig_immediate = 3},
|
|
||||||
drop = '',
|
|
||||||
walkable = false,
|
walkable = false,
|
||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
damage_per_second = 4,
|
damage_per_second = 4,
|
||||||
|
groups = {igniter = 2, dig_immediate = 3},
|
||||||
|
drop = "",
|
||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
minetest.after(0, fire.on_flame_add_at, pos)
|
minetest.after(0, fire.on_flame_add_at, pos)
|
||||||
@ -33,7 +39,36 @@ minetest.register_node("fire:basic_flame", {
|
|||||||
minetest.after(0, fire.on_flame_remove_at, pos)
|
minetest.after(0, fire.on_flame_remove_at, pos)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_blast = function() end, -- unaffected by explosions
|
on_blast = function()
|
||||||
|
end, -- unaffected by explosions
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("fire:permanent_flame", {
|
||||||
|
description = "Permanent Flame",
|
||||||
|
drawtype = "firelike",
|
||||||
|
tiles = {
|
||||||
|
{
|
||||||
|
name = "fire_basic_flame_animated.png",
|
||||||
|
animation = {
|
||||||
|
type = "vertical_frames",
|
||||||
|
aspect_w = 16,
|
||||||
|
aspect_h = 16,
|
||||||
|
length = 1
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
inventory_image = "fire_basic_flame.png",
|
||||||
|
paramtype = "light",
|
||||||
|
light_source = 14,
|
||||||
|
walkable = false,
|
||||||
|
buildable_to = true,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
damage_per_second = 4,
|
||||||
|
groups = {igniter = 2, dig_immediate = 3},
|
||||||
|
drop = "",
|
||||||
|
|
||||||
|
on_blast = function()
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -129,27 +164,10 @@ function fire.flame_should_extinguish(pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Enable ABMs according to 'disable fire' setting
|
-- Extinguish all flames quickly with water, snow, ice
|
||||||
|
|
||||||
if minetest.setting_getbool("disable_fire") then
|
minetest.register_abm({
|
||||||
|
nodenames = {"fire:basic_flame", "fire:permanent_flame"},
|
||||||
-- Extinguish flames quickly with dedicated ABM
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"fire:basic_flame"},
|
|
||||||
interval = 3,
|
|
||||||
chance = 2,
|
|
||||||
action = function(p0, node, _, _)
|
|
||||||
minetest.remove_node(p0)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
-- Extinguish flames quickly with water, snow, ice
|
|
||||||
|
|
||||||
minetest.register_abm({
|
|
||||||
nodenames = {"fire:basic_flame"},
|
|
||||||
neighbors = {"group:puts_out_fire"},
|
neighbors = {"group:puts_out_fire"},
|
||||||
interval = 3,
|
interval = 3,
|
||||||
chance = 2,
|
chance = 2,
|
||||||
@ -158,9 +176,27 @@ else
|
|||||||
minetest.sound_play("fire_extinguish_flame",
|
minetest.sound_play("fire_extinguish_flame",
|
||||||
{pos = p0, max_hear_distance = 16, gain = 0.25})
|
{pos = p0, max_hear_distance = 16, gain = 0.25})
|
||||||
end,
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
-- Enable the following ABMs according to 'disable fire' setting
|
||||||
|
|
||||||
|
if minetest.setting_getbool("disable_fire") then
|
||||||
|
|
||||||
|
-- Remove basic flames only
|
||||||
|
|
||||||
|
minetest.register_abm({
|
||||||
|
nodenames = {"fire:basic_flame"},
|
||||||
|
interval = 7,
|
||||||
|
chance = 2,
|
||||||
|
action = function(p0, node, _, _)
|
||||||
|
minetest.remove_node(p0)
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Ignite neighboring nodes
|
else
|
||||||
|
|
||||||
|
-- Ignite neighboring nodes, add basic flames
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"group:flammable"},
|
nodenames = {"group:flammable"},
|
||||||
@ -179,7 +215,7 @@ else
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Remove flames and flammable nodes
|
-- Remove basic flames and flammable nodes
|
||||||
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"fire:basic_flame"},
|
nodenames = {"fire:basic_flame"},
|
||||||
|
Loading…
Reference in New Issue
Block a user