Default: add setting to disable liquid particles

You can set 'enable_liquid_particles=false' in .conf
This commit is contained in:
MoNTE48 2020-12-25 15:52:33 +01:00
parent b2d120f1a9
commit 40717d3f7e

View File

@ -742,54 +742,56 @@ end
-- Liquid particles -- Liquid particles
-- --
local add_particlespawner = minetest.add_particlespawner if minetest.settings:get_bool("enable_liquid_particles") ~= false then
local get_node = minetest.get_node local add_particlespawner = minetest.add_particlespawner
local registered_nodes = minetest.registered_nodes local get_node = minetest.get_node
local registered_nodes = minetest.registered_nodes
minetest.register_abm({ minetest.register_abm({
label = "Liquid particles", label = "Liquid particles",
nodenames = {"group:liquid"}, nodenames = {"group:liquid"},
interval = 15, interval = 15,
chance = 3, chance = 3,
catch_up = false, catch_up = false,
action = function(pos, node) action = function(pos, node)
local nname = node.name local nname = node.name
if get_node({x = pos.x, y = pos.y - 2, z = pos.z}).name == "air" then if get_node({x = pos.x, y = pos.y - 2, z = pos.z}).name == "air" then
local tiles = registered_nodes[nname].tiles local tiles = registered_nodes[nname].tiles
local texture = tiles[1] local texture = tiles[1]
if texture.name ~= nil then if texture.name ~= nil then
texture = texture.name texture = texture.name
end
add_particlespawner({
amount = 5,
time = 15,
minpos = {x = pos.x - 0.5, y = pos.y - 1, z = pos.z - 0.5},
maxpos = {x = pos.x + 0.5, y = pos.y - 1, z = pos.z + 0.5},
minvel = {x = 0, y = -1, z = 0},
maxvel = {x = 0, y = -1, z = 0},
minexptime = 2,
maxexptime = 4,
vertical = true,
texture = texture .. "^[resize:16x16^[mask:default_liquid_drop.png"
})
end end
add_particlespawner({ if (nname == "default:lava_source" or nname == "default:lava_flowing")
amount = 5, and get_node({x = pos.x, y = pos.y + 1, z = pos.z}).name == "air" then
time = 15, add_particlespawner({
minpos = {x = pos.x - 0.5, y = pos.y - 1, z = pos.z - 0.5}, amount = 5,
maxpos = {x = pos.x + 0.5, y = pos.y - 1, z = pos.z + 0.5}, time = 15,
minvel = {x = 0, y = -1, z = 0}, minpos = {x = pos.x - 0.5, y = pos.y, z = pos.z - 0.5},
maxvel = {x = 0, y = -1, z = 0}, maxpos = {x = pos.x + 0.5, y = pos.y, z = pos.z + 0.5},
minexptime = 2, minvel = {x = 0, y = 1, z = 0},
maxexptime = 4, maxvel = {x = 0, y = 1, z = 0},
vertical = true, minexptime = 2,
texture = texture .. "^[resize:16x16^[mask:default_liquid_drop.png" maxexptime = 2,
}) vertical = true,
texture = "default_lava.png",
glow = 3
})
end
end end
})
if (nname == "default:lava_source" or nname == "default:lava_flowing") end
and get_node({x = pos.x, y = pos.y + 1, z = pos.z}).name == "air" then
add_particlespawner({
amount = 5,
time = 15,
minpos = {x = pos.x - 0.5, y = pos.y, z = pos.z - 0.5},
maxpos = {x = pos.x + 0.5, y = pos.y, z = pos.z + 0.5},
minvel = {x = 0, y = 1, z = 0},
maxvel = {x = 0, y = 1, z = 0},
minexptime = 2,
maxexptime = 2,
vertical = true,
texture = "default_lava.png",
glow = 3
})
end
end
})