mirror of
https://github.com/Splizard/minetest-mod-snow.git
synced 2024-11-14 13:50:18 +01:00
use the heightmap to reduce ground searching
This commit is contained in:
parent
939c63e507
commit
a217f17566
|
@ -147,6 +147,8 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
local data = vm:get_data()
|
local data = vm:get_data()
|
||||||
local param2s = vm:get_param2_data()
|
local param2s = vm:get_param2_data()
|
||||||
|
|
||||||
|
local heightmap = minetest.get_mapgen_object("heightmap")
|
||||||
|
|
||||||
local snow_tab,num = {},1
|
local snow_tab,num = {},1
|
||||||
local pines_tab,pnum = {},1
|
local pines_tab,pnum = {},1
|
||||||
|
|
||||||
|
@ -199,11 +201,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
and test
|
and test
|
||||||
and test > smooth_rarity_min then
|
and test > smooth_rarity_min then
|
||||||
-- remove trees near alpine
|
-- remove trees near alpine
|
||||||
local ground_y = nil
|
local ground_y
|
||||||
for y = maxp.y, minp.y, -1 do
|
for y = math.min(heightmap[ni]+20, maxp.y), math.max(minp.y, heightmap[ni]-5), -1 do
|
||||||
local nodid = data[area:index(x, y, z)]
|
if data[area:index(x, y, z)] ~= c.air then
|
||||||
if nodid ~= c.air
|
|
||||||
and nodid ~= c.ignore then
|
|
||||||
ground_y = y
|
ground_y = y
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
@ -242,8 +242,9 @@ minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
local icesheet = icetype > -0.6 and icetype <= -0.4
|
local icesheet = icetype > -0.6 and icetype <= -0.4
|
||||||
local icecave = icetype <= -0.6
|
local icecave = icetype <= -0.6
|
||||||
|
|
||||||
|
|
||||||
local ground_y
|
local ground_y
|
||||||
for y = maxp.y, minp.y, -1 do
|
for y = math.min(heightmap[ni]+20, maxp.y), math.max(minp.y, heightmap[ni]-5), -1 do
|
||||||
local nodid = data[area:index(x, y, z)]
|
local nodid = data[area:index(x, y, z)]
|
||||||
if nodid ~= c.air then
|
if nodid ~= c.air then
|
||||||
ground_y = y
|
ground_y = y
|
||||||
|
|
Loading…
Reference in New Issue
Block a user