Move the rest
This commit is contained in:
parent
b18e746ead
commit
70a9617c8e
File diff suppressed because it is too large
Load Diff
|
@ -321,39 +321,38 @@ local c_everness_coral_forest_deep_ocean_coral_4 = minetest.get_content_id('ever
|
||||||
-- Biome IDs
|
-- Biome IDs
|
||||||
local biome_id_everness_coral_forest_deep_ocean = minetest.get_biome_id('everness:coral_forest_deep_ocean')
|
local biome_id_everness_coral_forest_deep_ocean = minetest.get_biome_id('everness:coral_forest_deep_ocean')
|
||||||
|
|
||||||
-- Localize data buffer table outside the loop, to be re-used for all
|
local chance = 30
|
||||||
-- mapchunks, therefore minimising memory use.
|
|
||||||
local data = {}
|
|
||||||
local chance = 25
|
|
||||||
local schem = minetest.get_modpath('everness') .. '/schematics/everness_coral_forest_deep_ocean_house.mts'
|
local schem = minetest.get_modpath('everness') .. '/schematics/everness_coral_forest_deep_ocean_house.mts'
|
||||||
local size = { x = 11, y = 17, z = 12 }
|
local size = { x = 11, y = 17, z = 12 }
|
||||||
local size_x = math.round(size.x / 2)
|
local size_x = math.round(size.x / 2)
|
||||||
local size_z = math.round(size.z / 2)
|
local size_z = math.round(size.z / 2)
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
Everness:add_to_queue_on_generated({
|
||||||
local rand = PcgRandom(blockseed)
|
name = 'everness:coral_forest_deep_ocean',
|
||||||
local biomemap = minetest.get_mapgen_object('biomemap')
|
can_run = function(biomemap)
|
||||||
local schem_positions = {}
|
return table.indexof(biomemap, biome_id_everness_coral_forest_deep_ocean) ~= -1
|
||||||
|
end,
|
||||||
|
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
|
||||||
|
shared_args.schem_positions = {}
|
||||||
local schem_placed = false
|
local schem_placed = false
|
||||||
|
|
||||||
if table.indexof(biomemap, biome_id_everness_coral_forest_deep_ocean) ~= -1 and rand:next(0, 100) < chance then
|
if rand:next(0, 100) < chance then
|
||||||
-- Load the voxelmanip with the result of engine mapgen
|
|
||||||
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
|
|
||||||
-- '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)
|
|
||||||
|
|
||||||
for y = maxp.y, minp.y, -1 do
|
for y = maxp.y, minp.y, -1 do
|
||||||
|
if schem_placed then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
for z = minp.z, maxp.z do
|
for z = minp.z, maxp.z do
|
||||||
|
if schem_placed then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
for x = minp.x, maxp.x do
|
for x = minp.x, maxp.x do
|
||||||
local vi = area:index(x, y, z)
|
local vi = area:index(x, y, z)
|
||||||
|
|
||||||
if
|
if
|
||||||
data[vi] == c_everness_coral_forest_deep_ocean_sand
|
data[vi] == c_everness_coral_forest_deep_ocean_sand
|
||||||
and data[vi + area.ystride] == c_water_source
|
and data[vi + area.ystride] == c_water_source
|
||||||
and not schem_placed
|
|
||||||
then
|
then
|
||||||
local s_pos = area:position(vi)
|
local s_pos = area:position(vi)
|
||||||
|
|
||||||
|
@ -410,32 +409,27 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
|
|
||||||
schem_placed = true
|
schem_placed = true
|
||||||
|
|
||||||
schem_positions.everness_coral_forest_deep_ocean_house = schem_positions.everness_coral_forest_deep_ocean_house or {}
|
shared_args.schem_positions.everness_coral_forest_deep_ocean_house = shared_args.schem_positions.everness_coral_forest_deep_ocean_house or {}
|
||||||
|
|
||||||
table.insert(schem_positions.everness_coral_forest_deep_ocean_house, {
|
table.insert(shared_args.schem_positions.everness_coral_forest_deep_ocean_house, {
|
||||||
pos = schem_pos,
|
pos = schem_pos,
|
||||||
minp = vector.new(s_pos.x - size_x, s_pos.y, s_pos.z - size_z),
|
minp = vector.new(s_pos.x - size_x, s_pos.y, s_pos.z - size_z),
|
||||||
maxp = vector.new(s_pos.x + size_x, s_pos.y + size.y, s_pos.z + size_z)
|
maxp = vector.new(s_pos.x + size_x, s_pos.y + size.y, s_pos.z + size_z)
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.log('action', '[Everness] Coral Forest Deep Ocean House was placed at ' .. schem_pos:to_string())
|
minetest.log('action', '[Everness] Coral Forest Deep Ocean House was placed at ' .. schem_pos:to_string())
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Set the lighting within the `VoxelManip` to a uniform value
|
break
|
||||||
vm:set_lighting({ day = 0, night = 0 }, minp, maxp)
|
end
|
||||||
-- Calculate lighting for what has been created.
|
end
|
||||||
vm:calc_lighting()
|
end
|
||||||
-- Liquid nodes were placed so set them flowing.
|
end
|
||||||
vm:update_liquids()
|
end
|
||||||
-- Write what has been created to the world.
|
end
|
||||||
vm:write_to_map()
|
end,
|
||||||
minetest.fix_light(minp, maxp)
|
after_write_to_map = function(shared_args)
|
||||||
|
local schem_positions = shared_args.schem_positions or {}
|
||||||
|
|
||||||
-- Populate loot chests
|
|
||||||
for name, tbl in pairs(schem_positions) do
|
for name, tbl in pairs(schem_positions) do
|
||||||
if next(tbl) then
|
if next(tbl) then
|
||||||
for i, v in ipairs(tbl) do
|
for i, v in ipairs(tbl) do
|
||||||
|
@ -452,4 +446,4 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
})
|
||||||
|
|
|
@ -184,7 +184,7 @@ Everness:register_decoration({
|
||||||
--
|
--
|
||||||
|
|
||||||
local disp = 16
|
local disp = 16
|
||||||
local chance = 10
|
local chance = 5
|
||||||
local water_level = tonumber(minetest.settings:get('water_level')) or 1
|
local water_level = tonumber(minetest.settings:get('water_level')) or 1
|
||||||
local schem = minetest.get_modpath('everness') .. '/schematics/everness_coral_forest_ocean_fishing_dock.mts'
|
local schem = minetest.get_modpath('everness') .. '/schematics/everness_coral_forest_ocean_fishing_dock.mts'
|
||||||
local size = { x = 26, y = 10, z = 23 }
|
local size = { x = 26, y = 10, z = 23 }
|
||||||
|
@ -207,12 +207,12 @@ Everness:add_to_queue_on_generated({
|
||||||
local z_disp = rand:next(0, disp)
|
local z_disp = rand:next(0, disp)
|
||||||
shared_args.schem_positions = {}
|
shared_args.schem_positions = {}
|
||||||
|
|
||||||
|
if rand:next(0, 100) < chance then
|
||||||
for y = minp.y, maxp.y do
|
for y = minp.y, maxp.y do
|
||||||
local vi = area:index(minp.x + sidelength / 2 + x_disp, y, minp.z + sidelength / 2 + z_disp)
|
local vi = area:index(minp.x + sidelength / 2 + x_disp, y, minp.z + sidelength / 2 + z_disp)
|
||||||
|
|
||||||
if data[vi + area.ystride] == minetest.CONTENT_AIR
|
if data[vi + area.ystride] == minetest.CONTENT_AIR
|
||||||
and data[vi] == c_water_source
|
and data[vi] == c_water_source
|
||||||
and rand:next(0, 100) < chance
|
|
||||||
-- Water Level
|
-- Water Level
|
||||||
and water_level >= minp.y
|
and water_level >= minp.y
|
||||||
and water_level <= maxp.y
|
and water_level <= maxp.y
|
||||||
|
@ -274,6 +274,9 @@ Everness:add_to_queue_on_generated({
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.log('action', '[Everness] Coral Forest Ocean Fishing Dock was placed at ' .. schem_pos:to_string())
|
minetest.log('action', '[Everness] Coral Forest Ocean Fishing Dock was placed at ' .. schem_pos:to_string())
|
||||||
|
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -165,7 +165,7 @@ Everness:register_decoration({
|
||||||
--
|
--
|
||||||
|
|
||||||
local disp = 16
|
local disp = 16
|
||||||
local chance = 10
|
local chance = 5
|
||||||
local water_level = tonumber(minetest.settings:get('water_level')) or 1
|
local water_level = tonumber(minetest.settings:get('water_level')) or 1
|
||||||
local schem = minetest.get_modpath('everness') .. '/schematics/everness_coral_forest_ocean_fishing_dock.mts'
|
local schem = minetest.get_modpath('everness') .. '/schematics/everness_coral_forest_ocean_fishing_dock.mts'
|
||||||
local size = { x = 26, y = 10, z = 23 }
|
local size = { x = 26, y = 10, z = 23 }
|
||||||
|
@ -188,12 +188,12 @@ Everness:add_to_queue_on_generated({
|
||||||
local z_disp = rand:next(0, disp)
|
local z_disp = rand:next(0, disp)
|
||||||
shared_args.schem_positions = {}
|
shared_args.schem_positions = {}
|
||||||
|
|
||||||
|
if rand:next(0, 100) < chance then
|
||||||
for y = minp.y, maxp.y do
|
for y = minp.y, maxp.y do
|
||||||
local vi = area:index(minp.x + sidelength / 2 + x_disp, y, minp.z + sidelength / 2 + z_disp)
|
local vi = area:index(minp.x + sidelength / 2 + x_disp, y, minp.z + sidelength / 2 + z_disp)
|
||||||
|
|
||||||
if data[vi + area.ystride] == minetest.CONTENT_AIR
|
if data[vi + area.ystride] == minetest.CONTENT_AIR
|
||||||
and data[vi] == c_water_source
|
and data[vi] == c_water_source
|
||||||
and rand:next(0, 100) < chance
|
|
||||||
-- Water Level
|
-- Water Level
|
||||||
and water_level >= minp.y
|
and water_level >= minp.y
|
||||||
and water_level <= maxp.y
|
and water_level <= maxp.y
|
||||||
|
@ -255,6 +255,9 @@ Everness:add_to_queue_on_generated({
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.log('action', '[Everness] Coral Forest Ocean Fishing Dock was placed at ' .. schem_pos:to_string())
|
minetest.log('action', '[Everness] Coral Forest Ocean Fishing Dock was placed at ' .. schem_pos:to_string())
|
||||||
|
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -213,6 +213,8 @@ Everness:register_decoration({
|
||||||
-- On Generated
|
-- On Generated
|
||||||
--
|
--
|
||||||
|
|
||||||
|
local biome_id_everness_coral_forest_under = minetest.get_biome_id('everness:coral_forest_under')
|
||||||
|
|
||||||
local deco_id_coral_forest_under_coral_tree_bioluminescent = minetest.get_decoration_id('everness:coral_forest_under_coral_tree_bioluminescent')
|
local deco_id_coral_forest_under_coral_tree_bioluminescent = minetest.get_decoration_id('everness:coral_forest_under_coral_tree_bioluminescent')
|
||||||
|
|
||||||
local schem_bioluminescent_tree = minetest.get_modpath('everness') .. '/schematics/everness_coral_tree_bioluminescent.mts'
|
local schem_bioluminescent_tree = minetest.get_modpath('everness') .. '/schematics/everness_coral_tree_bioluminescent.mts'
|
||||||
|
@ -226,12 +228,12 @@ bioluminescent_tree_place_on = type(bioluminescent_tree_place_on) == 'string' an
|
||||||
|
|
||||||
minetest.set_gen_notify({ decoration = true }, { deco_id_coral_forest_under_coral_tree_bioluminescent })
|
minetest.set_gen_notify({ decoration = true }, { deco_id_coral_forest_under_coral_tree_bioluminescent })
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
Everness:add_to_queue_on_generated({
|
||||||
-- Load the voxelmanip with the result of engine mapgen
|
name = 'everness:coral_forest_under',
|
||||||
local vm = minetest.get_mapgen_object('voxelmanip')
|
can_run = function(biomemap)
|
||||||
-- Returns a table mapping requested generation notification types to arrays of positions at which the corresponding generated structures are located within the current chunk
|
return table.indexof(biomemap, biome_id_everness_coral_forest_under) ~= -1
|
||||||
local gennotify = minetest.get_mapgen_object('gennotify')
|
end,
|
||||||
|
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
|
||||||
--
|
--
|
||||||
-- Coral Tree Bioluminescent
|
-- Coral Tree Bioluminescent
|
||||||
--
|
--
|
||||||
|
@ -300,4 +302,5 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
-- minetest.log('action', '[Everness] Coral Tree Bioluminescent was placed at ' .. pos:to_string())
|
-- minetest.log('action', '[Everness] Coral Tree Bioluminescent was placed at ' .. pos:to_string())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end
|
||||||
|
})
|
||||||
|
|
|
@ -190,39 +190,38 @@ local c_everness_crystal_forest_deep_ocean_coral_3 = minetest.get_content_id('ev
|
||||||
-- Biome IDs
|
-- Biome IDs
|
||||||
local biome_id_everness_crystal_forest_deep_ocean = minetest.get_biome_id('everness:crystal_forest_deep_ocean')
|
local biome_id_everness_crystal_forest_deep_ocean = minetest.get_biome_id('everness:crystal_forest_deep_ocean')
|
||||||
|
|
||||||
-- Localize data buffer table outside the loop, to be re-used for all
|
local chance = 30
|
||||||
-- mapchunks, therefore minimising memory use.
|
|
||||||
local data = {}
|
|
||||||
local chance = 25
|
|
||||||
local schem = minetest.get_modpath('everness') .. '/schematics/everness_crystal_forest_deep_ocean_ruins.mts'
|
local schem = minetest.get_modpath('everness') .. '/schematics/everness_crystal_forest_deep_ocean_ruins.mts'
|
||||||
local size = { x = 14, y = 12, z = 9 }
|
local size = { x = 14, y = 12, z = 9 }
|
||||||
local size_x = math.round(size.x / 2)
|
local size_x = math.round(size.x / 2)
|
||||||
local size_z = math.round(size.z / 2)
|
local size_z = math.round(size.z / 2)
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
Everness:add_to_queue_on_generated({
|
||||||
local rand = PcgRandom(blockseed)
|
name = 'everness:crystal_forest_deep_ocean',
|
||||||
local biomemap = minetest.get_mapgen_object('biomemap')
|
can_run = function(biomemap)
|
||||||
local schem_positions = {}
|
return table.indexof(biomemap, biome_id_everness_crystal_forest_deep_ocean) ~= -1
|
||||||
|
end,
|
||||||
|
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
|
||||||
|
shared_args.schem_positions = {}
|
||||||
local schem_placed = false
|
local schem_placed = false
|
||||||
|
|
||||||
if table.indexof(biomemap, biome_id_everness_crystal_forest_deep_ocean) ~= -1 and rand:next(0, 100) < chance then
|
if rand:next(0, 100) < chance then
|
||||||
-- Load the voxelmanip with the result of engine mapgen
|
|
||||||
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
|
|
||||||
-- '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)
|
|
||||||
|
|
||||||
for y = maxp.y, minp.y, -1 do
|
for y = maxp.y, minp.y, -1 do
|
||||||
|
if schem_placed then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
for z = minp.z, maxp.z do
|
for z = minp.z, maxp.z do
|
||||||
|
if schem_placed then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
for x = minp.x, maxp.x do
|
for x = minp.x, maxp.x do
|
||||||
local vi = area:index(x, y, z)
|
local vi = area:index(x, y, z)
|
||||||
|
|
||||||
if
|
if
|
||||||
data[vi] == c_everness_crystal_forest_deep_ocean_sand
|
data[vi] == c_everness_crystal_forest_deep_ocean_sand
|
||||||
and data[vi + area.ystride] == c_water_source
|
and data[vi + area.ystride] == c_water_source
|
||||||
and not schem_placed
|
|
||||||
then
|
then
|
||||||
local s_pos = area:position(vi)
|
local s_pos = area:position(vi)
|
||||||
|
|
||||||
|
@ -278,32 +277,27 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
|
|
||||||
schem_placed = true
|
schem_placed = true
|
||||||
|
|
||||||
schem_positions.everness_crystal_forest_deep_ocean_ruins = schem_positions.everness_crystal_forest_deep_ocean_ruins or {}
|
shared_args.schem_positions.everness_crystal_forest_deep_ocean_ruins = shared_args.schem_positions.everness_crystal_forest_deep_ocean_ruins or {}
|
||||||
|
|
||||||
table.insert(schem_positions.everness_crystal_forest_deep_ocean_ruins, {
|
table.insert(shared_args.schem_positions.everness_crystal_forest_deep_ocean_ruins, {
|
||||||
pos = schem_pos,
|
pos = schem_pos,
|
||||||
minp = vector.new(s_pos.x - size_x, s_pos.y, s_pos.z - size_z),
|
minp = vector.new(s_pos.x - size_x, s_pos.y, s_pos.z - size_z),
|
||||||
maxp = vector.new(s_pos.x + size_x, s_pos.y + size.y, s_pos.z + size_z)
|
maxp = vector.new(s_pos.x + size_x, s_pos.y + size.y, s_pos.z + size_z)
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.log('action', '[Everness] Crystal Forest Deep Ocean Ruins was placed at ' .. schem_pos:to_string())
|
minetest.log('action', '[Everness] Crystal Forest Deep Ocean Ruins was placed at ' .. schem_pos:to_string())
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Set the lighting within the `VoxelManip` to a uniform value
|
break
|
||||||
vm:set_lighting({ day = 0, night = 0 }, minp, maxp)
|
end
|
||||||
-- Calculate lighting for what has been created.
|
end
|
||||||
vm:calc_lighting()
|
end
|
||||||
-- Liquid nodes were placed so set them flowing.
|
end
|
||||||
vm:update_liquids()
|
end
|
||||||
-- Write what has been created to the world.
|
end
|
||||||
vm:write_to_map()
|
end,
|
||||||
minetest.fix_light(minp, maxp)
|
after_write_to_map = function(shared_args)
|
||||||
|
local schem_positions = shared_args.schem_positions or {}
|
||||||
|
|
||||||
-- Populate loot chests
|
|
||||||
for name, tbl in pairs(schem_positions) do
|
for name, tbl in pairs(schem_positions) do
|
||||||
if next(tbl) then
|
if next(tbl) then
|
||||||
for i, v in ipairs(tbl) do
|
for i, v in ipairs(tbl) do
|
||||||
|
@ -320,4 +314,4 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
})
|
||||||
|
|
|
@ -222,6 +222,8 @@ Everness:register_decoration({
|
||||||
-- On Generated
|
-- On Generated
|
||||||
--
|
--
|
||||||
|
|
||||||
|
local biome_id_everness_crystal_forest_under = minetest.get_biome_id('everness:crystal_forest_under')
|
||||||
|
|
||||||
local deco_id_crystal_forest_under_crystal_cluster = minetest.get_decoration_id('everness:crystal_forest_under_crystal_cluster')
|
local deco_id_crystal_forest_under_crystal_cluster = minetest.get_decoration_id('everness:crystal_forest_under_crystal_cluster')
|
||||||
local deco_id_crystal_forest_under_crystal_sphere_cluster = minetest.get_decoration_id('everness:crystal_forest_under_crystal_sphere_cluster')
|
local deco_id_crystal_forest_under_crystal_sphere_cluster = minetest.get_decoration_id('everness:crystal_forest_under_crystal_sphere_cluster')
|
||||||
|
|
||||||
|
@ -248,13 +250,12 @@ minetest.set_gen_notify({ decoration = true }, {
|
||||||
deco_id_crystal_forest_under_crystal_sphere_cluster
|
deco_id_crystal_forest_under_crystal_sphere_cluster
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
Everness:add_to_queue_on_generated({
|
||||||
local rand = PcgRandom(blockseed)
|
name = 'everness:crystal_forest_under',
|
||||||
-- Load the voxelmanip with the result of engine mapgen
|
can_run = function(biomemap)
|
||||||
local vm = minetest.get_mapgen_object('voxelmanip')
|
return table.indexof(biomemap, biome_id_everness_crystal_forest_under) ~= -1
|
||||||
-- Returns a table mapping requested generation notification types to arrays of positions at which the corresponding generated structures are located within the current chunk
|
end,
|
||||||
local gennotify = minetest.get_mapgen_object('gennotify')
|
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Crystal Cluster
|
-- Crystal Cluster
|
||||||
--
|
--
|
||||||
|
@ -418,4 +419,5 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
-- minetest.log('action', '[Everness] Crystal Sphere Cluster ' .. (rand_color or 'orange') .. ' was placed at ' .. pos:to_string())
|
-- minetest.log('action', '[Everness] Crystal Sphere Cluster ' .. (rand_color or 'orange') .. ' was placed at ' .. pos:to_string())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end
|
||||||
|
})
|
||||||
|
|
|
@ -190,39 +190,38 @@ local c_everness_cursed_lands_deep_ocean_coral_octocurse = minetest.get_content_
|
||||||
-- Biome IDs
|
-- Biome IDs
|
||||||
local biome_id_everness_cursed_lands_deep_ocean = minetest.get_biome_id('everness:cursed_lands_deep_ocean')
|
local biome_id_everness_cursed_lands_deep_ocean = minetest.get_biome_id('everness:cursed_lands_deep_ocean')
|
||||||
|
|
||||||
-- Localize data buffer table outside the loop, to be re-used for all
|
local chance = 30
|
||||||
-- mapchunks, therefore minimising memory use.
|
|
||||||
local data = {}
|
|
||||||
local chance = 20
|
|
||||||
local schem = minetest.get_modpath('everness') .. '/schematics/everness_cursed_lands_deep_ocean_skull.mts'
|
local schem = minetest.get_modpath('everness') .. '/schematics/everness_cursed_lands_deep_ocean_skull.mts'
|
||||||
local size = { x = 10, y = 11, z = 11 }
|
local size = { x = 10, y = 11, z = 11 }
|
||||||
local size_x = math.round(size.x / 2)
|
local size_x = math.round(size.x / 2)
|
||||||
local size_z = math.round(size.z / 2)
|
local size_z = math.round(size.z / 2)
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
Everness:add_to_queue_on_generated({
|
||||||
local rand = PcgRandom(blockseed)
|
name = 'everness:cursed_lands_deep_ocean',
|
||||||
local biomemap = minetest.get_mapgen_object('biomemap')
|
can_run = function(biomemap)
|
||||||
local schem_positions = {}
|
return table.indexof(biomemap, biome_id_everness_cursed_lands_deep_ocean) ~= -1
|
||||||
|
end,
|
||||||
|
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
|
||||||
|
shared_args.schem_positions = {}
|
||||||
local schem_placed = false
|
local schem_placed = false
|
||||||
|
|
||||||
if table.indexof(biomemap, biome_id_everness_cursed_lands_deep_ocean) ~= -1 and rand:next(0, 100) < chance then
|
if rand:next(0, 100) < chance then
|
||||||
-- Load the voxelmanip with the result of engine mapgen
|
|
||||||
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
|
|
||||||
-- '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)
|
|
||||||
|
|
||||||
for y = maxp.y, minp.y, -1 do
|
for y = maxp.y, minp.y, -1 do
|
||||||
|
if schem_placed then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
for z = minp.z, maxp.z do
|
for z = minp.z, maxp.z do
|
||||||
|
if schem_placed then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
for x = minp.x, maxp.x do
|
for x = minp.x, maxp.x do
|
||||||
local vi = area:index(x, y, z)
|
local vi = area:index(x, y, z)
|
||||||
|
|
||||||
if
|
if
|
||||||
data[vi] == c_everness_cursed_lands_deep_ocean_sand
|
data[vi] == c_everness_cursed_lands_deep_ocean_sand
|
||||||
and data[vi + area.ystride] == c_water_source
|
and data[vi + area.ystride] == c_water_source
|
||||||
and not schem_placed
|
|
||||||
then
|
then
|
||||||
local s_pos = area:position(vi)
|
local s_pos = area:position(vi)
|
||||||
|
|
||||||
|
@ -278,32 +277,27 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
|
|
||||||
schem_placed = true
|
schem_placed = true
|
||||||
|
|
||||||
schem_positions.everness_cursed_lands_deep_ocean_skull = schem_positions.everness_cursed_lands_deep_ocean_skull or {}
|
shared_args.schem_positions.everness_cursed_lands_deep_ocean_skull = shared_args.schem_positions.everness_cursed_lands_deep_ocean_skull or {}
|
||||||
|
|
||||||
table.insert(schem_positions.everness_cursed_lands_deep_ocean_skull, {
|
table.insert(shared_args.schem_positions.everness_cursed_lands_deep_ocean_skull, {
|
||||||
pos = schem_pos,
|
pos = schem_pos,
|
||||||
minp = vector.new(s_pos.x - size_x, s_pos.y, s_pos.z - size_z),
|
minp = vector.new(s_pos.x - size_x, s_pos.y, s_pos.z - size_z),
|
||||||
maxp = vector.new(s_pos.x + size_x, s_pos.y + size.y, s_pos.z + size_z)
|
maxp = vector.new(s_pos.x + size_x, s_pos.y + size.y, s_pos.z + size_z)
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.log('action', '[Everness] Cursed Lands Deep Ocean Skull was placed at ' .. schem_pos:to_string())
|
minetest.log('action', '[Everness] Cursed Lands Deep Ocean Skull was placed at ' .. schem_pos:to_string())
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Set the lighting within the `VoxelManip` to a uniform value
|
break
|
||||||
vm:set_lighting({ day = 0, night = 0 }, minp, maxp)
|
end
|
||||||
-- Calculate lighting for what has been created.
|
end
|
||||||
vm:calc_lighting()
|
end
|
||||||
-- Liquid nodes were placed so set them flowing.
|
end
|
||||||
vm:update_liquids()
|
end
|
||||||
-- Write what has been created to the world.
|
end
|
||||||
vm:write_to_map()
|
end,
|
||||||
minetest.fix_light(minp, maxp)
|
after_write_to_map = function(shared_args)
|
||||||
|
local schem_positions = shared_args.schem_positions or {}
|
||||||
|
|
||||||
-- Populate loot chests
|
|
||||||
for name, tbl in pairs(schem_positions) do
|
for name, tbl in pairs(schem_positions) do
|
||||||
if next(tbl) then
|
if next(tbl) then
|
||||||
for i, v in ipairs(tbl) do
|
for i, v in ipairs(tbl) do
|
||||||
|
@ -320,4 +314,4 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
})
|
||||||
|
|
|
@ -219,6 +219,8 @@ Everness:register_decoration({
|
||||||
-- On Generated
|
-- On Generated
|
||||||
--
|
--
|
||||||
|
|
||||||
|
local biome_id_everness_cursed_lands_under = minetest.get_biome_id('everness:cursed_lands_under')
|
||||||
|
|
||||||
local deco_id_cursed_lands_under_cursed_dream_tree = minetest.get_decoration_id('everness:cursed_lands_under_cursed_dream_tree')
|
local deco_id_cursed_lands_under_cursed_dream_tree = minetest.get_decoration_id('everness:cursed_lands_under_cursed_dream_tree')
|
||||||
|
|
||||||
local schem_cursed_dream_tree = minetest.get_modpath('everness') .. '/schematics/everness_cursed_dream_tree.mts'
|
local schem_cursed_dream_tree = minetest.get_modpath('everness') .. '/schematics/everness_cursed_dream_tree.mts'
|
||||||
|
@ -232,12 +234,12 @@ cursed_dream_tree_place_on = type(cursed_dream_tree_place_on) == 'string' and {
|
||||||
|
|
||||||
minetest.set_gen_notify({ decoration = true }, { deco_id_cursed_lands_under_cursed_dream_tree })
|
minetest.set_gen_notify({ decoration = true }, { deco_id_cursed_lands_under_cursed_dream_tree })
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
Everness:add_to_queue_on_generated({
|
||||||
-- Load the voxelmanip with the result of engine mapgen
|
name = 'everness:cursed_lands_under',
|
||||||
local vm = minetest.get_mapgen_object('voxelmanip')
|
can_run = function(biomemap)
|
||||||
-- Returns a table mapping requested generation notification types to arrays of positions at which the corresponding generated structures are located within the current chunk
|
return table.indexof(biomemap, biome_id_everness_cursed_lands_under) ~= -1
|
||||||
local gennotify = minetest.get_mapgen_object('gennotify')
|
end,
|
||||||
|
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
|
||||||
--
|
--
|
||||||
-- Cursed Dream Tree
|
-- Cursed Dream Tree
|
||||||
--
|
--
|
||||||
|
@ -306,4 +308,5 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
-- minetest.log('action', '[Everness] Cursed Dream Tree was placed at ' .. pos:to_string())
|
-- minetest.log('action', '[Everness] Cursed Dream Tree was placed at ' .. pos:to_string())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end
|
||||||
|
})
|
||||||
|
|
|
@ -155,6 +155,33 @@ Everness:register_decoration({
|
||||||
flags = 'all_floors'
|
flags = 'all_floors'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Everness:register_decoration({
|
||||||
|
name = 'everness:forsaken_tundra_under_willow_tree',
|
||||||
|
deco_type = 'simple',
|
||||||
|
place_on = {
|
||||||
|
'everness:mold_stone_with_moss',
|
||||||
|
'everness:blue_crying_obsidian',
|
||||||
|
'everness:blue_weeping_obsidian',
|
||||||
|
'everness:weeping_obsidian'
|
||||||
|
},
|
||||||
|
sidelen = 16,
|
||||||
|
noise_params = {
|
||||||
|
offset = 0,
|
||||||
|
scale = 0.002,
|
||||||
|
spread = { x = 250, y = 250, z = 250 },
|
||||||
|
seed = 2,
|
||||||
|
octaves = 3,
|
||||||
|
persist = 0.66
|
||||||
|
},
|
||||||
|
biomes = { 'everness:forsaken_tundra_under' },
|
||||||
|
y_max = y_max - 1500 > y_min and y_max - 1500 or y_max,
|
||||||
|
y_min = y_min,
|
||||||
|
flags = 'all_floors',
|
||||||
|
decoration = {
|
||||||
|
'everness:marker'
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
Everness:register_decoration({
|
Everness:register_decoration({
|
||||||
name = 'everness:forsaken_tundra_under_bloodspore_plant_small',
|
name = 'everness:forsaken_tundra_under_bloodspore_plant_small',
|
||||||
deco_type = 'simple',
|
deco_type = 'simple',
|
||||||
|
@ -250,84 +277,95 @@ register_agave_leaf_decoration(0, 0.06, 1)
|
||||||
-- On Generated
|
-- On Generated
|
||||||
--
|
--
|
||||||
|
|
||||||
local c_air = minetest.get_content_id('air')
|
local biome_id_everness_forsaken_tundra_under = minetest.get_biome_id('everness:forsaken_tundra_under')
|
||||||
local c_mold_stone_with_moss = minetest.get_content_id('everness:mold_stone_with_moss')
|
|
||||||
|
|
||||||
-- Localize data buffer table outside the loop, to be re-used for all
|
local deco_id_everness_forsaken_tundra_under_willow_tree = minetest.get_decoration_id('everness:forsaken_tundra_under_willow_tree')
|
||||||
-- mapchunks, therefore minimising memory use.
|
|
||||||
local data = {}
|
|
||||||
local chance = 50
|
|
||||||
local disp = 16
|
|
||||||
local rotations = { '0', '90', '180', '270' }
|
|
||||||
local everness_forsaken_tundra_under_y_max = y_max - 1500 > y_min and y_max - 1500 or y_max
|
|
||||||
local everness_forsaken_tundra_under_y_min = y_min
|
|
||||||
|
|
||||||
-- size = { x = 39, y = 28, z = 39 }
|
|
||||||
local willow_tree_volume = 39 * 39 * 28
|
|
||||||
local willow_tree_schem = minetest.get_modpath('everness') .. '/schematics/everness_willow_tree.mts'
|
local willow_tree_schem = minetest.get_modpath('everness') .. '/schematics/everness_willow_tree.mts'
|
||||||
|
local size = { x = 39, y = 28, z = 39 }
|
||||||
|
local size_x = math.round(size.x / 2)
|
||||||
|
local size_z = math.round(size.z / 2)
|
||||||
|
local safe_volume = (size.x * size.y * size.z) / 1.5
|
||||||
|
local y_dis = 1
|
||||||
|
local willow_tree_place_on = minetest.registered_decorations['everness:forsaken_tundra_under_willow_tree'].place_on
|
||||||
|
willow_tree_place_on = type(willow_tree_place_on) == 'string' and { willow_tree_place_on } or willow_tree_place_on
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
minetest.set_gen_notify({ decoration = true }, { deco_id_everness_forsaken_tundra_under_willow_tree })
|
||||||
local rand = PcgRandom(blockseed)
|
|
||||||
|
|
||||||
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
|
Everness:add_to_queue_on_generated({
|
||||||
local area = VoxelArea:new({ MinEdge = emin, MaxEdge = emax })
|
name = 'everness:forsaken_tundra_under',
|
||||||
-- Get the content ID data from the voxelmanip in the form of a flat array.
|
can_run = function(biomemap)
|
||||||
-- Set the buffer parameter to use and reuse 'data' for this.
|
return table.indexof(biomemap, biome_id_everness_forsaken_tundra_under) ~= -1
|
||||||
vm:get_data(data)
|
end,
|
||||||
local sidelength = maxp.x - minp.x + 1
|
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
|
||||||
|
|
||||||
local x_disp = rand:next(0, disp)
|
|
||||||
local z_disp = rand:next(0, disp)
|
|
||||||
|
|
||||||
if everness_forsaken_tundra_under_y_min < maxp.y
|
|
||||||
and maxp.y < everness_forsaken_tundra_under_y_max
|
|
||||||
then
|
|
||||||
for y = minp.y, maxp.y do
|
|
||||||
local vi = area:index(minp.x + sidelength / 2 + x_disp, y, minp.z + sidelength / 2 + z_disp)
|
|
||||||
|
|
||||||
if data[vi + area.ystride] == c_air and data[vi] == c_mold_stone_with_moss then
|
|
||||||
local rotation = rotations[rand:next(1, #rotations)]
|
|
||||||
local s_pos = area:position(vi)
|
|
||||||
local biome_data = minetest.get_biome_data(s_pos)
|
|
||||||
|
|
||||||
if not biome_data then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local biome_name = minetest.get_biome_name(biome_data.biome)
|
|
||||||
|
|
||||||
if not biome_name then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if biome_name == 'everness:forsaken_tundra_under' and rand:next(0, 100) < chance then
|
|
||||||
--
|
--
|
||||||
-- Willow Tree
|
-- Willow Tree
|
||||||
--
|
--
|
||||||
|
|
||||||
local schem_pos = vector.new(s_pos.x, s_pos.y, s_pos.z)
|
for _, pos in ipairs(gennotify['decoration#' .. (deco_id_everness_forsaken_tundra_under_willow_tree or '')] or {}) do
|
||||||
local air_positions = minetest.find_nodes_in_area(
|
-- `pos` is position of the 'place_on' node
|
||||||
vector.new(s_pos.x - 19, s_pos.y, s_pos.z - 19),
|
local marker_pos = vector.new(pos.x, pos.y + 1, pos.z)
|
||||||
vector.new(s_pos.x + 19, s_pos.y + 28, s_pos.z + 19),
|
local marker_node = minetest.get_node(marker_pos)
|
||||||
{'air'},
|
local place_on_node = minetest.get_node(pos)
|
||||||
|
|
||||||
|
if not marker_node then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if marker_node.name ~= 'everness:marker' then
|
||||||
|
-- not a valid "place_on" position (e.g. something else was placed there)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.remove_node(marker_pos)
|
||||||
|
|
||||||
|
if table.indexof(willow_tree_place_on, place_on_node.name) == -1 then
|
||||||
|
-- not a valid "place_on" position (e.g. something else was placed there)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- no need to check for the floor "big enough" size since its a tree and has ~ 1x1 base size
|
||||||
|
|
||||||
|
-- enough air to place structure ?
|
||||||
|
local positions = minetest.find_nodes_in_area(
|
||||||
|
vector.new(
|
||||||
|
pos.x - size_x,
|
||||||
|
pos.y - y_dis,
|
||||||
|
pos.z - size_z
|
||||||
|
),
|
||||||
|
vector.new(
|
||||||
|
pos.x + size_x,
|
||||||
|
pos.y - y_dis + size.y,
|
||||||
|
pos.z + size_z
|
||||||
|
),
|
||||||
|
{
|
||||||
|
'air',
|
||||||
|
'everness:willow_tree'
|
||||||
|
},
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
|
|
||||||
if air_positions.air and #air_positions.air > (willow_tree_volume / 2) then
|
local air = positions.air or {}
|
||||||
|
local tree = positions['everness:willow_tree'] or {}
|
||||||
|
|
||||||
|
if #tree > 1 then
|
||||||
|
-- will overlap another tree
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if #air > safe_volume then
|
||||||
minetest.place_schematic_on_vmanip(
|
minetest.place_schematic_on_vmanip(
|
||||||
vm,
|
vm,
|
||||||
schem_pos,
|
vector.new(marker_pos.x, marker_pos.y - y_dis, marker_pos.z),
|
||||||
willow_tree_schem,
|
willow_tree_schem,
|
||||||
rotation,
|
'random',
|
||||||
nil,
|
nil,
|
||||||
true,
|
true,
|
||||||
'place_center_x, place_center_z'
|
'place_center_x, place_center_z'
|
||||||
)
|
)
|
||||||
|
|
||||||
minetest.log('action', '[Everness] Willow Tree was placed at ' .. schem_pos:to_string())
|
minetest.log('action', '[Everness] Willow Tree was placed at ' .. pos:to_string())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
})
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
|
@ -313,9 +313,18 @@ Everness:register_decoration({
|
||||||
-- On Generated
|
-- On Generated
|
||||||
--
|
--
|
||||||
|
|
||||||
|
local size_ceiling = { x = 2, y = 19, z = 2 }
|
||||||
|
local size_ceiling_x = math.round(size_ceiling.x / 2)
|
||||||
|
local size_ceiling_z = math.round(size_ceiling.z / 2)
|
||||||
|
local size_floor = { x = 2, y = 20, z = 2 }
|
||||||
|
local size_floor_x = math.round(size_floor.x / 2)
|
||||||
|
local size_floor_z = math.round(size_floor.z / 2)
|
||||||
|
|
||||||
local deco_id_frosted_icicle_large_ceiling = minetest.get_decoration_id('everness:frosted_icicle_large_ceiling')
|
local deco_id_frosted_icicle_large_ceiling = minetest.get_decoration_id('everness:frosted_icicle_large_ceiling')
|
||||||
local deco_id_frosted_icicle_large_floor = minetest.get_decoration_id('everness:frosted_icicle_large_floor')
|
local deco_id_frosted_icicle_large_floor = minetest.get_decoration_id('everness:frosted_icicle_large_floor')
|
||||||
|
|
||||||
|
local biome_id_everness_frosted_icesheet_under = minetest.get_biome_id('everness:frosted_icesheet_under')
|
||||||
|
|
||||||
minetest.set_gen_notify(
|
minetest.set_gen_notify(
|
||||||
{ decoration = true },
|
{ decoration = true },
|
||||||
{
|
{
|
||||||
|
@ -324,15 +333,12 @@ minetest.set_gen_notify(
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
Everness:add_to_queue_on_generated({
|
||||||
local gennotify = minetest.get_mapgen_object('gennotify')
|
name = 'everness:frosted_icesheet_under',
|
||||||
local size_ceiling = { x = 2, y = 19, z = 2 }
|
can_run = function(biomemap)
|
||||||
local size_ceiling_x = math.round(size_ceiling.x / 2)
|
return table.indexof(biomemap, biome_id_everness_frosted_icesheet_under) ~= -1
|
||||||
local size_ceiling_z = math.round(size_ceiling.z / 2)
|
end,
|
||||||
local size_floor = { x = 2, y = 20, z = 2 }
|
after_write_to_map = function(shared_args, gennotify)
|
||||||
local size_floor_x = math.round(size_floor.x / 2)
|
|
||||||
local size_floor_z = math.round(size_floor.z / 2)
|
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Frosted Large Icicle Ceiling
|
-- Frosted Large Icicle Ceiling
|
||||||
--
|
--
|
||||||
|
@ -395,4 +401,5 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end
|
||||||
|
})
|
||||||
|
|
Binary file not shown.
Ŝarĝante…
Reference in New Issue