From: tenplus1 Date: Wed, 10 Aug 2016 13:03:18 +0000 (+0100) Subject: Default/trees: Faster 'is snow nearby' function X-Git-Tag: 0.4.15~108 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1b745d401df6a5fda7845dd080f0f0bdb948b4c8;p=oweals%2Fminetest_game.git Default/trees: Faster 'is snow nearby' function Use 'find node near' instead of 'find nodes in area' --- diff --git a/mods/default/trees.lua b/mods/default/trees.lua index 7df35666..5cd7e156 100644 --- a/mods/default/trees.lua +++ b/mods/default/trees.lua @@ -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