Add cursed island, improve deep ocean schem placing
This commit is contained in:
parent
62ce3d9fde
commit
9c89429a52
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,25 @@
|
||||||
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
|
||||||
|
minetest.register_chatcommand('everness:getbiomename', {
|
||||||
|
description = S('Get biome name where you are standing.'),
|
||||||
|
params = '',
|
||||||
|
privs = { creative = true },
|
||||||
|
func = function(name, param)
|
||||||
|
local player = minetest.get_player_by_name(name)
|
||||||
|
|
||||||
|
if not player then
|
||||||
|
return false, S('This command can only be executed in-game!')
|
||||||
|
end
|
||||||
|
|
||||||
|
local p_pos = player:get_pos()
|
||||||
|
local biome_data = minetest.get_biome_data(p_pos)
|
||||||
|
|
||||||
|
if not biome_data then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
local biome_name = minetest.get_biome_name(biome_data.biome)
|
||||||
|
|
||||||
|
minetest.chat_send_player(name, 'Biome name: ' .. biome_name)
|
||||||
|
end,
|
||||||
|
})
|
10
init.lua
10
init.lua
|
@ -214,9 +214,14 @@ if Everness.settings.features.everness_feature_sneak_pickup then
|
||||||
end
|
end
|
||||||
|
|
||||||
dofile(path .. '/privileges.lua')
|
dofile(path .. '/privileges.lua')
|
||||||
|
dofile(path .. '/chat_commands.lua')
|
||||||
|
|
||||||
Everness:encyclopedia_init()
|
Everness:encyclopedia_init()
|
||||||
|
|
||||||
|
minetest.register_on_mods_loaded(function()
|
||||||
|
Everness.set_loot_chest_items()
|
||||||
|
end)
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Mod Support
|
-- Mod Support
|
||||||
--
|
--
|
||||||
|
@ -245,11 +250,6 @@ end
|
||||||
-- Minetest Game
|
-- Minetest Game
|
||||||
dofile(path .. '/mod_support_mtg.lua')
|
dofile(path .. '/mod_support_mtg.lua')
|
||||||
|
|
||||||
minetest.register_on_mods_loaded(function()
|
|
||||||
Everness.set_loot_chest_items()
|
|
||||||
end)
|
|
||||||
|
|
||||||
|
|
||||||
local mod_end_time = (minetest.get_us_time() - mod_start_time) / 1000000
|
local mod_end_time = (minetest.get_us_time() - mod_start_time) / 1000000
|
||||||
|
|
||||||
print('[Mod] everness loaded.. [' .. mod_end_time .. 's]')
|
print('[Mod] everness loaded.. [' .. mod_end_time .. 's]')
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
-- Get the content IDs for the nodes used.
|
-- Get the content IDs for the nodes used.
|
||||||
|
local c_water_source = minetest.get_content_id('mapgen_water_source')
|
||||||
local c_dirt_with_grass_1 = minetest.get_content_id('everness:dirt_with_grass_1')
|
local c_dirt_with_grass_1 = minetest.get_content_id('everness:dirt_with_grass_1')
|
||||||
local c_dirt_with_grass_extras_1 = minetest.get_content_id('everness:dirt_with_grass_extras_1')
|
local c_dirt_with_grass_extras_1 = minetest.get_content_id('everness:dirt_with_grass_extras_1')
|
||||||
local c_dirt_with_grass_extras_2 = minetest.get_content_id('everness:dirt_with_grass_extras_2')
|
local c_dirt_with_grass_extras_2 = minetest.get_content_id('everness:dirt_with_grass_extras_2')
|
||||||
|
@ -33,16 +34,20 @@ local c_frosted_snowblock = minetest.get_content_id('everness:frosted_snowblock'
|
||||||
local c_frosted_ice = minetest.get_content_id('everness:frosted_ice')
|
local c_frosted_ice = minetest.get_content_id('everness:frosted_ice')
|
||||||
local c_everness_mineral_water_source = minetest.get_content_id('everness:mineral_water_source')
|
local c_everness_mineral_water_source = minetest.get_content_id('everness:mineral_water_source')
|
||||||
local c_everness_mineral_sand = minetest.get_content_id('everness:mineral_sand')
|
local c_everness_mineral_sand = minetest.get_content_id('everness:mineral_sand')
|
||||||
|
-- Biome IDs
|
||||||
|
local biome_id_everness_cursed_lands_dunes = minetest.get_biome_id('everness:cursed_lands_dunes')
|
||||||
|
local biome_id_everness_cursed_lands_swamp = minetest.get_biome_id('everness:cursed_lands_swamp')
|
||||||
|
|
||||||
-- Localize data buffer table outside the loop, to be re-used for all
|
-- Localize data buffer table outside the loop, to be re-used for all
|
||||||
-- mapchunks, therefore minimising memory use.
|
-- mapchunks, therefore minimising memory use.
|
||||||
local data = {}
|
local data = {}
|
||||||
local chance = 15
|
local chance = 20
|
||||||
local disp = 16
|
local disp = 16
|
||||||
local water_level = tonumber(minetest.settings:get('water_level'))
|
local water_level = tonumber(minetest.settings:get('water_level')) or 1
|
||||||
|
|
||||||
minetest.register_on_generated(function(minp, maxp, blockseed)
|
minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
local rand = PcgRandom(blockseed)
|
local rand = PcgRandom(blockseed)
|
||||||
|
local biomemap = minetest.get_mapgen_object('biomemap')
|
||||||
-- Load the voxelmanip with the result of engine mapgen
|
-- Load the voxelmanip with the result of engine mapgen
|
||||||
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
|
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
|
||||||
-- 'area' is used later to get the voxelmanip indexes for positions
|
-- 'area' is used later to get the voxelmanip indexes for positions
|
||||||
|
@ -63,7 +68,7 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
local s_pos = area:position(vi)
|
local s_pos = area:position(vi)
|
||||||
|
|
||||||
if maxp.y >= water_level then
|
if maxp.y >= water_level then
|
||||||
-- Above sea level
|
-- Above sea level or at water level
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
data[vi] == c_dirt_with_grass_1
|
data[vi] == c_dirt_with_grass_1
|
||||||
|
@ -219,7 +224,6 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
|
|
||||||
minetest.log('action', '[Everness] Jungle Temple was placed at ' .. schem_pos:to_string())
|
minetest.log('action', '[Everness] Jungle Temple was placed at ' .. schem_pos:to_string())
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif
|
elseif
|
||||||
data[vi] == c_dirt_with_cursed_grass
|
data[vi] == c_dirt_with_cursed_grass
|
||||||
and rand:next(0, 100) < chance
|
and rand:next(0, 100) < chance
|
||||||
|
@ -588,6 +592,85 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
|
|
||||||
minetest.log('action', '[Everness] Mineral Waters Tower was placed at ' .. schem_pos:to_string())
|
minetest.log('action', '[Everness] Mineral Waters Tower was placed at ' .. schem_pos:to_string())
|
||||||
end
|
end
|
||||||
|
elseif
|
||||||
|
water_level >= minp.y
|
||||||
|
and water_level <= maxp.y
|
||||||
|
and data[vi] == c_water_source
|
||||||
|
then
|
||||||
|
--
|
||||||
|
-- Water Level
|
||||||
|
--
|
||||||
|
if
|
||||||
|
(
|
||||||
|
table.indexof(biomemap, biome_id_everness_cursed_lands_dunes) ~= -1
|
||||||
|
or table.indexof(biomemap, biome_id_everness_cursed_lands_swamp) ~= -1
|
||||||
|
)
|
||||||
|
and rand:next(0, 100) < chance
|
||||||
|
then
|
||||||
|
local schem = minetest.get_modpath('everness') .. '/schematics/everness_cursed_lands_deep_ocean_island.mts'
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Cursed Lands Deep Ocean Island
|
||||||
|
--
|
||||||
|
|
||||||
|
local size = { x = 25, y = 23, z = 23 }
|
||||||
|
local size_x = math.round(size.x / 2)
|
||||||
|
local size_z = math.round(size.z / 2)
|
||||||
|
-- add Y displacement
|
||||||
|
local y_dis = 7
|
||||||
|
local schem_pos = vector.new(s_pos.x, s_pos.y - y_dis, s_pos.z)
|
||||||
|
|
||||||
|
-- find floor big enough
|
||||||
|
local indexes = Everness.find_content_in_vm_area(
|
||||||
|
vector.new(s_pos.x - size_x, s_pos.y - 1, s_pos.z - size_z),
|
||||||
|
vector.new(s_pos.x + size_x, s_pos.y + 1, s_pos.z + size_z),
|
||||||
|
{
|
||||||
|
c_water_source,
|
||||||
|
minetest.CONTENT_AIR
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
area
|
||||||
|
)
|
||||||
|
|
||||||
|
if #indexes < size.x * size.z then
|
||||||
|
-- not enough space
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- enough space to place structure ?
|
||||||
|
local space_indexes = Everness.find_content_in_vm_area(
|
||||||
|
vector.new(s_pos.x - size_x, s_pos.y, s_pos.z - size_z),
|
||||||
|
vector.new(s_pos.x + size_x, s_pos.y + size.y, s_pos.z + size_z),
|
||||||
|
{
|
||||||
|
c_water_source,
|
||||||
|
minetest.CONTENT_AIR
|
||||||
|
},
|
||||||
|
data,
|
||||||
|
area
|
||||||
|
)
|
||||||
|
|
||||||
|
if #space_indexes > (size.x * size.y * size.z) / 2 then
|
||||||
|
minetest.place_schematic_on_vmanip(
|
||||||
|
vm,
|
||||||
|
schem_pos,
|
||||||
|
schem,
|
||||||
|
'random',
|
||||||
|
nil,
|
||||||
|
true,
|
||||||
|
'place_center_x, place_center_z'
|
||||||
|
)
|
||||||
|
|
||||||
|
schem_positions.everness_cursed_lands_deep_ocean_island = schem_positions.everness_cursed_lands_deep_ocean_island or {}
|
||||||
|
|
||||||
|
table.insert(schem_positions.everness_cursed_lands_deep_ocean_island, {
|
||||||
|
pos = schem_pos,
|
||||||
|
minp = vector.new(s_pos.x - size_x, s_pos.y - y_dis, s_pos.z - size_z),
|
||||||
|
maxp = vector.new(s_pos.x + size_x, s_pos.y - y_dis + size.y, s_pos.z + size_z)
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.log('action', '[Everness] Cursed Lands Deep Ocean Island was placed at ' .. schem_pos:to_string())
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- Under sea level (Caves)
|
-- Under sea level (Caves)
|
||||||
|
|
|
@ -336,7 +336,7 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
local schem_positions = {}
|
local schem_positions = {}
|
||||||
local schem_placed = false
|
local schem_placed = false
|
||||||
|
|
||||||
if table.indexof(biomemap, biome_id_everness_coral_forest_deep_ocean) ~= -1 then
|
if table.indexof(biomemap, biome_id_everness_coral_forest_deep_ocean) ~= -1 and rand:next(0, 100) < chance then
|
||||||
-- Load the voxelmanip with the result of engine mapgen
|
-- Load the voxelmanip with the result of engine mapgen
|
||||||
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
|
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
|
||||||
-- 'area' is used later to get the voxelmanip indexes for positions
|
-- 'area' is used later to get the voxelmanip indexes for positions
|
||||||
|
@ -354,7 +354,6 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
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
|
and not schem_placed
|
||||||
and rand:next(0, 100) < chance
|
|
||||||
then
|
then
|
||||||
local s_pos = area:position(vi)
|
local s_pos = area:position(vi)
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
local schem_positions = {}
|
local schem_positions = {}
|
||||||
local schem_placed = false
|
local schem_placed = false
|
||||||
|
|
||||||
if table.indexof(biomemap, biome_id_everness_crystal_forest_deep_ocean) ~= -1 then
|
if table.indexof(biomemap, biome_id_everness_crystal_forest_deep_ocean) ~= -1 and rand:next(0, 100) < chance then
|
||||||
-- Load the voxelmanip with the result of engine mapgen
|
-- Load the voxelmanip with the result of engine mapgen
|
||||||
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
|
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
|
||||||
-- 'area' is used later to get the voxelmanip indexes for positions
|
-- 'area' is used later to get the voxelmanip indexes for positions
|
||||||
|
@ -223,7 +223,6 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
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
|
and not schem_placed
|
||||||
and rand:next(0, 100) < chance
|
|
||||||
then
|
then
|
||||||
local s_pos = area:position(vi)
|
local s_pos = area:position(vi)
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
local schem_positions = {}
|
local schem_positions = {}
|
||||||
local schem_placed = false
|
local schem_placed = false
|
||||||
|
|
||||||
if table.indexof(biomemap, biome_id_everness_cursed_lands_deep_ocean) ~= -1 then
|
if table.indexof(biomemap, biome_id_everness_cursed_lands_deep_ocean) ~= -1 and rand:next(0, 100) < chance then
|
||||||
-- Load the voxelmanip with the result of engine mapgen
|
-- Load the voxelmanip with the result of engine mapgen
|
||||||
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
|
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
|
||||||
-- 'area' is used later to get the voxelmanip indexes for positions
|
-- 'area' is used later to get the voxelmanip indexes for positions
|
||||||
|
@ -223,7 +223,6 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
|
||||||
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
|
and not schem_placed
|
||||||
and rand:next(0, 100) < chance
|
|
||||||
then
|
then
|
||||||
local s_pos = area:position(vi)
|
local s_pos = area:position(vi)
|
||||||
|
|
||||||
|
|
Binary file not shown.
Ŝarĝante…
Reference in New Issue