speed up torchlight

Since torchlight and air have no metadata contained inside them why not use minetest.swap_node to quickly update the light and NOT affect falling nodes around the player by using set_node.
This commit is contained in:
tenplus1 2016-05-01 16:01:37 +01:00 committed by Auke Kok
parent 4e72be1355
commit 80655451eb

View File

@ -135,7 +135,7 @@ end
local function remove_torchlight(pos)
if is_torchlight(pos) then
minetest.remove_node(pos)
minetest.swap_node(pos, {name = "air"})
end
end
@ -150,7 +150,7 @@ local function place_torchlight(pos)
return false
end
if name == "air" then
minetest.set_node(pos, {name = "torches:torchlight"})
minetest.swap_node(pos, {name = "torches:torchlight"})
return true
end
return false