Created
December 15, 2017 20:14
-
-
Save ahkok/f8058bb96b4807b4ff76f8ecd62f170a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/date_palm.lua b/date_palm.lua | |
| index 0c40b72..d20f9ac 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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment