Allow biome pos restrictions
parent
1c74ea3c60
commit
5005ae7d32
12
init.lua
12
init.lua
|
@ -366,11 +366,12 @@ function internal.clean_shape_def(def)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get the most nearby cave biome
|
-- Get the most nearby cave biome
|
||||||
function internal.closest_cave_biome(heat, humidity)
|
function internal.closest_cave_biome(heat, humidity, pos)
|
||||||
local biome = internal.default_biome()
|
local biome = internal.default_biome()
|
||||||
local d = internal.biome_def_distance(biome, heat, humidity)
|
local d = internal.biome_def_distance(biome, heat, humidity)
|
||||||
|
|
||||||
for _, def in pairs(noordstar_caves.registered_biomes) do
|
for _, def in pairs(noordstar_caves.registered_biomes) do
|
||||||
|
if internal.is_valid_pos(pos, def.minp, def.maxp) then
|
||||||
local new_d = internal.biome_def_distance(def, heat, humidity)
|
local new_d = internal.biome_def_distance(def, heat, humidity)
|
||||||
|
|
||||||
if new_d <= d then
|
if new_d <= d then
|
||||||
|
@ -378,16 +379,18 @@ function internal.closest_cave_biome(heat, humidity)
|
||||||
d = new_d
|
d = new_d
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return biome
|
return biome
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Get the most nearby cave shape
|
-- Get the most nearby cave shape
|
||||||
function internal.closest_cave_shape(cnct, vrtcl)
|
function internal.closest_cave_shape(cnct, vrtcl, y)
|
||||||
local shape = internal.default_shape()
|
local shape = internal.default_shape()
|
||||||
local d = internal.shape_def_distance(shape, cnct, vrtcl)
|
local d = internal.shape_def_distance(shape, cnct, vrtcl)
|
||||||
|
|
||||||
for key, def in pairs(noordstar_caves.registered_shapes) do
|
for key, def in pairs(noordstar_caves.registered_shapes) do
|
||||||
|
if def.y_min <= y and y <= def.y_max then
|
||||||
local new_d = internal.shape_def_distance(def, cnct, vrtcl)
|
local new_d = internal.shape_def_distance(def, cnct, vrtcl)
|
||||||
|
|
||||||
if new_d <= d then
|
if new_d <= d then
|
||||||
|
@ -395,6 +398,7 @@ function internal.closest_cave_shape(cnct, vrtcl)
|
||||||
d = new_d
|
d = new_d
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return shape
|
return shape
|
||||||
end
|
end
|
||||||
|
@ -516,7 +520,7 @@ function internal.flat_from_cave_bools(minp, maxp)
|
||||||
local cnct = connectivity:get_index(i)
|
local cnct = connectivity:get_index(i)
|
||||||
local vrtcl = verticality:get_index(i)
|
local vrtcl = verticality:get_index(i)
|
||||||
|
|
||||||
local def = internal.closest_cave_shape(cnct, vrtcl)
|
local def = internal.closest_cave_shape(cnct, vrtcl, pos.y)
|
||||||
|
|
||||||
return def.name
|
return def.name
|
||||||
end)
|
end)
|
||||||
|
@ -735,7 +739,7 @@ function internal.generate_caves(data, minp, maxp)
|
||||||
local heat = heat_points:get_index(i)
|
local heat = heat_points:get_index(i)
|
||||||
local humidity = humidity_points:get_index(i)
|
local humidity = humidity_points:get_index(i)
|
||||||
|
|
||||||
local def = internal.closest_cave_biome(heat, humidity)
|
local def = internal.closest_cave_biome(heat, humidity, pos)
|
||||||
|
|
||||||
if nt == internal.node_types.floor then
|
if nt == internal.node_types.floor then
|
||||||
place(def.node_floor)
|
place(def.node_floor)
|
||||||
|
|
Loading…
Reference in New Issue