Add more things

This commit is contained in:
Signal 2025-09-17 01:12:02 -04:00
parent be2262fa17
commit d6662e8094
26 changed files with 565 additions and 26 deletions

View file

@ -14,7 +14,11 @@ end
local c_air = minetest.get_content_id("air")
local c_stone = minetest.get_content_id("stone")
local c_cobble = minetest.get_content_id("cobble")
local c_mossy_cobble = minetest.get_content_id("cobble_mossy")
local c_dirt = minetest.get_content_id("dirt")
local c_stony_dirt = minetest.get_content_id("dirt_stony")
local c_mossy_dirt = minetest.get_content_id("dirt_mossy")
local c_grass = minetest.get_content_id("dirt_grass")
local c_planks = minetest.get_content_id("outback_planks")
@ -32,6 +36,16 @@ local np_terrain = {
}
local n_terrain = {}
local np_surface = {
offset = 0,
scale = 1, -- Small height variation
spread = {x = 4, y = 4, z = 4},
seed = 87745,
octaves = 3 ,
persist = 0.6
}
local n_surface = {}
local np_trees = {
offset = 0,
scale = 1, -- Small height variation
@ -160,6 +174,7 @@ local function tree(min, max, x, y, z)
end
minetest.register_on_generated(function(vm, min, max)
-- Only run for blocks that are part of this realm.
if not intersection(min, max, REALM_START, REALM_END) then return end
@ -170,6 +185,9 @@ minetest.register_on_generated(function(vm, min, max)
local terrain = minetest.get_perlin_map(np_terrain, sides2d)
terrain:get_2d_map_flat({x = min.x, y = min.z}, n_terrain)
local surface = minetest.get_perlin_map(np_surface, sides2d)
surface:get_2d_map_flat({x = min.x, y = min.z}, n_surface)
local trees_map = minetest.get_perlin_map(np_trees, sides2d)
trees_map:get_2d_map_flat({x = min.x, y = min.z}, n_trees)
@ -188,7 +206,17 @@ minetest.register_on_generated(function(vm, min, max)
if y < height -1 then
vm_data[vi] = c_stone
elseif y < height then
vm_data[vi] = c_grass
if n_surface[ni] > 0.65 then
vm_data[vi] = c_mossy_cobble
elseif n_surface[ni] > 0.3 then
vm_data[vi] = c_cobble
elseif n_surface[ni] > -0.3 then
vm_data[vi] = c_stony_dirt
elseif n_surface[ni] < -0.8 then
vm_data[vi] = c_mossy_dirt
else
vm_data[vi] = c_dirt
end
elseif y < height +1 and math.random() > 0.98 then
trees[#trees +1] = vector.new(x, y, z)
else