2024-01-10 22:16:52 -06:00
|
|
|
--[[
|
|
|
|
Everness. Never ending discovery in Everness mapgen.
|
|
|
|
Copyright (C) 2024 SaKeL
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
--]]
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Register biomes
|
|
|
|
--
|
|
|
|
|
|
|
|
local y_max = Everness.settings.biomes.everness_mineral_waters.y_max
|
|
|
|
local y_min = Everness.settings.biomes.everness_mineral_waters.y_min
|
|
|
|
|
|
|
|
-- Mineral Waters
|
|
|
|
|
|
|
|
minetest.register_biome({
|
|
|
|
name = 'everness_mineral_waters',
|
|
|
|
node_top = 'everness:mineral_sand',
|
|
|
|
depth_top = 1,
|
|
|
|
node_filler = 'everness:mineral_stone',
|
|
|
|
depth_filler = 1,
|
|
|
|
node_stone = 'everness:mineral_stone',
|
|
|
|
node_riverbed = 'everness:mineral_sand',
|
|
|
|
depth_riverbed = 2,
|
|
|
|
node_dungeon = 'everness:mineral_stone_brick',
|
|
|
|
node_dungeon_alt = 'everness:mineral_stone_brick_with_growth',
|
|
|
|
node_dungeon_stair = 'stairs:stair_bamboo_wood',
|
|
|
|
y_max = y_max,
|
|
|
|
y_min = y_min,
|
|
|
|
vertical_blend = 4,
|
|
|
|
heat_point = 78,
|
|
|
|
humidity_point = 58,
|
|
|
|
})
|
|
|
|
|
2024-01-11 14:11:24 -06:00
|
|
|
--
|
|
|
|
-- Register ores
|
|
|
|
--
|
|
|
|
|
|
|
|
-- Scatter ores
|
|
|
|
|
|
|
|
-- Coal
|
|
|
|
|
|
|
|
minetest.register_ore({
|
|
|
|
ore_type = 'scatter',
|
|
|
|
ore = 'everness:mineral_stone_with_coal',
|
|
|
|
wherein = 'everness:mineral_stone',
|
|
|
|
clust_scarcity = 8 * 8 * 8,
|
|
|
|
clust_num_ores = 9,
|
|
|
|
clust_size = 3,
|
|
|
|
y_max = y_max,
|
|
|
|
y_min = y_min,
|
|
|
|
biomes = { 'everness_mineral_waters' }
|
|
|
|
})
|
|
|
|
|
2024-01-10 22:16:52 -06:00
|
|
|
--
|
|
|
|
-- Register decorations
|
|
|
|
--
|
|
|
|
|
|
|
|
minetest.register_decoration({
|
|
|
|
name = 'everness:palm_tree_1',
|
|
|
|
deco_type = 'schematic',
|
|
|
|
place_on = { 'everness:mineral_sand' },
|
|
|
|
sidelen = 16,
|
|
|
|
noise_params = {
|
|
|
|
offset = 0,
|
|
|
|
scale = 0.02,
|
|
|
|
spread = { x = 200, y = 200, z = 200 },
|
|
|
|
seed = 329,
|
|
|
|
octaves = 3,
|
|
|
|
persist = 0.6
|
|
|
|
},
|
|
|
|
biomes = { 'everness_mineral_waters' },
|
|
|
|
y_max = y_max,
|
|
|
|
y_min = y_min,
|
|
|
|
schematic = minetest.get_modpath('everness') .. '/schematics/everness_palm_tree.mts',
|
|
|
|
flags = 'place_center_x, place_center_z',
|
|
|
|
spawn_by = {
|
|
|
|
'everness:mineral_water_source',
|
|
|
|
'everness:mineral_stone_brick',
|
|
|
|
'everness:mineral_stone_brick_with_growth',
|
|
|
|
'everness:mineral_stone_brick_with_flower_growth',
|
|
|
|
'everness:mineral_sandstone',
|
|
|
|
'everness:mineral_sandstone_block'
|
|
|
|
},
|
|
|
|
num_spawn_by = 1,
|
|
|
|
check_offset = -1,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_decoration({
|
|
|
|
name = 'everness:palm_tree_2',
|
|
|
|
deco_type = 'schematic',
|
|
|
|
place_on = { 'everness:mineral_sand' },
|
|
|
|
sidelen = 16,
|
|
|
|
noise_params = {
|
|
|
|
offset = 0,
|
|
|
|
scale = 0.02,
|
|
|
|
spread = { x = 200, y = 200, z = 200 },
|
|
|
|
seed = 329,
|
|
|
|
octaves = 3,
|
|
|
|
persist = 0.6
|
|
|
|
},
|
|
|
|
biomes = { 'everness_mineral_waters' },
|
|
|
|
y_max = y_max,
|
|
|
|
y_min = y_min,
|
|
|
|
schematic = minetest.get_modpath('everness') .. '/schematics/everness_palm_tree.mts',
|
|
|
|
flags = 'place_center_x, place_center_z',
|
|
|
|
spawn_by = {
|
|
|
|
'everness:mineral_water_source',
|
|
|
|
'everness:mineral_stone_brick',
|
|
|
|
'everness:mineral_stone_brick_with_growth',
|
|
|
|
'everness:mineral_stone_brick_with_flower_growth',
|
|
|
|
'everness:mineral_sandstone',
|
|
|
|
'everness:mineral_sandstone_block'
|
|
|
|
},
|
|
|
|
num_spawn_by = 1,
|
|
|
|
check_offset = 1,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_decoration({
|
|
|
|
name = 'everness:water_geyser',
|
|
|
|
deco_type = 'simple',
|
|
|
|
place_on = { 'everness:mineral_sand' },
|
|
|
|
sidelen = 16,
|
|
|
|
noise_params = {
|
2024-01-11 14:11:24 -06:00
|
|
|
offset = -0.004,
|
2024-01-10 22:16:52 -06:00
|
|
|
scale = 0.02,
|
2024-01-11 14:11:24 -06:00
|
|
|
spread = { x = 100, y = 100, z = 100 },
|
|
|
|
seed = 137,
|
2024-01-10 22:16:52 -06:00
|
|
|
octaves = 3,
|
2024-01-11 14:11:24 -06:00
|
|
|
persist = 0.7,
|
2024-01-10 22:16:52 -06:00
|
|
|
},
|
|
|
|
biomes = { 'everness_mineral_waters' },
|
|
|
|
y_max = y_max,
|
|
|
|
y_min = y_min,
|
|
|
|
decoration = { 'everness:water_geyser' },
|
|
|
|
spawn_by = {
|
|
|
|
'everness:mineral_water_source',
|
|
|
|
'everness:mineral_stone_brick',
|
|
|
|
'everness:mineral_stone_brick_with_growth',
|
|
|
|
'everness:mineral_stone_brick_with_flower_growth',
|
|
|
|
'everness:mineral_sandstone',
|
|
|
|
'everness:mineral_sandstone_block'
|
|
|
|
},
|
|
|
|
num_spawn_by = 1,
|
|
|
|
check_offset = -1,
|
|
|
|
})
|
|
|
|
|
|
|
|
--
|
|
|
|
-- On Generated
|
|
|
|
--
|
|
|
|
|
|
|
|
-- Get the content IDs for the nodes used
|
|
|
|
local c_everness_mineral_water_source = minetest.get_content_id('everness:mineral_water_source')
|
|
|
|
local c_everness_mineral_stone = minetest.get_content_id('everness:mineral_stone')
|
|
|
|
local c_everness_mineral_stone_brick = minetest.get_content_id('everness:mineral_stone_brick')
|
|
|
|
local c_everness_mineral_stone_brick_with_growth = minetest.get_content_id('everness:mineral_stone_brick_with_growth')
|
|
|
|
local c_everness_mineral_stone_brick_with_flower_growth = minetest.get_content_id('everness:mineral_stone_brick_with_flower_growth')
|
|
|
|
local c_everness_mineral_sand = minetest.get_content_id('everness:mineral_sand')
|
|
|
|
local c_everness_mineral_sandstone = minetest.get_content_id('everness:mineral_sandstone')
|
|
|
|
local c_everness_mineral_sandstone_block = minetest.get_content_id('everness:mineral_sandstone_block')
|
|
|
|
local c_everness_mineral_waters_marker = minetest.get_content_id('everness:mineral_waters_marker')
|
2024-01-11 14:11:24 -06:00
|
|
|
local c_everness_mineral_stone_with_coal = minetest.get_content_id('everness:mineral_stone_with_coal')
|
|
|
|
|
|
|
|
local biome_id_everness_mineral_waters = minetest.get_biome_id('everness_mineral_waters')
|
2024-01-10 22:16:52 -06:00
|
|
|
|
|
|
|
local pool_build_nodes = {
|
|
|
|
{
|
|
|
|
c_everness_mineral_stone,
|
|
|
|
c_everness_mineral_stone_brick,
|
|
|
|
c_everness_mineral_stone_brick_with_growth,
|
|
|
|
c_everness_mineral_stone_brick_with_flower_growth
|
|
|
|
},
|
|
|
|
{
|
|
|
|
c_everness_mineral_sandstone,
|
|
|
|
c_everness_mineral_sandstone_block
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
local function find_irecursive(table, c_id)
|
|
|
|
local found = false
|
|
|
|
|
|
|
|
for i, v in ipairs(table) do
|
|
|
|
if type(v) == 'table' then
|
|
|
|
find_irecursive(v, c_id)
|
|
|
|
end
|
|
|
|
|
|
|
|
if c_id == v then
|
|
|
|
found = true
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
return found
|
|
|
|
end
|
|
|
|
|
2024-01-11 14:11:24 -06:00
|
|
|
-- Localize data buffer table outside the loop, to be re-used for all
|
|
|
|
-- mapchunks, therefore minimising memory use
|
|
|
|
local data = {}
|
|
|
|
|
2024-01-10 22:16:52 -06:00
|
|
|
-- Called after generating a piece of world. Modifying nodes inside the area is a bit faster than usual.
|
|
|
|
minetest.register_on_generated(function(minp, maxp, blockseed)
|
|
|
|
-- Start time of mapchunk generation.
|
|
|
|
-- local t0 = os.clock()
|
|
|
|
local rand = PcgRandom(blockseed)
|
|
|
|
-- Load the voxelmanip with the result of engine mapgen
|
|
|
|
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
|
2024-01-11 14:11:24 -06:00
|
|
|
-- Returns an array containing the biome IDs of nodes in the most recently generated chunk by the current mapgen
|
|
|
|
local biomemap = minetest.get_mapgen_object('biomemap')
|
2024-01-10 22:16:52 -06:00
|
|
|
-- 'area' is used later to get the voxelmanip indexes for positions
|
|
|
|
local area = VoxelArea:new({ MinEdge = emin, MaxEdge = emax })
|
|
|
|
-- Get the content ID data from the voxelmanip in the form of a flat array.
|
|
|
|
-- Set the buffer parameter to use and reuse 'data' for this.
|
|
|
|
vm:get_data(data)
|
|
|
|
|
2024-01-11 14:11:24 -06:00
|
|
|
if maxp.y >= y_min then
|
2024-01-10 22:16:52 -06:00
|
|
|
-- Above sea level
|
|
|
|
local rand_version = rand:next(1, 2)
|
|
|
|
|
|
|
|
if rand_version == 1 then
|
2024-01-11 14:11:24 -06:00
|
|
|
--
|
|
|
|
-- Pools
|
|
|
|
--
|
2024-01-10 22:16:52 -06:00
|
|
|
for y = minp.y, maxp.y do
|
|
|
|
for z = minp.z, maxp.z do
|
2024-01-11 14:11:24 -06:00
|
|
|
local precision_perc = 75
|
|
|
|
|
2024-01-10 22:16:52 -06:00
|
|
|
for x = minp.x, maxp.x do
|
|
|
|
local ai = area:index(x, y, z)
|
|
|
|
local node_name = minetest.get_name_from_content_id(data[ai])
|
|
|
|
local node_def = minetest.registered_nodes[node_name]
|
|
|
|
|
|
|
|
if
|
|
|
|
data[ai + area.ystride] == minetest.CONTENT_AIR
|
|
|
|
and node_def
|
|
|
|
and node_def.walkable
|
2024-01-11 14:11:24 -06:00
|
|
|
and table.indexof(biomemap, biome_id_everness_mineral_waters) ~= -1
|
2024-01-10 22:16:52 -06:00
|
|
|
then
|
|
|
|
local length = 5 + rand:next(0, 10)
|
|
|
|
local width = 5 + rand:next(0, 10)
|
|
|
|
local height = 3 + rand:next(0, 4)
|
2024-01-11 14:11:24 -06:00
|
|
|
local walkable_nodes = 0
|
2024-01-10 22:16:52 -06:00
|
|
|
|
|
|
|
-- find space for lake (walkable rectangle)
|
2024-01-11 14:11:24 -06:00
|
|
|
for li = 1, length do
|
|
|
|
for wi = 1, width do
|
|
|
|
local ai_rec = (ai + li) + (area.zstride * wi)
|
|
|
|
local n_name = minetest.get_name_from_content_id(data[ai_rec])
|
|
|
|
local n_def = minetest.registered_nodes[n_name]
|
|
|
|
local b_data = minetest.get_biome_data(area:position(ai_rec))
|
|
|
|
|
|
|
|
if not b_data then
|
|
|
|
return
|
|
|
|
end
|
2024-01-10 22:16:52 -06:00
|
|
|
|
2024-01-11 14:11:24 -06:00
|
|
|
local b_name = minetest.get_biome_name(b_data.biome)
|
2024-01-10 22:16:52 -06:00
|
|
|
|
2024-01-11 14:11:24 -06:00
|
|
|
if not b_name then
|
|
|
|
return
|
|
|
|
end
|
2024-01-10 22:16:52 -06:00
|
|
|
|
2024-01-11 14:11:24 -06:00
|
|
|
if b_name ~= 'everness_mineral_waters'
|
|
|
|
-- for mese trees, they dont have specific biome
|
|
|
|
or minetest.get_item_group(n_name, 'tree') > 0
|
|
|
|
or minetest.get_item_group(n_name, 'leaves') > 0
|
|
|
|
then
|
|
|
|
-- bordering with anohter biome, be more precise in placing
|
|
|
|
precision_perc = 100
|
|
|
|
end
|
2024-01-10 22:16:52 -06:00
|
|
|
|
2024-01-11 14:11:24 -06:00
|
|
|
if n_def
|
|
|
|
and n_def.walkable
|
|
|
|
and data[ai_rec + area.ystride] == minetest.CONTENT_AIR
|
|
|
|
then
|
|
|
|
walkable_nodes = walkable_nodes + 1
|
2024-01-10 22:16:52 -06:00
|
|
|
end
|
|
|
|
end
|
2024-01-11 14:11:24 -06:00
|
|
|
end
|
2024-01-10 22:16:52 -06:00
|
|
|
|
|
|
|
-- build pool (cuboid)
|
|
|
|
local pool_build_nodes_group = pool_build_nodes[rand:next(1, #pool_build_nodes)]
|
|
|
|
|
2024-01-11 14:11:24 -06:00
|
|
|
if walkable_nodes >= (width * length / 100) * precision_perc then
|
|
|
|
-- offset y so the pools are sticking out / sinking in from the ground vertically
|
|
|
|
local ai_offset_y = ai - (area.ystride * height) + (area.ystride * rand:next(0, math.ceil(height / 2)))
|
2024-01-10 22:16:52 -06:00
|
|
|
|
|
|
|
for hi = 1, height do
|
|
|
|
for li = 1, length do
|
|
|
|
for wi = 1, width do
|
|
|
|
local mineral_stone = pool_build_nodes_group[rand:next(1, #pool_build_nodes_group)]
|
2024-01-11 14:11:24 -06:00
|
|
|
local ai_cub = (ai_offset_y + li) + (area.ystride * hi) + (area.zstride * wi)
|
|
|
|
local current_c_id = data[ai_cub]
|
2024-01-10 22:16:52 -06:00
|
|
|
|
|
|
|
-- Check for water and build nodes before replacing, this will make pools connected and will not replace already built walls from another pool near by
|
|
|
|
if hi == 1
|
|
|
|
and current_c_id ~= c_everness_mineral_water_source
|
|
|
|
and not find_irecursive(pool_build_nodes, current_c_id)
|
|
|
|
then
|
|
|
|
-- build pool floor
|
2024-01-11 14:11:24 -06:00
|
|
|
data[ai_cub] = mineral_stone
|
2024-01-10 22:16:52 -06:00
|
|
|
elseif hi ~= 1
|
|
|
|
and (wi == 1 or wi == width)
|
|
|
|
and current_c_id ~= c_everness_mineral_water_source
|
|
|
|
and not find_irecursive(pool_build_nodes, current_c_id)
|
|
|
|
then
|
|
|
|
-- build pool wall
|
2024-01-11 14:11:24 -06:00
|
|
|
data[ai_cub] = mineral_stone
|
2024-01-10 22:16:52 -06:00
|
|
|
elseif hi ~= 1
|
|
|
|
and (li == 1 or li == length)
|
|
|
|
and (wi ~= 1 or wi ~= width)
|
|
|
|
and current_c_id ~= c_everness_mineral_water_source
|
|
|
|
and not find_irecursive(pool_build_nodes, current_c_id)
|
|
|
|
then
|
|
|
|
-- build pool wall
|
2024-01-11 14:11:24 -06:00
|
|
|
data[ai_cub] = mineral_stone
|
2024-01-10 22:16:52 -06:00
|
|
|
else
|
|
|
|
-- fill in the pool with water
|
2024-01-11 14:11:24 -06:00
|
|
|
data[ai_cub] = c_everness_mineral_water_source
|
2024-01-10 22:16:52 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
-- place loot chest marker in the middle of the pool floor
|
|
|
|
if hi == 2
|
|
|
|
and height > 4
|
|
|
|
and math.ceil(length / 2) == li
|
|
|
|
and math.ceil(width / 2) == wi
|
2024-01-11 14:11:24 -06:00
|
|
|
and data[ai_cub - area.ystride] ~= c_everness_mineral_water_source
|
2024-01-10 22:16:52 -06:00
|
|
|
and rand:next(0, 100) < 3
|
|
|
|
then
|
2024-01-11 14:11:24 -06:00
|
|
|
data[ai_cub] = c_everness_mineral_waters_marker
|
2024-01-10 22:16:52 -06:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
elseif rand_version == 2 then
|
2024-01-11 14:11:24 -06:00
|
|
|
--
|
|
|
|
-- Lakes
|
|
|
|
--
|
2024-01-10 22:16:52 -06:00
|
|
|
for z = minp.z, maxp.z do
|
|
|
|
for y = minp.y, maxp.y do
|
|
|
|
for x = minp.x, maxp.x do
|
|
|
|
local ai = area:index(x, y, z)
|
|
|
|
local c_current = data[ai]
|
|
|
|
|
|
|
|
-- +Y, -Y, +X, -X, +Z, -Z
|
|
|
|
-- top, bottom, right, left, front, back
|
|
|
|
-- right
|
|
|
|
local c_right = data[ai + 1]
|
|
|
|
-- left
|
|
|
|
local c_left = data[ai - 1]
|
|
|
|
-- front
|
|
|
|
local c_front = data[ai + (area.zstride * 2)]
|
|
|
|
-- back
|
|
|
|
local c_back = data[ai - (area.zstride * 2)]
|
|
|
|
|
|
|
|
local keep_going = true
|
|
|
|
local while_count = 1
|
|
|
|
local max_dig_depth = 11
|
|
|
|
|
|
|
|
if
|
|
|
|
c_current == c_everness_mineral_sand
|
|
|
|
and (
|
|
|
|
c_right == c_everness_mineral_sand
|
|
|
|
or c_right == c_everness_mineral_water_source
|
|
|
|
or c_right == c_everness_mineral_stone
|
2024-01-11 14:11:24 -06:00
|
|
|
or c_right == c_everness_mineral_stone_with_coal
|
2024-01-10 22:16:52 -06:00
|
|
|
)
|
|
|
|
and (
|
|
|
|
c_left == c_everness_mineral_sand
|
|
|
|
or c_left == c_everness_mineral_water_source
|
|
|
|
or c_left == c_everness_mineral_stone
|
2024-01-11 14:11:24 -06:00
|
|
|
or c_left == c_everness_mineral_stone_with_coal
|
2024-01-10 22:16:52 -06:00
|
|
|
)
|
|
|
|
and (
|
|
|
|
c_front == c_everness_mineral_sand
|
|
|
|
or c_front == c_everness_mineral_water_source
|
|
|
|
or c_front == c_everness_mineral_stone
|
2024-01-11 14:11:24 -06:00
|
|
|
or c_front == c_everness_mineral_stone_with_coal
|
2024-01-10 22:16:52 -06:00
|
|
|
)
|
|
|
|
and (
|
|
|
|
c_back == c_everness_mineral_sand
|
|
|
|
or c_back == c_everness_mineral_water_source
|
|
|
|
or c_back == c_everness_mineral_stone
|
2024-01-11 14:11:24 -06:00
|
|
|
or c_back == c_everness_mineral_stone_with_coal
|
2024-01-10 22:16:52 -06:00
|
|
|
)
|
|
|
|
then
|
|
|
|
-- dig below
|
2024-01-11 14:11:24 -06:00
|
|
|
while keep_going and while_count <= max_dig_depth do
|
2024-01-10 22:16:52 -06:00
|
|
|
local while_index = ai - area.ystride * while_count
|
|
|
|
|
|
|
|
if
|
|
|
|
-- below
|
2024-01-11 14:11:24 -06:00
|
|
|
(
|
|
|
|
data[while_index] == c_everness_mineral_stone
|
|
|
|
or data[while_index] == c_everness_mineral_stone_with_coal
|
|
|
|
)
|
2024-01-10 22:16:52 -06:00
|
|
|
and (
|
|
|
|
-- right
|
|
|
|
data[while_index + 1 + area.ystride] == c_everness_mineral_sand
|
|
|
|
or data[while_index + 1 + area.ystride] == c_everness_mineral_water_source
|
|
|
|
or data[while_index + 1 + area.ystride] == c_everness_mineral_stone
|
2024-01-11 14:11:24 -06:00
|
|
|
or data[while_index + 1 + area.ystride] == c_everness_mineral_stone_with_coal
|
2024-01-10 22:16:52 -06:00
|
|
|
)
|
|
|
|
and (
|
|
|
|
-- left
|
|
|
|
data[while_index - 1 + area.ystride] == c_everness_mineral_sand
|
|
|
|
or data[while_index - 1 + area.ystride] == c_everness_mineral_water_source
|
|
|
|
or data[while_index - 1 + area.ystride] == c_everness_mineral_stone
|
2024-01-11 14:11:24 -06:00
|
|
|
or data[while_index - 1 + area.ystride] == c_everness_mineral_stone_with_coal
|
2024-01-10 22:16:52 -06:00
|
|
|
)
|
|
|
|
and (
|
|
|
|
-- front
|
|
|
|
data[while_index + area.zstride + area.ystride] == c_everness_mineral_sand
|
|
|
|
or data[while_index + area.zstride + area.ystride] == c_everness_mineral_water_source
|
|
|
|
or data[while_index + area.zstride + area.ystride] == c_everness_mineral_stone
|
2024-01-11 14:11:24 -06:00
|
|
|
or data[while_index + area.zstride + area.ystride] == c_everness_mineral_stone_with_coal
|
2024-01-10 22:16:52 -06:00
|
|
|
)
|
|
|
|
and (
|
|
|
|
-- back
|
|
|
|
data[while_index - area.zstride + area.ystride] == c_everness_mineral_sand
|
|
|
|
or data[while_index - area.zstride + area.ystride] == c_everness_mineral_water_source
|
|
|
|
or data[while_index - area.zstride + area.ystride] == c_everness_mineral_stone
|
2024-01-11 14:11:24 -06:00
|
|
|
or data[while_index - area.zstride + area.ystride] == c_everness_mineral_stone_with_coal
|
2024-01-10 22:16:52 -06:00
|
|
|
)
|
|
|
|
then
|
|
|
|
data[while_index + area.ystride] = c_everness_mineral_water_source
|
|
|
|
else
|
|
|
|
keep_going = false
|
|
|
|
end
|
|
|
|
|
|
|
|
while_count = while_count + 1
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
vm:set_data(data)
|
|
|
|
-- Generate all registered decorations within the VoxelManip `vm` and in the area from `pos1` to `pos2`
|
|
|
|
minetest.generate_decorations(vm)
|
2024-01-11 14:11:24 -06:00
|
|
|
-- Set the lighting within the `VoxelManip` to a uniform value
|
|
|
|
vm:set_lighting({ day = 0, night = 0 })
|
2024-01-10 22:16:52 -06:00
|
|
|
-- Calculate lighting for what has been created.
|
|
|
|
vm:calc_lighting()
|
|
|
|
-- Liquid nodes were placed so set them flowing.
|
|
|
|
vm:update_liquids()
|
|
|
|
-- Write what has been created to the world.
|
|
|
|
vm:write_to_map()
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Print generation time of this mapchunk.
|
|
|
|
-- local chugent = math.ceil((os.clock() - t0) * 1000)
|
|
|
|
-- print('[lvm_example] Mapchunk generation time ' .. chugent .. ' ms')
|
|
|
|
end)
|