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:
parent
4e72be1355
commit
80655451eb
4
init.lua
4
init.lua
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user