summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTenPlus1 <kinsellaja@yahoo.com>2015-11-15 21:17:28 +0000
committerTenPlus1 <kinsellaja@yahoo.com>2015-11-15 21:17:28 +0000
commitd025784f3096bced6f0e7384b2c4d3c8a994cdac (patch)
tree004b60e5fbb1cb2eb24b90f545ea0db9c83837fb
parentbc2b58ab8eb7593bd40abb5b6bf7ad0eded8a3d4 (diff)
Speed up specific node checks
-rw-r--r--dirt.lua2
-rw-r--r--extra.lua2
-rw-r--r--flowers.lua8
-rw-r--r--water.lua2
4 files changed, 7 insertions, 7 deletions
diff --git a/dirt.lua b/dirt.lua
index 62792a5..3d5fa8e 100644
--- a/dirt.lua
+++ b/dirt.lua
@@ -73,7 +73,7 @@ minetest.register_abm({
local count_grasses = {}
local curr_max = 0
local curr_type = "ethereal:green_dirt" -- fallback
- local positions = minetest.find_nodes_in_area(
+ local positions = minetest.find_nodes_in_area_under_air(
{x = (pos.x - 2), y = (pos.y - 1), z = (pos.z - 2)},
{x = (pos.x + 2), y = (pos.y + 1), z = (pos.z + 2)},
"group:ethereal_grass")
diff --git a/extra.lua b/extra.lua
index 9f118a5..41d304d 100644
--- a/extra.lua
+++ b/extra.lua
@@ -308,7 +308,7 @@ minetest.register_on_generated(function(minp, maxp)
return
end
local bpos
- for key, pos in pairs(minetest.find_nodes_in_area(minp, maxp, "default:stone_with_coal")) do
+ for key, pos in pairs(minetest.find_nodes_in_area_under_air(minp, maxp, "default:stone_with_coal")) do
bpos = {x = pos.x, y = pos.y + 1, z = pos.z }
if minetest.get_node(bpos).name == "air" then
if bpos.y > -3000 and bpos.y < -2000 then
diff --git a/flowers.lua b/flowers.lua
index 36da2e1..be1d854 100644
--- a/flowers.lua
+++ b/flowers.lua
@@ -16,10 +16,10 @@ minetest.register_abm({
local pos0 = {x = pos.x - 4, y = pos.y - 2, z = pos.z - 4}
local pos1 = {x = pos.x + 4, y = pos.y + 2, z = pos.z + 4}
- if #minetest.find_nodes_in_area(pos0, pos1, "group:flora") > 3 then
+ if #minetest.find_nodes_in_area_under_air(pos0, pos1, "group:flora") > 3 then
- local grass = minetest.find_nodes_in_area(pos0, pos1, {"ethereal:crystalgrass"})
- local crystal = minetest.find_nodes_in_area(pos0, pos1, {"ethereal:crystal_spike"})
+ local grass = minetest.find_nodes_in_area_under_air(pos0, pos1, {"ethereal:crystalgrass"})
+ local crystal = minetest.find_nodes_in_area_under_air(pos0, pos1, {"ethereal:crystal_spike"})
if #grass > 6 and #crystal < 1 then
grass = grass[math.random(#grass)]
@@ -33,7 +33,7 @@ minetest.register_abm({
return
end
- local seedling = minetest.find_nodes_in_area(pos0, pos1, {"group:soil"})
+ local seedling = minetest.find_nodes_in_area_under_air(pos0, pos1, {"group:soil"})
if #seedling > 0 then
seedling = seedling[math.random(#seedling)]
diff --git a/water.lua b/water.lua
index 3b0ba81..27325a1 100644
--- a/water.lua
+++ b/water.lua
@@ -62,7 +62,7 @@ minetest.register_abm({
chance = 4,
catch_up = false,
action = function(pos, node)
- local water = minetest.find_nodes_in_area(
+ local water = minetest.find_nodes_in_area_under_air(
{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:water_source", "default:river_water_source"})