Add setting to disable node particles

This commit is contained in:
Wuzzy 2020-08-19 16:37:28 +02:00
parent 2a1273b7e3
commit 9f43d6a5a5
2 changed files with 12 additions and 0 deletions

View File

@ -2,12 +2,18 @@ local particle_nodes = {}
mcl_particles = {} mcl_particles = {}
-- Node particles can be disabled via setting
local node_particles_allowed = minetest.settings:get_bool("mcl_node_particles", true)
-- Add a particlespawner that is assigned to a given node position. -- Add a particlespawner that is assigned to a given node position.
-- * pos: Node positon. MUST use rounded values! -- * pos: Node positon. MUST use rounded values!
-- * particlespawner_definition: definition for minetest.add_particlespawner -- * particlespawner_definition: definition for minetest.add_particlespawner
-- NOTE: All particlespawners are automatically removed on shutdown. -- NOTE: All particlespawners are automatically removed on shutdown.
-- Returns particlespawner ID on succcess and nil on failure -- Returns particlespawner ID on succcess and nil on failure
function mcl_particles.add_node_particlespawner(pos, particlespawner_definition) function mcl_particles.add_node_particlespawner(pos, particlespawner_definition)
if not node_particles_allowed then
return
end
local poshash = minetest.hash_node_position(pos) local poshash = minetest.hash_node_position(pos)
if not poshash then if not poshash then
return return
@ -25,6 +31,9 @@ end
-- pos: Node positon. MUST use rounded values! -- pos: Node positon. MUST use rounded values!
-- Returns true if particlespawner could be removed and false if none existed -- Returns true if particlespawner could be removed and false if none existed
function mcl_particles.delete_node_particlespawner(pos) function mcl_particles.delete_node_particlespawner(pos)
if not node_particles_allowed then
return false
end
local poshash = minetest.hash_node_position(pos) local poshash = minetest.hash_node_position(pos)
local id = particle_nodes[poshash] local id = particle_nodes[poshash]
if id then if id then

View File

@ -27,6 +27,9 @@ mcl_doTileDrops (Blocks have drops) bool true
# If enabled, TNT explosions destroy blocks. # If enabled, TNT explosions destroy blocks.
mcl_tnt_griefing (TNT destroys blocks) bool true mcl_tnt_griefing (TNT destroys blocks) bool true
# If enabled, some blocks will emit decorative particles like flames.
mcl_node_particles (Block particles) bool true
[Players] [Players]
# If enabled, players respawn at the bed they last lay on instead of normal # If enabled, players respawn at the bed they last lay on instead of normal
# spawn. # spawn.