Default/trees: Faster 'is snow nearby' function
authortenplus1 <tenplus1@users.noreply.github.com>
Wed, 10 Aug 2016 13:03:18 +0000 (14:03 +0100)
committerparamat <mat.gregory@virginmedia.com>
Mon, 15 Aug 2016 19:43:19 +0000 (20:43 +0100)
Use 'find node near' instead of 'find nodes in area'

mods/default/trees.lua

index 7df35666515a4d868f1e7957165aeb1b35385603..5cd7e156ae65df6f13cbd36f08422bc611a9ff32 100644 (file)
@@ -27,10 +27,8 @@ end
 -- 'is snow nearby' function
 
 local function is_snow_nearby(pos)
-       return #minetest.find_nodes_in_area(
-               {x = pos.x - 1, y = pos.y - 1, z = pos.z - 1},
-               {x = pos.x + 1, y = pos.y + 1, z = pos.z + 1},
-               {"default:snow", "default:snowblock", "default:dirt_with_snow"}) > 0
+       return minetest.find_node_near(pos, 1,
+               {"default:snow", "default:snowblock", "default:dirt_with_snow"})
 end