Skip to content

Commit

Permalink
Default/trees: Faster 'is snow nearby' function
Browse files Browse the repository at this point in the history
Use 'find node near' instead of 'find nodes in area'
  • Loading branch information
tenplus1 authored and paramat committed Aug 15, 2016
1 parent 2ecbc43 commit 1b745d4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions mods/default/trees.lua
Expand Up @@ -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


Expand Down

0 comments on commit 1b745d4

Please sign in to comment.