summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root@linuxworks.belug.de>2017-12-18 00:03:42 +0100
committerroot <root@linuxworks.belug.de>2017-12-18 00:03:42 +0100
commita2ca81a30e615b66694d177d0ec654a28bf407fb (patch)
treead978017b7d91a849a7f8aad39de70705f9a5843
parent31e998894d2aa44260361765d55339b37d919cd6 (diff)
parent1c0e3c72156d87ad3f6b4ba2c8d537a2f9b622c6 (diff)
Merge branch 'master' of https://github.com/minetest-mods/moretrees
-rw-r--r--.luacheckrc17
-rw-r--r--date_palm.lua17
2 files changed, 28 insertions, 6 deletions
diff --git a/.luacheckrc b/.luacheckrc
new file mode 100644
index 0000000..2933f30
--- /dev/null
+++ b/.luacheckrc
@@ -0,0 +1,17 @@
+unused_args = false
+allow_defined_top = true
+
+read_globals = {
+ "DIR_DELIM",
+ "minetest", "core",
+ "dump",
+ "vector", "nodeupdate",
+ "VoxelManip", "VoxelArea",
+ "PseudoRandom", "ItemStack",
+ "intllib",
+ "default",
+ table = { fields = { "copy", "getn" } },
+ "biome_lib",
+ "stairs", "stairsplus",
+}
+
diff --git a/date_palm.lua b/date_palm.lua
index 0c40b72..f8b3e42 100644
--- a/date_palm.lua
+++ b/date_palm.lua
@@ -223,13 +223,18 @@ local function find_fruit_trunks_near(ftpos, sect)
return nil
end
+ local basevec = { x = ftpos.x + 2 * sect.x * sect_hr,
+ y = ftpos.y,
+ z = ftpos.z + 2 * sect.z * sect_hr}
+ -- find_nodes_in_area is limited to 82^3, make sure to not overrun it
+ local sizevec = { x = sect_hr, y = sect_vr, z = sect_hr }
+ if sect_hr * sect_hr * sect_vr > 41^3 then
+ sizevec = vector.apply(sizevec, function(a) return math.min(a, 41) end)
+ end
+
local all_palms = minetest.find_nodes_in_area(
- { x = ftpos.x + 2 * sect.x * sect_hr - sect_hr,
- y = ftpos.y - sect_vr,
- z = ftpos.z + 2 * sect.z * sect_hr - sect_hr },
- { x = ftpos.x + 2 * sect.x * sect_hr + sect_hr,
- y = ftpos.y + sect_vr,
- z = ftpos.z + 2 * sect.z * sect_hr + sect_hr },
+ vector.subtract(basevec, sizevec),
+ vector.add(basevec, sizevec),
{"moretrees:date_palm_mfruit_trunk", "moretrees:date_palm_ffruit_trunk"})
-- Collect different palms in separate lists.