merge upstream
This commit is contained in:
commit
2e451bd11e
236 changed files with 7780 additions and 2577 deletions
|
@ -4,8 +4,8 @@ See license.txt for license information.
|
|||
|
||||
Authors of source code
|
||||
----------------------
|
||||
Originally by Perttu Ahola (celeron55) <celeron55@gmail.com> (LGPL 2.1)
|
||||
Various Minetest developers and contributors (LGPL 2.1)
|
||||
Originally by Perttu Ahola (celeron55) <celeron55@gmail.com> (LGPLv2.1+)
|
||||
Various Minetest developers and contributors (LGPLv2.1+)
|
||||
|
||||
Authors of media (textures and sounds)
|
||||
--------------------------------------
|
||||
|
|
|
@ -2,11 +2,38 @@
|
|||
|
||||
fire = {}
|
||||
|
||||
-- 'Enable fire' setting
|
||||
|
||||
local fire_enabled = minetest.settings:get_bool("enable_fire")
|
||||
if fire_enabled == nil then
|
||||
-- enable_fire setting not specified, check for disable_fire
|
||||
local fire_disabled = minetest.settings:get_bool("disable_fire")
|
||||
if fire_disabled == nil then
|
||||
-- Neither setting specified, check whether singleplayer
|
||||
fire_enabled = minetest.is_singleplayer()
|
||||
else
|
||||
fire_enabled = not fire_disabled
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- Items
|
||||
--
|
||||
|
||||
-- Flood flame function
|
||||
|
||||
local function flood_flame(pos, oldnode, newnode)
|
||||
-- Play flame extinguish sound if liquid is not an 'igniter'
|
||||
local nodedef = minetest.registered_items[newnode.name]
|
||||
if not (nodedef and nodedef.groups and
|
||||
nodedef.groups.igniter and nodedef.groups.igniter > 0) then
|
||||
minetest.sound_play("fire_extinguish_flame",
|
||||
{pos = pos, max_hear_distance = 16, gain = 0.15})
|
||||
end
|
||||
-- Remove the flame
|
||||
return false
|
||||
end
|
||||
|
||||
-- Flame nodes
|
||||
|
||||
minetest.register_node("fire:basic_flame", {
|
||||
|
@ -28,22 +55,30 @@ minetest.register_node("fire:basic_flame", {
|
|||
walkable = false,
|
||||
buildable_to = true,
|
||||
sunlight_propagates = true,
|
||||
floodable = true,
|
||||
damage_per_second = 4,
|
||||
groups = {igniter = 2, dig_immediate = 3, not_in_creative_inventory = 1},
|
||||
on_timer = function(pos)
|
||||
--local f = minetest.find_node_near(pos, 1, {"group:flammable"})
|
||||
--if not f then
|
||||
minetest.remove_node(pos)
|
||||
-- return
|
||||
--end
|
||||
-- Restart timer
|
||||
return false
|
||||
end,
|
||||
drop = "",
|
||||
|
||||
on_construct = function(pos)
|
||||
minetest.get_node_timer(pos):start(math.random(20, 30))
|
||||
on_timer = function(pos)
|
||||
local f = minetest.find_node_near(pos, 1, {"group:flammable"})
|
||||
if not fire_enabled or not f then
|
||||
minetest.remove_node(pos)
|
||||
return
|
||||
end
|
||||
-- Restart timer
|
||||
return true
|
||||
end,
|
||||
|
||||
on_construct = function(pos)
|
||||
if not fire_enabled then
|
||||
minetest.remove_node(pos)
|
||||
else
|
||||
minetest.get_node_timer(pos):start(math.random(20, 30))
|
||||
end
|
||||
end,
|
||||
|
||||
on_flood = flood_flame,
|
||||
})
|
||||
|
||||
minetest.register_node("fire:permanent_flame", {
|
||||
|
@ -66,9 +101,12 @@ minetest.register_node("fire:permanent_flame", {
|
|||
walkable = false,
|
||||
buildable_to = true,
|
||||
sunlight_propagates = true,
|
||||
floodable = true,
|
||||
damage_per_second = 4,
|
||||
groups = {igniter = 2, dig_immediate = 3},
|
||||
drop = "",
|
||||
|
||||
on_flood = flood_flame,
|
||||
})
|
||||
|
||||
|
||||
|
@ -169,7 +207,7 @@ if flame_sound then
|
|||
function fire.update_player_sound(player)
|
||||
local player_name = player:get_player_name()
|
||||
-- Search for flame nodes in radius around player
|
||||
local ppos = player:getpos()
|
||||
local ppos = player:get_pos()
|
||||
local areamin = vector.subtract(ppos, radius)
|
||||
local areamax = vector.add(ppos, radius)
|
||||
local fpos, num = minetest.find_nodes_in_area(
|
||||
|
@ -271,51 +309,7 @@ end
|
|||
-- ABMs
|
||||
--
|
||||
|
||||
-- Extinguish all flames quickly with water, snow, ice
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Extinguish flame",
|
||||
nodenames = {"fire:basic_flame", "fire:permanent_flame"},
|
||||
neighbors = {"group:puts_out_fire"},
|
||||
interval = 3,
|
||||
chance = 1,
|
||||
catch_up = false,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
minetest.remove_node(pos)
|
||||
minetest.sound_play("fire_extinguish_flame",
|
||||
{pos = pos, max_hear_distance = 16, gain = 0.15})
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
-- Enable the following ABMs according to 'enable fire' setting
|
||||
--[[
|
||||
local fire_enabled = minetest.settings:get_bool("enable_fire")
|
||||
if fire_enabled == nil then
|
||||
-- enable_fire setting not specified, check for disable_fire
|
||||
local fire_disabled = minetest.settings:get_bool("disable_fire")
|
||||
if fire_disabled == nil then
|
||||
-- Neither setting specified, check whether singleplayer
|
||||
fire_enabled = minetest.is_singleplayer()
|
||||
else
|
||||
fire_enabled = not fire_disabled
|
||||
end
|
||||
end
|
||||
|
||||
if not fire_enabled then
|
||||
|
||||
-- Remove basic flames only if fire disabled
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Remove disabled fire",
|
||||
nodenames = {"fire:basic_flame"},
|
||||
interval = 7,
|
||||
chance = 1,
|
||||
catch_up = false,
|
||||
action = minetest.remove_node,
|
||||
})
|
||||
|
||||
else -- Fire enabled
|
||||
if fire_enabled then
|
||||
|
||||
-- Ignite neighboring nodes, add basic flames
|
||||
|
||||
|
@ -327,10 +321,6 @@ else -- Fire enabled
|
|||
chance = 12,
|
||||
catch_up = false,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
-- If there is water or stuff like that around node, don't ignite
|
||||
if minetest.find_node_near(pos, 1, {"group:puts_out_fire"}) then
|
||||
return
|
||||
end
|
||||
local p = minetest.find_node_near(pos, 1, {"air"})
|
||||
if p then
|
||||
minetest.set_node(p, {name = "fire:basic_flame"})
|
||||
|
@ -362,4 +352,4 @@ else -- Fire enabled
|
|||
end,
|
||||
})
|
||||
|
||||
end]]
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue