wip
This commit is contained in:
@@ -33,7 +33,7 @@ end
|
||||
region:Region - the region currently being generated
|
||||
]]--
|
||||
function private.assign_biomes(region)
|
||||
region.iterate_columns(function(x, z)
|
||||
region:iterate_columns(function(x, z)
|
||||
local terrain_type = region:get_meta(Region.META.TERRAIN_TYPE, x, z)
|
||||
local terrain = C.TERRAIN_TYPES[terrain_type]
|
||||
region:set_meta(Region.META.BIOME, x, z, core.get_biome_id(terrain.name))
|
||||
@@ -47,12 +47,12 @@ end
|
||||
region:Region - the region currently being generated
|
||||
]]--
|
||||
function private.fill_surface(region)
|
||||
region.iterate_columns(function(x, z)
|
||||
region:iterate_columns(function(x, z)
|
||||
local biome_id = region:get_meta(Region.META.BIOME, x, z)
|
||||
local biome_name = core.get_biome_name(biome_id)
|
||||
local biome = core.registered_biomes[biome_name]
|
||||
|
||||
local y = region:get_meta(Region.META.ALTITUDE)
|
||||
local y = region:get_meta(Region.META.ALTITUDE, x, z)
|
||||
local top_count = biome.depth_top or 0
|
||||
local filler_count = biome.depth_filler or 0
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ local Region = dofile(path.."/common/region.lua")
|
||||
local table = dofile(path.."/common/table.lua")
|
||||
|
||||
local biomes = dofile(core.get_modpath("jvmi_biomes").."/mapenv.lua")
|
||||
local check = dofile(core.get_game_info().path.."/common/check.lua")
|
||||
local dump = dofile(core.get_game_info().path.."/common/dump.lua")
|
||||
|
||||
|
||||
-- Constants ---------------------------------------------------------------------------------------
|
||||
@@ -97,12 +99,12 @@ function private.assign_terrain_meta(region)
|
||||
local band_end = raw_index + C.TERRAIN_BLEND / 2
|
||||
|
||||
local max_weight = 0
|
||||
local blend = {}
|
||||
for terrain_type, terrain in ipairs(TERRAIN_TYPES) do
|
||||
local overlap_start = math.max(band_start, terrain.range_start)
|
||||
local overlap_end = math.min(band_end, terrain.range_end)
|
||||
local overlap = overlap_end - overlap_start
|
||||
|
||||
local blend = {}
|
||||
if overlap > 0 then
|
||||
local weight = overlap / C.TERRAIN_BLEND
|
||||
table.append(blend, { weight = weight, terrain_type = terrain_type })
|
||||
@@ -112,9 +114,9 @@ function private.assign_terrain_meta(region)
|
||||
region:set_meta(Region.META.TERRAIN_TYPE, x, z, terrain_type)
|
||||
end
|
||||
end
|
||||
|
||||
region:set_meta(Region.META.TERRAIN_BLEND, x, z, blend)
|
||||
end
|
||||
|
||||
region:set_meta(Region.META.TERRAIN_BLEND, x, z, blend)
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -154,12 +156,8 @@ end
|
||||
function private.fill_terrain(region)
|
||||
region:iterate_fill(function(x, y, z)
|
||||
local altitude = region:get_meta(Region.META.ALTITUDE, x, z)
|
||||
if type(altitude) ~= "number" then
|
||||
error(
|
||||
"expected altitude at ("..x..","..z..") to be a number, "..
|
||||
"but was a "..type(altitude)
|
||||
)
|
||||
end
|
||||
check.is_type("altitude", altitude, "number")
|
||||
|
||||
if y > altitude then return end
|
||||
region:set_content_id(x, y, z, STONE_ID)
|
||||
end)
|
||||
|
||||
@@ -26,6 +26,14 @@ core.register_node("jvmi_nodes:dirt", {
|
||||
tiles = {"jvmi_nodes_dirt.png"},
|
||||
})
|
||||
|
||||
core.register_node("jvmi_nodes:gravel", {
|
||||
description = S("Gravel"),
|
||||
drop = "jvmi_nodes:gravel",
|
||||
is_ground_content = true,
|
||||
sounds = { footstep = "jvmi_nodes_gravel_footstep" },
|
||||
tiles = {"jvmi_nodes_gravel.png"},
|
||||
})
|
||||
|
||||
core.register_node("jvmi_nodes:sand", {
|
||||
description = S("Sand"),
|
||||
drop = "jvmi_nodes:sand",
|
||||
|
||||
Reference in New Issue
Block a user