Compare commits

..

No commits in common. "ae5b7f33e27f81f2e389853bacd37537442be660" and "ec16b9b322ccdb93f877a2d432ae38348cb2b7ef" have entirely different histories.

6 changed files with 11 additions and 18 deletions

View File

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -1,9 +1,8 @@
```
--------------------------------------------------------------------------------
--
-- CONIFERS MOD
-- For Minetest
-- Created originally by Cisoun (cysoun[at]gmail.com).
-- Created by Cisoun (cysoun[at]gmail.com).
--
-- This mod adds some conifers randomly at a certain altitude.
-- There are two types of conifers: regular and narrow.
@ -11,10 +10,7 @@
-- choose if you want to keep normal trees above this altitude.
--
--------------------------------------------------------------------------------
```
For a description of this mod, see
https://forum.minetest.net/viewtopic.php?f=9&t=10268&p=156575.
TODO:
* Move settings to settingtypes.txt
— add a TODO list

View File

@ -256,7 +256,7 @@ function conifers:is_node_in_cube(nodenames, pos, size)
for x = pos.x-size, pos.x+size do
for y = pos.y-hs, pos.y+hs do
for z = pos.z-size, pos.z+size do
local n = minetest.get_node_or_nil{x=x, y=y, z=z}
local n = minetest.get_node_or_nil({x=x, y=y, z=z})
if n == nil
or n.name == "ignore"
or conifers:table_contains(nodenames, n.name) then
@ -419,12 +419,12 @@ function conifers:make_conifer(pos, conifer_type)
nodes = manip:get_data()
-- Check if we can gros a conifer at this place.
local vi = area:indexp(pos)
local id = nodes[vi]
local p_pos = area:index(pos.x, pos.y, pos.z)
local d_p_pos = nodes[p_pos]
if nodes[vi - area.ystride] ~= conifers_c_dirt_with_grass
and (id ~= conifers_c_air
or id ~= conifers_c_con_sapling
if nodes[area:index(pos.x, pos.y-1, pos.z)] ~= conifers_c_dirt_with_grass
and (d_p_pos ~= conifers_c_air
or d_p_pos ~= conifers_c_con_sapling
) then
return false
--else
@ -436,13 +436,11 @@ function conifers:make_conifer(pos, conifer_type)
-- Let's check if we can grow a tree here.
-- That means, we must have a column of "height" high which contains
-- only air.
local ti = vi + area.ystride -- Start from 1 so we can grow a sapling.
for _ = 1, height - 1 do
if nodes[ti] ~= conifers_c_air then
for j = 1, height - 1 do -- Start from 1 so we can grow a sapling.
if nodes[area:index(pos.x, pos.y+j, pos.z)] ~= conifers_c_air then
-- Abort
return false
end
ti = ti + area.ystride
end
local leaves_height = math.random(LEAVES_MINHEIGHT, LEAVES_MAXHEIGHT) -- Level from where the leaves grow.
@ -455,7 +453,7 @@ function conifers:make_conifer(pos, conifer_type)
for i = 0, height - 1 do
current_block = {x=pos.x, y=pos.y+i, z=pos.z}
-- Put a trunk block.
nodes[vi] = conifers_c_con_trunk
nodes[area:index(pos.x, pos.y+i, pos.z)] = conifers_c_con_trunk
-- Put some leaves.
if i >= leaves_height then
-- Put some leaves.
@ -482,7 +480,6 @@ function conifers:make_conifer(pos, conifer_type)
end
end
end
vi = vi + area.ystride
end
-- Put a top leaves block.