Merged in feature/merge_on_generated_calls (pull request #24)

Merge on generated calls
This commit is contained in:
Juraj Vajda 2024-02-10 21:25:07 +00:00
commit d621851b02
38 changed files with 46553 additions and 41628 deletions

49
api.lua
View File

@ -236,7 +236,8 @@ Everness = {
registered_craftitems = {},
registered_biomes = {},
registered_decorations = {},
registered_ores = {}
registered_ores = {},
on_generated_queue = {}
}
function Everness.grow_cactus(self, pos, node, params)
@ -1141,24 +1142,28 @@ function Everness.set_loot_chest_items()
Everness.loot_chest.default = table.copy(loot_items)
end
function Everness.populate_loot_chests(self, positions, loot_chest_items_group)
local _loot_chest_items_group = loot_chest_items_group or 'default'
function Everness.populate_loot_chests(self, positions, params)
local _params = params or {}
local _loot_chest_items_group = _params.loot_chest_items_group or 'default'
-- Get inventories
local string_positions = '';
local inventories = {}
for i, pos in ipairs(positions) do
local inv = minetest.get_inventory({ type = 'node', pos = pos })
if not inv then
local chest_def = minetest.registered_nodes['everness:chest']
chest_def.on_construct(pos)
local inv = minetest.get_inventory({ type = 'node', pos = pos })
inv = minetest.get_inventory({ type = 'node', pos = pos })
end
if inv then
table.insert(inventories, inv)
string_positions = string_positions .. ' ' .. pos:to_string()
else
minetest.log('action', '[Everness] FAILED to populate loot chests inventory at ' .. pos:to_string())
minetest.log('warning', '[Everness] FAILED to populate loot chests inventory at ' .. pos:to_string())
end
end
@ -2117,3 +2122,35 @@ function Everness.find_content_in_vm_area(minp, maxp, contentIds, data, area)
return indexes, id_count
end
function Everness.find_content_under_air_in_vm_area(minp, maxp, contentIds, data, area)
local indexes = {}
local id_count = {}
for y = minp.y, maxp.y do
for z = minp.z, maxp.z do
for x = minp.x, maxp.x do
local ai = area:index(x, y, z)
if table.indexof(contentIds, data[ai]) ~= -1
and data[ai + area.ystride] == minetest.CONTENT_AIR
then
id_count[data[ai]] = (id_count[data[ai]] or 0) + 1
table.insert(indexes, ai)
end
end
end
end
return indexes, id_count
end
function Everness.add_to_queue_on_generated(self, def)
if type(def) ~= 'table' then
minetest.log('warning', '[add_to_queue_on_generated] Callback definition is not a table, not adding to queue! It was type of ' .. type(def))
return
end
table.insert(self.on_generated_queue, def)
end

View File

@ -0,0 +1,602 @@
schematic = {
size = {x=7, y=7, z=12},
yslice_prob = {
{ypos=0, prob=254},
{ypos=1, prob=254},
{ypos=2, prob=254},
{ypos=3, prob=254},
{ypos=4, prob=254},
{ypos=5, prob=254},
{ypos=6, prob=254},
},
data = {
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=20},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block_wall", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="everness:cursed_sandstone_block_wall", prob=254, param2=0},
{name="stairs:stair_cursed_sandstone_block", prob=254, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="everness:fence_dry_wood", prob=254, param2=0},
{name="everness:skull_with_candle", prob=126, param2=0},
{name="air", prob=254, param2=0},
{name="everness:skull_with_candle", prob=126, param2=0},
{name="everness:fence_dry_wood", prob=254, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=1},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=21},
{name="air", prob=0, param2=0},
{name="everness:trapdoor_cursed_wood_open", prob=126, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=23},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=1},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=21},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=23},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=1},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=20},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=2},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:dry_tree", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:dry_tree", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="stairs:stair_cursed_sandstone_block", prob=254, param2=1},
{name="everness:dry_tree", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:door_cursed_wood_a", prob=254, param2=2},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:dry_tree", prob=254, param2=0},
{name="stairs:stair_cursed_sandstone_block", prob=254, param2=3},
{name="everness:fence_dry_wood", prob=254, param2=0},
{name="everness:dry_tree", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="doors:hidden", prob=254, param2=2},
{name="everness:dry_wood", prob=254, param2=0},
{name="everness:dry_tree", prob=254, param2=0},
{name="everness:fence_dry_wood", prob=254, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=1},
{name="everness:dry_tree", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="everness:dry_tree", prob=254, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=1},
{name="everness:dry_wood", prob=254, param2=0},
{name="xpanes:cursed_bar_flat", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=1},
{name="everness:dry_wood", prob=254, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:slab_dry_tree", prob=254, param2=2},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_brick", prob=254, param2=0},
{name="everness:cursed_sandstone_brick", prob=254, param2=0},
{name="everness:cursed_sandstone_brick", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="air", prob=0, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=1},
{name="everness:dry_wood", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=1},
{name="stairs:stair_dry_tree", prob=254, param2=21},
{name="air", prob=254, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=23},
{name="stairs:stair_dry_tree", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=1},
{name="everness:dry_tree", prob=254, param2=7},
{name="stairs:stair_dry_tree", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:slab_dry_tree", prob=254, param2=2},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_brick", prob=254, param2=0},
{name="everness:cursed_sandstone_brick", prob=254, param2=0},
{name="everness:cursed_sandstone_brick", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:dry_branches", prob=126, param2=1},
{name="everness:dry_wood", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="everness:dry_branches", prob=126, param2=1},
{name="everness:trapdoor_cursed_wood_open", prob=126, param2=1},
{name="everness:dry_wood", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="everness:trapdoor_cursed_wood_open", prob=126, param2=3},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=1},
{name="everness:dry_wood", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=1},
{name="stairs:stair_dry_tree", prob=254, param2=21},
{name="air", prob=254, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=23},
{name="stairs:stair_dry_tree", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=1},
{name="everness:dry_tree", prob=254, param2=7},
{name="stairs:stair_dry_tree", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:slab_dry_tree", prob=254, param2=2},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_brick", prob=254, param2=0},
{name="everness:cursed_sandstone_brick", prob=254, param2=0},
{name="everness:cursed_sandstone_brick", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:dry_branches", prob=126, param2=1},
{name="everness:dry_wood", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="everness:dry_branches", prob=126, param2=1},
{name="air", prob=0, param2=0},
{name="xpanes:cursed_bar_flat", prob=254, param2=3},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="xpanes:cursed_bar_flat", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=1},
{name="everness:dry_wood", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=1},
{name="stairs:stair_dry_tree", prob=254, param2=21},
{name="air", prob=254, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=23},
{name="stairs:stair_dry_tree", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=1},
{name="everness:dry_tree", prob=254, param2=7},
{name="stairs:stair_dry_tree", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:slab_dry_tree", prob=254, param2=2},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_brick", prob=254, param2=0},
{name="everness:cursed_sandstone_brick", prob=254, param2=0},
{name="everness:cursed_sandstone_brick", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:dry_branches", prob=126, param2=1},
{name="everness:dry_wood", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="everness:dry_branches", prob=126, param2=1},
{name="air", prob=0, param2=0},
{name="xpanes:cursed_bar_flat", prob=254, param2=3},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="xpanes:cursed_bar_flat", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=1},
{name="everness:dry_wood", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=1},
{name="stairs:stair_dry_tree", prob=254, param2=21},
{name="air", prob=254, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=23},
{name="stairs:stair_dry_tree", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=1},
{name="everness:dry_tree", prob=254, param2=7},
{name="stairs:stair_dry_tree", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:slab_dry_tree", prob=254, param2=2},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_brick", prob=254, param2=0},
{name="everness:cursed_sandstone_brick", prob=254, param2=0},
{name="everness:cursed_sandstone_brick", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:dry_branches", prob=126, param2=1},
{name="everness:dry_wood", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="everness:dry_branches", prob=126, param2=1},
{name="everness:trapdoor_cursed_wood_open", prob=254, param2=1},
{name="everness:dry_wood", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="everness:trapdoor_cursed_wood_open", prob=126, param2=3},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=1},
{name="everness:dry_wood", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=1},
{name="stairs:stair_dry_tree", prob=254, param2=21},
{name="air", prob=254, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=23},
{name="stairs:stair_dry_tree", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=1},
{name="everness:dry_tree", prob=254, param2=7},
{name="stairs:stair_dry_tree", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:slab_dry_tree", prob=254, param2=2},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_brick", prob=254, param2=0},
{name="everness:cursed_sandstone_brick", prob=254, param2=0},
{name="everness:cursed_sandstone_brick", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="air", prob=0, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="default:bookshelf", prob=254, param2=0},
{name="everness:chest", prob=126, param2=0},
{name="default:bookshelf", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="everness:skull_with_candle", prob=126, param2=0},
{name="air", prob=254, param2=0},
{name="everness:skull_with_candle", prob=126, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=1},
{name="everness:dry_wood", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="air", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=1},
{name="stairs:stair_dry_tree", prob=254, param2=21},
{name="air", prob=254, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=23},
{name="stairs:stair_dry_tree", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=1},
{name="everness:dry_tree", prob=254, param2=7},
{name="stairs:stair_dry_tree", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:slab_dry_tree", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:dry_tree", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:dry_tree", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="stairs:stair_cursed_sandstone_block", prob=254, param2=1},
{name="everness:dry_tree", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="everness:dry_tree", prob=254, param2=0},
{name="stairs:stair_cursed_sandstone_block", prob=254, param2=3},
{name="everness:fence_dry_wood", prob=254, param2=0},
{name="everness:dry_tree", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="xpanes:cursed_bar_flat", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="everness:dry_tree", prob=254, param2=0},
{name="everness:fence_dry_wood", prob=254, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=1},
{name="everness:dry_tree", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="everness:dry_tree", prob=254, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=1},
{name="everness:dry_wood", prob=254, param2=0},
{name="xpanes:cursed_bar_flat", prob=254, param2=0},
{name="everness:dry_wood", prob=254, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=1},
{name="everness:dry_wood", prob=254, param2=0},
{name="stairs:stair_dry_tree", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:slab_dry_tree", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="everness:cursed_sandstone_block", prob=254, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_sandstone_block", prob=254, param2=2},
{name="everness:dry_branches", prob=126, param2=1},
{name="everness:dry_branches", prob=126, param2=1},
{name="everness:dry_branches", prob=126, param2=1},
{name="stairs:stair_cursed_sandstone_block", prob=254, param2=2},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="everness:fence_dry_wood", prob=254, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="everness:fence_dry_wood", prob=254, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=1},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=21},
{name="air", prob=0, param2=0},
{name="everness:trapdoor_cursed_wood_open", prob=126, param2=2},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=23},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=1},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=21},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=23},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=1},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=22},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=3},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="stairs:stair_cursed_brick_with_growth", prob=254, param2=22},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
{name="air", prob=0, param2=0},
},
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -14,47 +14,19 @@
--]]
-- 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_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_rainforest_litter = minetest.get_content_id('default:dirt_with_rainforest_litter')
local c_dirt_with_cursed_grass = minetest.get_content_id('everness:dirt_with_cursed_grass')
local c_dirt_with_crystal_grass = minetest.get_content_id('everness:dirt_with_crystal_grass')
local c_crystal_sand = minetest.get_content_id('everness:crystal_sand')
local c_dry_ocean_dirt = minetest.get_content_id('everness:dry_ocean_dirt')
local c_dirt_with_snow = minetest.get_content_id('default:dirt_with_snow')
local c_dirt_with_coniferous_litter = minetest.get_content_id('default:dirt_with_coniferous_litter')
local c_forsaken_desert_sand = minetest.get_content_id('everness:forsaken_desert_sand')
local c_forsaken_desert_chiseled_stone = minetest.get_content_id('everness:forsaken_desert_chiseled_stone')
local c_forsaken_desert_brick = minetest.get_content_id('everness:forsaken_desert_brick')
local c_forsaken_desert_engraved_stone = minetest.get_content_id('everness:forsaken_desert_engraved_stone')
local c_frosted_snowblock = minetest.get_content_id('everness:frosted_snowblock')
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_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')
local biome_id_everness_cursed_lands_ocean = minetest.get_biome_id('everness:cursed_lands_ocean')
local biome_id_everness_coral_forest_dunes = minetest.get_biome_id('everness:coral_forest_dunes')
local biome_id_everness_coral_forest_ocean = minetest.get_biome_id('everness:coral_forest_ocean')
local biome_id_everness_crystal_forest_dunes = minetest.get_biome_id('everness:crystal_forest_dunes')
local biome_id_everness_crystal_forest_shore = minetest.get_biome_id('everness:crystal_forest_shore')
local biome_id_everness_crystal_forest_ocean = minetest.get_biome_id('everness:crystal_forest_ocean')
-- Localize data buffer table outside the loop, to be re-used for all
-- mapchunks, therefore minimising memory use.
local data = {}
local chance = 20
local chance_sea_level = 10
local disp = 16
local water_level = tonumber(minetest.settings:get('water_level')) or 1
local p2data = {}
minetest.register_on_generated(function(minp, maxp, blockseed)
-- Start time of mapchunk generation.
-- local t0 = os.clock()
local rand = PcgRandom(blockseed)
-- Array containing the biome IDs of nodes in the most recently generated chunk by the current mapgen
local biomemap = minetest.get_mapgen_object('biomemap')
-- Table mapping requested generation notification types to arrays of positions at which the corresponding generated structures are located within the current chunk
local gennotify = minetest.get_mapgen_object('gennotify')
-- 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
@ -62,851 +34,37 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
-- 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)
-- Raw `param2` data read into the `VoxelManip` object
vm:get_param2_data(p2data)
-- Side length of mapchunk
local sidelength = maxp.x - minp.x + 1
local x_disp = rand:next(0, disp)
local z_disp = rand:next(0, disp)
local schem_positions = {}
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] == minetest.CONTENT_AIR then
local s_pos = area:position(vi)
if maxp.y >= water_level then
-- Above sea level or at water level
if
(
data[vi] == c_dirt_with_grass_1
or data[vi] == c_dirt_with_grass_extras_1
or data[vi] == c_dirt_with_grass_extras_2
)
and rand:next(0, 100) < chance
then
local schem = minetest.get_modpath('everness') .. '/schematics/everness_japanese_shrine.mts'
local shared_args = {}
--
-- Japanese Shrine
-- on_data
--
local size = { x = 11, y = 19, z = 15 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local schem_pos = vector.new(s_pos)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:dirt_with_grass_1'
}
)
-- Can force over these blocks
local force_positions = minetest.find_nodes_in_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),
{
'everness:dirt_with_grass_extras_1',
'everness:dirt_with_grass_extras_2',
'group:bamboo',
'group:flower',
'group:leaves'
}
)
if #positions + #force_positions < size.x * size.z then
-- not enough space
return
-- read/write to `data` what will be eventually saved (set_data)
-- used for voxelmanip `data` manipulation
for _, def in ipairs(Everness.on_generated_queue) do
if def.can_run(biomemap) and def.on_data then
shared_args[def.name] = shared_args[def.name] or {}
def.on_data(minp, maxp, area, data, p2data, gennotify, rand, shared_args[def.name])
end
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air',
'group:bamboo',
'group:flower',
'group:leaves'
}
)
if #air_positions > (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_japanese_shrine = schem_positions.everness_japanese_shrine or {}
table.insert(schem_positions.everness_japanese_shrine, {
pos = schem_pos,
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)
})
minetest.log('action', '[Everness] Japanese Shrine was placed at ' .. schem_pos:to_string())
end
elseif
data[vi] == c_dirt_with_rainforest_litter
and rand:next(0, 100) < chance
then
local schem = minetest.get_modpath('everness') .. '/schematics/everness_jungle_temple.mts'
-- set data after they have been manipulated (from above)
vm:set_data(data)
vm:set_param2_data(p2data)
--
-- Jungle Temple
-- after_set_data
--
local size = { x = 12, y = 14, z = 15 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
-- add Y displacement
local y_dis = 3
local schem_pos = vector.new(s_pos.x, s_pos.y - y_dis, s_pos.z)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'default:dirt_with_rainforest_litter'
}
)
-- Can force over these blocks
local force_positions = minetest.find_nodes_in_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),
{
'group:tree',
'group:flower',
'group:flora',
'group:leaves',
'fireflies:firefly',
'fireflies:hidden_firefly',
}
)
if #positions + #force_positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air',
'group:tree',
'group:flora',
'group:leaves'
}
)
if #air_positions > (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_jungle_temple = schem_positions.everness_jungle_temple or {}
table.insert(schem_positions.everness_jungle_temple, {
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] Jungle Temple was placed at ' .. schem_pos:to_string())
end
elseif
data[vi] == c_dirt_with_cursed_grass
and rand:next(0, 100) < chance
then
local schem = minetest.get_modpath('everness') .. '/schematics/everness_haunted_house.mts'
--
-- Haunted House
--
local size = { x = 11, y = 22, z = 10 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
-- add Y displacement
local y_dis = 1
local schem_pos = vector.new(s_pos.x, s_pos.y - y_dis, s_pos.z)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:dirt_with_cursed_grass'
}
)
if #positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air'
}
)
if #air_positions > (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_haunted_house = schem_positions.everness_haunted_house or {}
table.insert(schem_positions.everness_haunted_house, {
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] Haunted House was placed at ' .. schem_pos:to_string())
end
elseif
(
data[vi] == c_dirt_with_crystal_grass
or data[vi] == c_crystal_sand
)
and rand:next(0, 100) < chance
then
local schem = minetest.get_modpath('everness') .. '/schematics/everness_quartz_temple.mts'
--
-- Quartz Temple
--
local size = { x = 16, y = 13, z = 16 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local schem_pos = vector.new(s_pos)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:dirt_with_crystal_grass',
'everness:crystal_sand'
}
)
if #positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air'
}
)
if #air_positions > (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_quartz_temple = schem_positions.everness_quartz_temple or {}
table.insert(schem_positions.everness_quartz_temple, {
pos = schem_pos,
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)
})
minetest.log('action', '[Everness] Quartz Temple was placed at ' .. schem_pos:to_string())
end
elseif
(
data[vi] == c_forsaken_desert_sand
or data[vi] == c_dry_ocean_dirt
)
and rand:next(0, 100) < chance
then
local schem = minetest.get_modpath('everness') .. '/schematics/everness_forsaken_desert_temple.mts'
--
-- Forsaken Desert Temple
--
local size = { x = 9, y = 16, z = 9 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local schem_pos = vector.new(s_pos)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:forsaken_desert_sand',
'everness:dry_ocean_dirt'
}
)
if #positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air'
}
)
if #air_positions > (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_forsaken_desert_temple = schem_positions.everness_forsaken_desert_temple or {}
table.insert(schem_positions.everness_forsaken_desert_temple, {
pos = schem_pos,
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)
})
minetest.log('action', '[Everness] Forsaken Desert Temple was placed at ' .. schem_pos:to_string())
end
elseif
(
data[vi] == c_dirt_with_snow
or data[vi] == c_dirt_with_coniferous_litter
)
and rand:next(0, 100) < 100
then
local schem = minetest.get_modpath('everness') .. '/schematics/everness_giant_sequoia_tree.mts'
--
-- Giant Sequoia
--
local size = { x = 25, y = 75, z = 25 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local schem_pos = vector.new(s_pos)
minetest.emerge_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),
function(blockpos, action, calls_remaining, param)
Everness:emerge_area(blockpos, action, calls_remaining, param)
end,
{
callback = function()
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'default:dirt_with_snow',
'default:dirt_with_coniferous_litter',
'default:snow'
})
if #positions < size.x * size.z then
-- not enough space
return
end
minetest.place_schematic(
schem_pos,
schem,
'random',
nil,
true,
'place_center_x, place_center_z'
)
minetest.log('action', '[Everness] Giant Sequoia was placed at ' .. schem_pos:to_string())
end
}
)
elseif
(
data[vi] == c_frosted_snowblock
or data[vi] == c_frosted_ice
)
and rand:next(0, 100) < chance
then
local schem = minetest.get_modpath('everness') .. '/schematics/everness_frosted_icesheet_igloo.mts'
--
-- Igloo
--
local size = { x = 16, y = 13, z = 16 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
-- add Y displacement
local y_dis = 8
local schem_pos = vector.new(s_pos.x, s_pos.y - y_dis, s_pos.z)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:frosted_snowblock',
'everness:frosted_ice'
}
)
if #positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air'
}
)
if #air_positions > (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_frosted_icesheet_igloo = schem_positions.everness_frosted_icesheet_igloo or {}
table.insert(schem_positions.everness_frosted_icesheet_igloo, {
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] Igloo was placed at ' .. schem_pos:to_string())
end
elseif
(
data[vi] == c_everness_mineral_water_source
or data[vi] == c_everness_mineral_sand
)
and rand:next(0, 100) < chance
then
local schem = minetest.get_modpath('everness') .. '/schematics/everness_mineral_waters_tower.mts'
--
-- Mineral Waters Tower
--
local size = { x = 7, y = 16, z = 9 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local schem_pos = vector.new(s_pos)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:mineral_sand',
'everness:mineral_water_source'
}
)
if #positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{ 'air' }
)
if #air_positions > (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_mineral_waters_tower = schem_positions.everness_mineral_waters_tower or {}
table.insert(schem_positions.everness_mineral_waters_tower, {
pos = schem_pos,
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)
})
minetest.log('action', '[Everness] Mineral Waters Tower was placed at ' .. schem_pos:to_string())
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
or table.indexof(biomemap, biome_id_everness_cursed_lands_ocean) ~= -1
)
and rand:next(0, 100) < chance_sea_level
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
elseif
(
table.indexof(biomemap, biome_id_everness_coral_forest_dunes) ~= -1
or table.indexof(biomemap, biome_id_everness_coral_forest_ocean) ~= -1
)
and rand:next(0, 100) < chance_sea_level
then
local schem = minetest.get_modpath('everness') .. '/schematics/everness_coral_forest_ocean_fishing_dock.mts'
--
-- Coral Forest Ocean Fishing Dock
--
local size = { x = 26, y = 10, z = 23 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
-- add Y displacement
local y_dis = 1
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_coral_forest_ocean_fishing_dock = schem_positions.everness_coral_forest_ocean_fishing_dock or {}
table.insert(schem_positions.everness_coral_forest_ocean_fishing_dock, {
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] Coral Forest Ocean Fishing Dock was placed at ' .. schem_pos:to_string())
end
elseif
(
table.indexof(biomemap, biome_id_everness_crystal_forest_dunes) ~= -1
or table.indexof(biomemap, biome_id_everness_crystal_forest_shore) ~= -1
or table.indexof(biomemap, biome_id_everness_crystal_forest_ocean) ~= -1
)
and rand:next(0, 100) < chance_sea_level
then
local schem = minetest.get_modpath('everness') .. '/schematics/everness_crystal_forest_ocean_shrine.mts'
--
-- Crystal Forest Ocean Shrine
--
local size = { x = 13, y = 16, z = 13 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
-- add Y displacement
local y_dis = 8
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_crystal_forest_ocean_shrine = schem_positions.everness_crystal_forest_ocean_shrine or {}
table.insert(schem_positions.everness_crystal_forest_ocean_shrine, {
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] Crystal Forest Ocean Shrine was placed at ' .. schem_pos:to_string())
end
end
end
else
-- Under sea level (Caves)
if
(
data[vi] == c_forsaken_desert_sand
or data[vi] == c_forsaken_desert_chiseled_stone
or data[vi] == c_forsaken_desert_brick
or data[vi] == c_forsaken_desert_engraved_stone
)
and rand:next(0, 100) < chance
then
local schem = minetest.get_modpath('everness') .. '/schematics/everness_forsaken_desert_temple_2.mts'
--
-- Forsaken Desert Temple 2
--
local size = { x = 16, y = 17, z = 15 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local schem_pos = vector.new(s_pos)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:forsaken_desert_sand',
'everness:forsaken_desert_chiseled_stone',
'everness:forsaken_desert_brick',
'everness:forsaken_desert_engraved_stone',
'group:stone',
'group:sand',
'group:everness_sand',
'default:gravel',
'default:stone_with_coal',
'default:stone_with_iron',
'default:stone_with_tin',
'default:stone_with_gold',
'default:stone_with_mese',
'default:stone_with_diamond',
'everness:cave_barrel_cactus',
'everness:venus_trap',
'group:flora',
'everness:quartz_ore',
'everness:stone_with_pyrite',
}
)
if #positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air'
}
)
if #air_positions > (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_forsaken_desert_temple_2 = schem_positions.everness_forsaken_desert_temple_2 or {}
table.insert(schem_positions.everness_forsaken_desert_temple_2, {
pos = schem_pos,
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)
})
minetest.log('action', '[Everness] Forsaken Desert Temple 2 was placed at ' .. schem_pos:to_string())
end
end
end
-- read-only (but cant and should not manipulate) voxelmanip `data`
-- used for `place_schematic_on_vmanip` which will invalidate `data`
-- therefore we are doing it after we set the data
for _, def in ipairs(Everness.on_generated_queue) do
if def.can_run(biomemap) and def.after_set_data then
shared_args[def.name] = shared_args[def.name] or {}
def.after_set_data(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args[def.name])
end
end
@ -918,22 +76,22 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
vm:update_liquids()
-- Write what has been created to the world.
vm:write_to_map()
minetest.fix_light(minp, maxp)
-- Populate loot chests
for name, tbl in pairs(schem_positions) do
if next(tbl) then
for i, v in ipairs(tbl) do
local chest_positions = minetest.find_nodes_in_area(
v.minp,
v.maxp,
{ 'everness:chest' }
)
--
-- after_write_to_map
--
-- Cannot read/write voxelmanip or its data
-- Used for direct manipulation of the world chunk nodes where the
-- definitions of nodes are available and node callback can be executed
-- or e.g. for `minetest.fix_light`
for _, def in ipairs(Everness.on_generated_queue) do
if def.can_run(biomemap) and def.after_write_to_map then
shared_args[def.name] = shared_args[def.name] or {}
def.after_write_to_map(shared_args[def.name], gennotify)
end
end
if #chest_positions > 0 then
Everness:populate_loot_chests(chest_positions)
end
end
end
end
-- Print generation time of this mapchunk.
-- local chugent = math.ceil((os.clock() - t0) * 1000)
-- print('[Everness] Mapchunk generation time ' .. chugent .. ' ms')
end)

View File

@ -251,29 +251,30 @@ register_flower_magenta_decoration(0.015, 0.045, 1)
-- On Generated
--
local data = {}
local p2data = {}
local disp = 16
local chance = 20
local schem = minetest.get_modpath('everness') .. '/schematics/everness_japanese_shrine.mts'
local c_everness_bamboo_1 = minetest.get_content_id('everness:bamboo_1')
local c_everness_bamboo_3 = minetest.get_content_id('everness:bamboo_3')
local c_everness_bamboo_4 = minetest.get_content_id('everness:bamboo_4')
local c_everness_bamboo_5 = minetest.get_content_id('everness:bamboo_5')
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_2 = minetest.get_content_id('everness:dirt_with_grass_extras_2')
local biome_id_bamboo_forest = minetest.get_biome_id('everness:bamboo_forest')
local d_everness_bamboo_forest_large_bamboo = minetest.get_decoration_id('everness:bamboo_forest_large_bamboo')
minetest.set_gen_notify({ decoration = true }, { d_everness_bamboo_forest_large_bamboo })
minetest.register_on_generated(function(minp, maxp, blockseed)
-- 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)
vm:get_param2_data(p2data)
local gennotify = minetest.get_mapgen_object('gennotify')
Everness:add_to_queue_on_generated({
name = 'everness:bamboo_forest',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_bamboo_forest) ~= -1
end,
on_data = function(minp, maxp, area, data, p2data, gennotify, rand, shared_args)
--
-- Bamboo
--
@ -321,11 +322,119 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end
end
end
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
local sidelength = maxp.x - minp.x + 1
local x_disp = rand:next(0, disp)
local z_disp = rand:next(0, disp)
shared_args.schem_positions = {}
vm:set_data(data)
vm:set_param2_data(p2data)
-- Calculate lighting for what has been created.
vm:calc_lighting()
-- Write what has been created to the world.
vm:write_to_map()
end)
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] == minetest.CONTENT_AIR
or data[vi + area.ystride] == c_everness_bamboo_1
or data[vi + area.ystride] == c_everness_bamboo_3
)
and (
data[vi] == c_dirt_with_grass_1
or data[vi] == c_dirt_with_grass_extras_1
or data[vi] == c_dirt_with_grass_extras_2
)
and rand:next(0, 100) < chance
then
local s_pos = area:position(vi)
--
-- Japanese Shrine
--
local size = { x = 11, y = 19, z = 15 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local schem_pos = vector.new(s_pos)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:dirt_with_grass_1'
}
)
-- Can force over these blocks
local force_positions = minetest.find_nodes_in_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),
{
'everness:dirt_with_grass_extras_1',
'everness:dirt_with_grass_extras_2',
'group:bamboo',
'group:flower',
'group:leaves'
}
)
if #positions + #force_positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air',
'group:bamboo',
'group:flower',
'group:leaves'
}
)
if #air_positions > (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'
)
shared_args.schem_positions.everness_japanese_shrine = shared_args.schem_positions.everness_japanese_shrine or {}
table.insert(shared_args.schem_positions.everness_japanese_shrine, {
pos = schem_pos,
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)
})
minetest.log('action', '[Everness] Japanese Shrine was placed at ' .. schem_pos:to_string())
end
end
end
end,
after_write_to_map = function(shared_args)
local schem_positions = shared_args.schem_positions or {}
for name, tbl in pairs(schem_positions) do
if next(tbl) then
for i, v in ipairs(tbl) do
local chest_positions = minetest.find_nodes_in_area(
v.minp,
v.maxp,
{ 'everness:chest' }
)
if #chest_positions > 0 then
Everness:populate_loot_chests(chest_positions)
end
end
end
end
end
})

View File

@ -172,6 +172,26 @@ register_dry_grass_decoration(0.07, -0.01, 1)
-- On Generated
--
local disp = 16
local chance = 100
local schem = minetest.get_modpath('everness') .. '/schematics/everness_giant_sequoia_tree.mts'
local size = { x = 25, y = 75, z = 25 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local baobab_tree_size = { x = 24, y = 39, z = 24 }
local baobab_tree_size_x = math.round(size.x / 2)
local baobab_tree_size_z = math.round(size.z / 2)
local c_everness_dry_dirt_with_dry_grass = minetest.get_content_id('everness:dry_dirt_with_dry_grass')
local c_everness_dry_dirt = minetest.get_content_id('everness:dry_dirt')
local c_everness_dry_grass_1 = minetest.get_content_id('everness:dry_grass_1')
local c_everness_dry_grass_2 = minetest.get_content_id('everness:dry_grass_2')
local c_everness_dry_grass_3 = minetest.get_content_id('everness:dry_grass_3')
local c_everness_dry_grass_4 = minetest.get_content_id('everness:dry_grass_4')
local biome_id_baobab_savanna = minetest.get_biome_id('everness:baobab_savanna')
local deco_ids_baobab = {
minetest.get_decoration_id('everness:baobab_savanna_baobab_tree_1'),
minetest.get_decoration_id('everness:baobab_savanna_baobab_tree_2')
@ -181,17 +201,89 @@ if #deco_ids_baobab > 1 then
minetest.set_gen_notify({ decoration = true }, deco_ids_baobab)
end
minetest.register_on_generated(function(minp, maxp, blockseed)
local gennotify = minetest.get_mapgen_object('gennotify')
Everness:add_to_queue_on_generated({
name = 'everness:baobab_savanna',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_baobab_savanna) ~= -1
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
local sidelength = maxp.x - minp.x + 1
local x_disp = rand:next(0, disp)
local z_disp = rand:next(0, disp)
shared_args.schem_positions = {}
if maxp.y > 0 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] == minetest.CONTENT_AIR
or data[vi + area.ystride] == c_everness_dry_grass_1
or data[vi + area.ystride] == c_everness_dry_grass_2
or data[vi + area.ystride] == c_everness_dry_grass_3
or data[vi + area.ystride] == c_everness_dry_grass_4
)
and (
data[vi] == c_everness_dry_dirt_with_dry_grass
or data[vi] == c_everness_dry_dirt
)
and rand:next(0, 100) < chance
then
local s_pos = area:position(vi)
--
-- Giant Sequoia
--
minetest.emerge_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),
function(blockpos, action, calls_remaining, param)
Everness:emerge_area(blockpos, action, calls_remaining, param)
end,
{
callback = function()
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:dry_dirt_with_dry_grass',
'everness:dry_dirt',
'group:flora',
'group:flower'
})
if #positions < size.x * size.z then
-- not enough space
return
end
minetest.place_schematic(
s_pos,
schem,
'random',
nil,
true,
'place_center_x, place_center_z'
)
minetest.log('action', '[Everness] Giant Sequoia was placed at ' .. s_pos:to_string())
end
}
)
end
end
end,
after_write_to_map = function(shared_args, gennotify)
--
-- Baobab Tree - fix light
--
for _, deco_id in ipairs(deco_ids_baobab) do
for _, pos in ipairs(gennotify['decoration#' .. deco_id] or {}) do
minetest.fix_light(vector.offset(pos, -1, -1, -1), vector.offset(pos, 24, 39, 24))
for _, pos in ipairs(gennotify['decoration#' .. (deco_id or '')] or {}) do
minetest.fix_light(
vector.new(pos.x - baobab_tree_size_x, pos.y - 1, pos.z - baobab_tree_size_z),
vector.new(pos.x + baobab_tree_size_x, pos.y + baobab_tree_size.y, pos.z + baobab_tree_size_z)
)
end
end
end
end)
})

View File

@ -257,14 +257,19 @@ register_coral_grass_decoration(0.03, 0.03, 1)
--
local deco_id_coral_bones_tree = minetest.get_decoration_id('everness:coral_forest_coral_bones_tree')
local biome_id_coral_forest = minetest.get_biome_id('everness:coral_forest')
local coral_bones_tree_size = { x = 16, y = 35, z = 16 }
minetest.set_gen_notify({ decoration = true }, { deco_id_coral_bones_tree })
minetest.register_on_generated(function(minp, maxp, blockseed)
local gennotify = minetest.get_mapgen_object('gennotify')
if maxp.y > 0 then
Everness:add_to_queue_on_generated({
name = 'everness:coral_forest',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_coral_forest) ~= -1
end,
after_write_to_map = function(shared_args, gennotify)
--
-- Coral bone tree - fix light
--
@ -275,4 +280,4 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
)
end
end
end)
})

View File

@ -321,39 +321,38 @@ local c_everness_coral_forest_deep_ocean_coral_4 = minetest.get_content_id('ever
-- Biome IDs
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
-- mapchunks, therefore minimising memory use.
local data = {}
local chance = 25
local chance = 30
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 = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
minetest.register_on_generated(function(minp, maxp, blockseed)
local rand = PcgRandom(blockseed)
local biomemap = minetest.get_mapgen_object('biomemap')
local schem_positions = {}
Everness:add_to_queue_on_generated({
name = 'everness:coral_forest_deep_ocean',
can_run = function(biomemap)
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
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
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)
if rand:next(0, 100) < chance then
for y = maxp.y, minp.y, -1 do
if schem_placed then
break
end
for z = minp.z, maxp.z do
if schem_placed then
break
end
for x = minp.x, maxp.x do
local vi = area:index(x, y, z)
if
data[vi] == c_everness_coral_forest_deep_ocean_sand
and data[vi + area.ystride] == c_water_source
and not schem_placed
then
local s_pos = area:position(vi)
@ -410,32 +409,27 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
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,
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)
})
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
vm:set_lighting({ day = 0, night = 0 }, minp, maxp)
-- 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()
minetest.fix_light(minp, maxp)
break
end
end
end
end
end
end
end,
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
if next(tbl) then
for i, v in ipairs(tbl) do
@ -452,4 +446,4 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end
end
end
end)
})

View File

@ -178,3 +178,126 @@ Everness:register_decoration({
y_min = y_min,
decoration = 'everness:coral_shrub'
})
--
-- On Generated
--
local disp = 16
local chance = 5
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 size = { x = 26, y = 10, z = 23 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local y_dis = 1
local c_water_source = minetest.get_content_id('mapgen_water_source')
local biome_id_everness_coral_forest_dunes = minetest.get_biome_id('everness:coral_forest_dunes')
Everness:add_to_queue_on_generated({
name = 'everness:coral_forest_dunes',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_coral_forest_dunes) ~= -1
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
local sidelength = maxp.x - minp.x + 1
local x_disp = rand:next(0, disp)
local z_disp = rand:next(0, disp)
shared_args.schem_positions = {}
if rand:next(0, 100) < chance 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] == minetest.CONTENT_AIR
and data[vi] == c_water_source
-- Water Level
and water_level >= minp.y
and water_level <= maxp.y
then
local s_pos = area:position(vi)
--
-- Coral Forest Ocean Fishing Dock
--
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'
)
shared_args.schem_positions.everness_coral_forest_ocean_fishing_dock = shared_args.schem_positions.everness_coral_forest_ocean_fishing_dock or {}
table.insert(shared_args.schem_positions.everness_coral_forest_ocean_fishing_dock, {
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] Coral Forest Ocean Fishing Dock was placed at ' .. schem_pos:to_string())
break
end
end
end
end
end,
after_write_to_map = function(shared_args)
local schem_positions = shared_args.schem_positions or {}
for name, tbl in pairs(schem_positions) do
if next(tbl) then
for i, v in ipairs(tbl) do
local chest_positions = minetest.find_nodes_in_area(
v.minp,
v.maxp,
{ 'everness:chest' }
)
if #chest_positions > 0 then
Everness:populate_loot_chests(chest_positions)
end
end
end
end
end
})

View File

@ -159,3 +159,126 @@ Everness:register_decoration({
'everness:coral_skeleton'
},
})
--
-- On Generated
--
local disp = 16
local chance = 5
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 size = { x = 26, y = 10, z = 23 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local y_dis = 1
local c_water_source = minetest.get_content_id('mapgen_water_source')
local biome_id_everness_coral_forest_ocean = minetest.get_biome_id('everness:coral_forest_ocean')
Everness:add_to_queue_on_generated({
name = 'everness:coral_forest_ocean',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_coral_forest_ocean) ~= -1
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
local sidelength = maxp.x - minp.x + 1
local x_disp = rand:next(0, disp)
local z_disp = rand:next(0, disp)
shared_args.schem_positions = {}
if rand:next(0, 100) < chance 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] == minetest.CONTENT_AIR
and data[vi] == c_water_source
-- Water Level
and water_level >= minp.y
and water_level <= maxp.y
then
local s_pos = area:position(vi)
--
-- Coral Forest Ocean Fishing Dock
--
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'
)
shared_args.schem_positions.everness_coral_forest_ocean_fishing_dock = shared_args.schem_positions.everness_coral_forest_ocean_fishing_dock or {}
table.insert(shared_args.schem_positions.everness_coral_forest_ocean_fishing_dock, {
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] Coral Forest Ocean Fishing Dock was placed at ' .. schem_pos:to_string())
break
end
end
end
end
end,
after_write_to_map = function(shared_args)
local schem_positions = shared_args.schem_positions or {}
for name, tbl in pairs(schem_positions) do
if next(tbl) then
for i, v in ipairs(tbl) do
local chest_positions = minetest.find_nodes_in_area(
v.minp,
v.maxp,
{ 'everness:chest' }
)
if #chest_positions > 0 then
Everness:populate_loot_chests(chest_positions)
end
end
end
end
end
})

View File

@ -213,6 +213,8 @@ Everness:register_decoration({
-- 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 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.register_on_generated(function(minp, maxp, blockseed)
-- Load the voxelmanip with the result of engine mapgen
local vm = minetest.get_mapgen_object('voxelmanip')
-- Returns a table mapping requested generation notification types to arrays of positions at which the corresponding generated structures are located within the current chunk
local gennotify = minetest.get_mapgen_object('gennotify')
Everness:add_to_queue_on_generated({
name = 'everness:coral_forest_under',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_coral_forest_under) ~= -1
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
--
-- 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())
end
end
end)
end
})

View File

@ -223,3 +223,114 @@ end
register_crystal_grass_decoration(-0.03, 0.09, 3)
register_crystal_grass_decoration(-0.015, 0.075, 2)
register_crystal_grass_decoration(0, 0.06, 1)
--
-- On Generated
--
local chance = 20
local disp = 16
local schem = minetest.get_modpath('everness') .. '/schematics/everness_quartz_temple.mts'
local size = { x = 16, y = 13, z = 16 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local y_dis = 1
local c_dirt_with_crystal_grass = minetest.get_content_id('everness:dirt_with_crystal_grass')
local biome_id_everness_crystal_forest = minetest.get_biome_id('everness:crystal_forest')
Everness:add_to_queue_on_generated({
name = 'everness:crystal_forest',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_crystal_forest) ~= -1
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
local sidelength = maxp.x - minp.x + 1
local x_disp = rand:next(0, disp)
local z_disp = rand:next(0, disp)
shared_args.schem_positions = {}
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] == minetest.CONTENT_AIR
and data[vi] == c_dirt_with_crystal_grass
and rand:next(0, 100) < chance
then
local s_pos = area:position(vi)
--
-- Quartz Temple
--
-- add Y displacement
local schem_pos = vector.new(s_pos.x, s_pos.y - y_dis, s_pos.z)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:dirt_with_crystal_grass'
}
)
if #positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air'
}
)
if #air_positions > (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'
)
shared_args.schem_positions.everness_quartz_temple = shared_args.schem_positions.everness_quartz_temple or {}
table.insert(shared_args.schem_positions.everness_quartz_temple, {
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] Quartz Temple was placed at ' .. schem_pos:to_string())
end
end
end
end,
after_write_to_map = function(shared_args)
local schem_positions = shared_args.schem_positions or {}
for name, tbl in pairs(schem_positions) do
if next(tbl) then
for i, v in ipairs(tbl) do
local chest_positions = minetest.find_nodes_in_area(
v.minp,
v.maxp,
{ 'everness:chest' }
)
if #chest_positions > 0 then
Everness:populate_loot_chests(chest_positions)
end
end
end
end
end
})

View File

@ -190,39 +190,38 @@ local c_everness_crystal_forest_deep_ocean_coral_3 = minetest.get_content_id('ev
-- Biome IDs
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
-- mapchunks, therefore minimising memory use.
local data = {}
local chance = 25
local chance = 30
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 = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
minetest.register_on_generated(function(minp, maxp, blockseed)
local rand = PcgRandom(blockseed)
local biomemap = minetest.get_mapgen_object('biomemap')
local schem_positions = {}
Everness:add_to_queue_on_generated({
name = 'everness:crystal_forest_deep_ocean',
can_run = function(biomemap)
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
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
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)
if rand:next(0, 100) < chance then
for y = maxp.y, minp.y, -1 do
if schem_placed then
break
end
for z = minp.z, maxp.z do
if schem_placed then
break
end
for x = minp.x, maxp.x do
local vi = area:index(x, y, z)
if
data[vi] == c_everness_crystal_forest_deep_ocean_sand
and data[vi + area.ystride] == c_water_source
and not schem_placed
then
local s_pos = area:position(vi)
@ -278,32 +277,27 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
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,
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)
})
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
vm:set_lighting({ day = 0, night = 0 }, minp, maxp)
-- 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()
minetest.fix_light(minp, maxp)
break
end
end
end
end
end
end
end,
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
if next(tbl) then
for i, v in ipairs(tbl) do
@ -320,4 +314,4 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end
end
end
end)
})

View File

@ -139,3 +139,199 @@ Everness:register_decoration({
flags = 'place_center_x, place_center_z',
rotation = 'random',
})
--
-- On Generated
--
local chance = 20
local chance_water = 10
local disp = 16
local water_level = tonumber(minetest.settings:get('water_level')) or 1
local schem = minetest.read_schematic(minetest.get_modpath('everness') .. '/schematics/everness_quartz_fountain.mts', {})
local size = { x = 11, y = 10, z = 11 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local y_dis = 1
local schem_shrine = minetest.read_schematic(minetest.get_modpath('everness') .. '/schematics/everness_crystal_forest_ocean_shrine.mts', {})
local size_shrine = { x = 13, y = 16, z = 13 }
local size_x_shrine = math.round(size.x / 2)
local size_z_shrine = math.round(size.z / 2)
local y_dis_shrine = 8
local c_everness_crystal_sand = minetest.get_content_id('everness:crystal_sand')
local c_water_source = minetest.get_content_id('mapgen_water_source')
local biome_id_everness_crystal_forest_dunes = minetest.get_biome_id('everness:crystal_forest_dunes')
Everness:add_to_queue_on_generated({
name = 'everness:crystal_forest_dunes',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_crystal_forest_dunes) ~= -1
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
local sidelength = maxp.x - minp.x + 1
local x_disp = rand:next(0, disp)
local z_disp = rand:next(0, disp)
shared_args.schem_positions = {}
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] == minetest.CONTENT_AIR then
local s_pos = area:position(vi)
if
data[vi] == c_everness_crystal_sand
and rand:next(0, 100) < chance
then
--
-- Quartz Fountain
--
-- add Y displacement
local schem_pos = vector.new(s_pos.x, s_pos.y - y_dis, s_pos.z)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:crystal_sand'
}
)
if #positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air'
}
)
local replacements
if rand:next(0, 100) < 50 then
replacements = {
['everness:chest'] = 'everness:quartz_pillar'
}
end
if #air_positions > (size.x * size.y * size.z) / 2 then
minetest.place_schematic_on_vmanip(
vm,
schem_pos,
schem,
'random',
replacements,
true,
'place_center_x, place_center_z'
)
shared_args.schem_positions.everness_quartz_fountain = shared_args.schem_positions.everness_quartz_fountain or {}
table.insert(shared_args.schem_positions.everness_quartz_fountain, {
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] Quartz Fountain was placed at ' .. schem_pos:to_string())
end
end
if data[vi] == c_water_source
and rand:next(0, 100) < chance_water
-- Water Level
and water_level >= minp.y
and water_level <= maxp.y
then
--
-- Crystal Forest Ocean Shrine
--
-- add Y displacement
local schem_pos = vector.new(s_pos.x, s_pos.y - y_dis_shrine, s_pos.z)
-- find floor big enough
local indexes = Everness.find_content_in_vm_area(
vector.new(s_pos.x - size_x_shrine, s_pos.y - 1, s_pos.z - size_z_shrine),
vector.new(s_pos.x + size_x_shrine, s_pos.y + 1, s_pos.z + size_z_shrine),
{
c_water_source,
minetest.CONTENT_AIR
},
data,
area
)
if #indexes < size_shrine.x * size_shrine.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_shrine, s_pos.y, s_pos.z - size_z_shrine),
vector.new(s_pos.x + size_x_shrine, s_pos.y + size_shrine.y, s_pos.z + size_z_shrine),
{
c_water_source,
minetest.CONTENT_AIR
},
data,
area
)
if #space_indexes > (size_shrine.x * size_shrine.y * size_shrine.z) / 2 then
minetest.place_schematic_on_vmanip(
vm,
schem_pos,
schem_shrine,
'random',
nil,
true,
'place_center_x, place_center_z'
)
shared_args.schem_positions.everness_crystal_forest_ocean_shrine = shared_args.schem_positions.everness_crystal_forest_ocean_shrine or {}
table.insert(shared_args.schem_positions.everness_crystal_forest_ocean_shrine, {
pos = schem_pos,
minp = vector.new(s_pos.x - size_x_shrine, s_pos.y - y_dis_shrine, s_pos.z - size_z_shrine),
maxp = vector.new(s_pos.x + size_x_shrine, s_pos.y - y_dis_shrine + size_shrine.y, s_pos.z + size_z_shrine)
})
minetest.log('action', '[Everness] Crystal Forest Ocean Shrine was placed at ' .. schem_pos:to_string())
end
end
end
end
end,
after_write_to_map = function(shared_args)
local schem_positions = shared_args.schem_positions or {}
for name, tbl in pairs(schem_positions) do
if next(tbl) then
for i, v in ipairs(tbl) do
local chest_positions = minetest.find_nodes_in_area(
v.minp,
v.maxp,
{ 'everness:chest' }
)
if #chest_positions > 0 then
Everness:populate_loot_chests(chest_positions)
end
end
end
end
end
})

View File

@ -222,6 +222,8 @@ Everness:register_decoration({
-- 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_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
})
minetest.register_on_generated(function(minp, maxp, blockseed)
local rand = PcgRandom(blockseed)
-- Load the voxelmanip with the result of engine mapgen
local vm = minetest.get_mapgen_object('voxelmanip')
-- Returns a table mapping requested generation notification types to arrays of positions at which the corresponding generated structures are located within the current chunk
local gennotify = minetest.get_mapgen_object('gennotify')
Everness:add_to_queue_on_generated({
name = 'everness:crystal_forest_under',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_crystal_forest_under) ~= -1
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
--
-- 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())
end
end
end)
end
})

View File

@ -311,3 +311,114 @@ Everness:register_decoration({
schematic = minetest.get_modpath('everness') .. '/schematics/everness_cursed_bush.mts',
flags = 'place_center_x, place_center_z',
})
--
-- On Generated
--
local chance = 20
local disp = 16
local schem = minetest.get_modpath('everness') .. '/schematics/everness_haunted_house.mts'
local size = { x = 11, y = 22, z = 10 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local y_dis = 1
local c_dirt_with_cursed_grass = minetest.get_content_id('everness:dirt_with_cursed_grass')
local biome_id_everness_cursed_lands = minetest.get_biome_id('everness:cursed_lands')
Everness:add_to_queue_on_generated({
name = 'everness:cursed_lands',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_cursed_lands) ~= -1
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
local sidelength = maxp.x - minp.x + 1
local x_disp = rand:next(0, disp)
local z_disp = rand:next(0, disp)
shared_args.schem_positions = {}
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] == minetest.CONTENT_AIR
and data[vi] == c_dirt_with_cursed_grass
and rand:next(0, 100) < chance
then
local s_pos = area:position(vi)
--
-- Haunted House
--
-- add Y displacement
local schem_pos = vector.new(s_pos.x, s_pos.y - y_dis, s_pos.z)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:dirt_with_cursed_grass'
}
)
if #positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air'
}
)
if #air_positions > (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'
)
shared_args.schem_positions.everness_haunted_house = shared_args.schem_positions.everness_haunted_house or {}
table.insert(shared_args.schem_positions.everness_haunted_house, {
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] Haunted House was placed at ' .. schem_pos:to_string())
end
end
end
end,
after_write_to_map = function(shared_args)
local schem_positions = shared_args.schem_positions or {}
for name, tbl in pairs(schem_positions) do
if next(tbl) then
for i, v in ipairs(tbl) do
local chest_positions = minetest.find_nodes_in_area(
v.minp,
v.maxp,
{ 'everness:chest' }
)
if #chest_positions > 0 then
Everness:populate_loot_chests(chest_positions)
end
end
end
end
end
})

View File

@ -190,39 +190,38 @@ local c_everness_cursed_lands_deep_ocean_coral_octocurse = minetest.get_content_
-- Biome IDs
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
-- mapchunks, therefore minimising memory use.
local data = {}
local chance = 25
local chance = 30
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 = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
minetest.register_on_generated(function(minp, maxp, blockseed)
local rand = PcgRandom(blockseed)
local biomemap = minetest.get_mapgen_object('biomemap')
local schem_positions = {}
Everness:add_to_queue_on_generated({
name = 'everness:cursed_lands_deep_ocean',
can_run = function(biomemap)
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
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
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)
if rand:next(0, 100) < chance then
for y = maxp.y, minp.y, -1 do
if schem_placed then
break
end
for z = minp.z, maxp.z do
if schem_placed then
break
end
for x = minp.x, maxp.x do
local vi = area:index(x, y, z)
if
data[vi] == c_everness_cursed_lands_deep_ocean_sand
and data[vi + area.ystride] == c_water_source
and not schem_placed
then
local s_pos = area:position(vi)
@ -278,32 +277,27 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
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,
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)
})
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
vm:set_lighting({ day = 0, night = 0 }, minp, maxp)
-- 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()
minetest.fix_light(minp, maxp)
break
end
end
end
end
end
end
end,
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
if next(tbl) then
for i, v in ipairs(tbl) do
@ -320,4 +314,4 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end
end
end
end)
})

View File

@ -161,3 +161,188 @@ Everness:register_decoration({
flags = 'place_center_x, place_center_z',
rotation = 'random',
})
--
-- On Generated
--
local chance = 30
local chance_water = 10
local disp = 16
local water_level = tonumber(minetest.settings:get('water_level')) or 1
local schem_cursed_cabin = minetest.get_modpath('everness') .. '/schematics/everness_cursed_cabin.mts'
local size = { x = 7, y = 7, z = 12 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local schem_ocean_island = minetest.get_modpath('everness') .. '/schematics/everness_cursed_lands_deep_ocean_island.mts'
local size_ocean_island = { x = 25, y = 23, z = 23 }
local size_x_ocean_island = math.round(size.x / 2)
local size_z_ocean_island = math.round(size.z / 2)
local y_dis_ocean_island = 7
local c_cursed_sand = minetest.get_content_id('everness:cursed_sand')
local c_water_source = minetest.get_content_id('mapgen_water_source')
local biome_id_everness_cursed_lands_dunes = minetest.get_biome_id('everness:cursed_lands_dunes')
Everness:add_to_queue_on_generated({
name = 'everness:cursed_lands_dunes',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_cursed_lands_dunes) ~= -1
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
local sidelength = maxp.x - minp.x + 1
local x_disp = rand:next(0, disp)
local z_disp = rand:next(0, disp)
shared_args.schem_positions = {}
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] == minetest.CONTENT_AIR then
local s_pos = area:position(vi)
if data[vi] == c_cursed_sand
and rand:next(0, 100) < chance
then
--
-- Cursed Cabin
--
-- add Y displacement
local schem_pos = vector.new(s_pos.x, s_pos.y, s_pos.z)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:cursed_sand'
}
)
if #positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air'
}
)
if #air_positions > (size.x * size.y * size.z) / 2 then
minetest.place_schematic_on_vmanip(
vm,
schem_pos,
schem_cursed_cabin,
'random',
nil,
true,
'place_center_x, place_center_z'
)
shared_args.schem_positions.everness_cursed_cabin = shared_args.schem_positions.everness_cursed_cabin or {}
table.insert(shared_args.schem_positions.everness_cursed_cabin, {
pos = schem_pos,
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)
})
minetest.log('action', '[Everness] Cursed Cabin was placed at ' .. schem_pos:to_string())
end
end
if data[vi] == c_water_source
and rand:next(0, 100) < chance_water
-- Water Level
and water_level >= minp.y
and water_level <= maxp.y
then
--
-- Cursed Lands Deep Ocean Island
--
local schem_pos = vector.new(s_pos.x, s_pos.y - y_dis_ocean_island, s_pos.z)
-- find floor big enough
local indexes = Everness.find_content_in_vm_area(
vector.new(s_pos.x - size_x_ocean_island, s_pos.y - 1, s_pos.z - size_z),
vector.new(s_pos.x + size_x_ocean_island, s_pos.y + 1, s_pos.z + size_z),
{
c_water_source,
minetest.CONTENT_AIR
},
data,
area
)
if #indexes < size_ocean_island.x * size_ocean_island.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_ocean_island, s_pos.y, s_pos.z - size_z_ocean_island),
vector.new(s_pos.x + size_x_ocean_island, s_pos.y + size_ocean_island.y, s_pos.z + size_z_ocean_island),
{
c_water_source,
minetest.CONTENT_AIR
},
data,
area
)
if #space_indexes > (size_ocean_island.x * size_ocean_island.y * size_ocean_island.z) / 2 then
minetest.place_schematic_on_vmanip(
vm,
schem_pos,
schem_ocean_island,
'random',
nil,
true,
'place_center_x, place_center_z'
)
shared_args.schem_positions.everness_cursed_lands_deep_ocean_island = shared_args.schem_positions.everness_cursed_lands_deep_ocean_island or {}
table.insert(shared_args.schem_positions.everness_cursed_lands_deep_ocean_island, {
pos = schem_pos,
minp = vector.new(s_pos.x - size_x_ocean_island, s_pos.y - y_dis_ocean_island, s_pos.z - size_z_ocean_island),
maxp = vector.new(s_pos.x + size_x_ocean_island, s_pos.y - y_dis_ocean_island + size_ocean_island.y, s_pos.z + size_z_ocean_island)
})
minetest.log('action', '[Everness] Cursed Lands Deep Ocean Island was placed at ' .. schem_pos:to_string())
end
end
end
end
end,
after_write_to_map = function(shared_args)
local schem_positions = shared_args.schem_positions or {}
for name, tbl in pairs(schem_positions) do
if next(tbl) then
for i, v in ipairs(tbl) do
local chest_positions = minetest.find_nodes_in_area(
v.minp,
v.maxp,
{ 'everness:chest' }
)
if #chest_positions > 0 then
Everness:populate_loot_chests(chest_positions)
end
end
end
end
end
})

View File

@ -177,3 +177,117 @@ Everness:register_decoration({
y_min = y_max,
schematic = minetest.get_modpath('everness') .. '/schematics/everness_marsh_grass.mts',
})
--
-- On Generated
--
local chance = 30
local disp = 16
local schem = minetest.get_modpath('everness') .. '/schematics/everness_cursed_cabin.mts'
local size = { x = 7, y = 7, z = 12 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local y_dis = -1
local c_cursed_stone = minetest.get_content_id('everness:cursed_stone')
local c_water_source = minetest.get_content_id('mapgen_water_source')
local biome_id_everness_cursed_lands_swamp = minetest.get_biome_id('everness:cursed_lands_swamp')
Everness:add_to_queue_on_generated({
name = 'everness:cursed_lands_swamp',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_cursed_lands_swamp) ~= -1
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
local sidelength = maxp.x - minp.x + 1
local x_disp = rand:next(0, disp)
local z_disp = rand:next(0, disp)
shared_args.schem_positions = {}
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_water_source
and data[vi] == c_cursed_stone
and rand:next(0, 100) < chance
then
local s_pos = area:position(vi)
--
-- Cursed Cabin
--
-- add Y displacement
local schem_pos = vector.new(s_pos.x, s_pos.y - y_dis, s_pos.z)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:cursed_stone',
'mapgen_water_source'
}
)
if #positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air',
'mapgen_water_source'
}
)
if #air_positions > (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'
)
shared_args.schem_positions.everness_cursed_cabin = shared_args.schem_positions.everness_cursed_cabin or {}
table.insert(shared_args.schem_positions.everness_cursed_cabin, {
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 Cabin was placed at ' .. schem_pos:to_string())
end
end
end
end,
after_write_to_map = function(shared_args)
local schem_positions = shared_args.schem_positions or {}
for name, tbl in pairs(schem_positions) do
if next(tbl) then
for i, v in ipairs(tbl) do
local chest_positions = minetest.find_nodes_in_area(
v.minp,
v.maxp,
{ 'everness:chest' }
)
if #chest_positions > 0 then
Everness:populate_loot_chests(chest_positions)
end
end
end
end
end
})

View File

@ -219,6 +219,8 @@ Everness:register_decoration({
-- 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 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.register_on_generated(function(minp, maxp, blockseed)
-- Load the voxelmanip with the result of engine mapgen
local vm = minetest.get_mapgen_object('voxelmanip')
-- Returns a table mapping requested generation notification types to arrays of positions at which the corresponding generated structures are located within the current chunk
local gennotify = minetest.get_mapgen_object('gennotify')
Everness:add_to_queue_on_generated({
name = 'everness:cursed_lands_under',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_cursed_lands_under) ~= -1
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
--
-- 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())
end
end
end)
end
})

View File

@ -193,3 +193,112 @@ Everness:register_decoration({
flags = 'place_center_x, place_center_z',
rotation = 'random',
})
--
-- On Generated
--
local chance = 20
local disp = 16
local schem = minetest.get_modpath('everness') .. '/schematics/everness_forsaken_desert_temple.mts'
local size = { x = 9, y = 16, z = 9 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local c_forsaken_desert_sand = minetest.get_content_id('everness:forsaken_desert_sand')
local biome_id_everness_forsaken_desert = minetest.get_biome_id('everness:forsaken_desert')
Everness:add_to_queue_on_generated({
name = 'everness:forsaken_desert',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_forsaken_desert) ~= -1
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
local sidelength = maxp.x - minp.x + 1
local x_disp = rand:next(0, disp)
local z_disp = rand:next(0, disp)
shared_args.schem_positions = {}
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] == minetest.CONTENT_AIR
and data[vi] == c_forsaken_desert_sand
and rand:next(0, 100) < chance
then
local s_pos = area:position(vi)
--
-- Forsaken Desert Temple
--
local schem_pos = vector.new(s_pos.x, s_pos.y, s_pos.z)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:forsaken_desert_sand'
}
)
if #positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air'
}
)
if #air_positions > (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'
)
shared_args.schem_positions.everness_forsaken_desert_temple = shared_args.schem_positions.everness_forsaken_desert_temple or {}
table.insert(shared_args.schem_positions.everness_forsaken_desert_temple, {
pos = schem_pos,
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)
})
minetest.log('action', '[Everness] Forsaken Desert Temple was placed at ' .. schem_pos:to_string())
end
end
end
end,
after_write_to_map = function(shared_args)
local schem_positions = shared_args.schem_positions or {}
for name, tbl in pairs(schem_positions) do
if next(tbl) then
for i, v in ipairs(tbl) do
local chest_positions = minetest.find_nodes_in_area(
v.minp,
v.maxp,
{ 'everness:chest' }
)
if #chest_positions > 0 then
Everness:populate_loot_chests(chest_positions)
end
end
end
end
end
})

View File

@ -45,5 +45,111 @@ Everness:register_biome({
})
--
-- Register decorations
-- On Generated
--
local chance = 20
local disp = 16
local schem = minetest.get_modpath('everness') .. '/schematics/everness_forsaken_desert_temple_3.mts'
local size = { x = 11, y = 13, z = 13 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local y_dis = -1
local c_dry_ocean_dirt = minetest.get_content_id('everness:dry_ocean_dirt')
local biome_id_everness_forsaken_desert_ocean = minetest.get_biome_id('everness:forsaken_desert_ocean')
Everness:add_to_queue_on_generated({
name = 'everness:forsaken_desert_ocean',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_forsaken_desert_ocean) ~= -1
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
local sidelength = maxp.x - minp.x + 1
local x_disp = rand:next(0, disp)
local z_disp = rand:next(0, disp)
shared_args.schem_positions = {}
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] == minetest.CONTENT_AIR
and data[vi] == c_dry_ocean_dirt
and rand:next(0, 100) < chance
then
local s_pos = area:position(vi)
--
-- Forsaken Desert Temple 3
--
local schem_pos = vector.new(s_pos.x, s_pos.y - y_dis, s_pos.z)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:dry_ocean_dirt'
}
)
if #positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air'
}
)
if #air_positions > (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'
)
shared_args.schem_positions.everness_forsaken_desert_temple_3 = shared_args.schem_positions.everness_forsaken_desert_temple_3 or {}
table.insert(shared_args.schem_positions.everness_forsaken_desert_temple_3, {
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] Forsaken Desert Temple 3 was placed at ' .. schem_pos:to_string())
end
end
end
end,
after_write_to_map = function(shared_args)
local schem_positions = shared_args.schem_positions or {}
for name, tbl in pairs(schem_positions) do
if next(tbl) then
for i, v in ipairs(tbl) do
local chest_positions = minetest.find_nodes_in_area(
v.minp,
v.maxp,
{ 'everness:chest' }
)
if #chest_positions > 0 then
Everness:populate_loot_chests(chest_positions)
end
end
end
end
end
})

View File

@ -193,3 +193,138 @@ Everness:register_decoration({
height_max = 7,
flags = 'all_floors'
})
--
-- On Generated
--
local disp = 16
local chance = 20
local schem = minetest.get_modpath('everness') .. '/schematics/everness_forsaken_desert_temple_2.mts'
local size = { x = 16, y = 17, z = 15 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local c_forsaken_desert_sand = minetest.get_content_id('everness:forsaken_desert_sand')
local c_forsaken_desert_chiseled_stone = minetest.get_content_id('everness:forsaken_desert_chiseled_stone')
local c_forsaken_desert_brick = minetest.get_content_id('everness:forsaken_desert_brick')
local c_forsaken_desert_engraved_stone = minetest.get_content_id('everness:forsaken_desert_engraved_stone')
local biome_id_everness_forsaken_desert_under = minetest.get_biome_id('everness:forsaken_desert_under')
Everness:add_to_queue_on_generated({
name = 'everness:forsaken_desert_under',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_forsaken_desert_under) ~= -1
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
local sidelength = maxp.x - minp.x + 1
local x_disp = rand:next(0, disp)
local z_disp = rand:next(0, disp)
shared_args.schem_positions = {}
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] == c_forsaken_desert_sand
or data[vi] == c_forsaken_desert_chiseled_stone
or data[vi] == c_forsaken_desert_brick
or data[vi] == c_forsaken_desert_engraved_stone
)
and rand:next(0, 100) < chance
then
local s_pos = area:position(vi)
--
-- Forsaken Desert Temple 2
--
local schem_pos = vector.new(s_pos.x, s_pos.y, s_pos.z)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:forsaken_desert_sand',
'everness:forsaken_desert_chiseled_stone',
'everness:forsaken_desert_brick',
'everness:forsaken_desert_engraved_stone',
'group:stone',
'group:sand',
'group:everness_sand',
'default:gravel',
'default:stone_with_coal',
'default:stone_with_iron',
'default:stone_with_tin',
'default:stone_with_gold',
'default:stone_with_mese',
'default:stone_with_diamond',
'everness:cave_barrel_cactus',
'everness:venus_trap',
'group:flora',
'everness:quartz_ore',
'everness:stone_with_pyrite',
}
)
if #positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air'
}
)
if #air_positions > (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'
)
shared_args.schem_positions.everness_forsaken_desert_temple_2 = shared_args.schem_positions.everness_forsaken_desert_temple_2 or {}
table.insert(shared_args.schem_positions.everness_forsaken_desert_temple_2, {
pos = schem_pos,
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)
})
minetest.log('action', '[Everness] Forsaken Desert Temple 2 was placed at ' .. schem_pos:to_string())
end
end
end
end,
after_write_to_map = function(shared_args)
local schem_positions = shared_args.schem_positions or {}
for name, tbl in pairs(schem_positions) do
if next(tbl) then
for i, v in ipairs(tbl) do
local chest_positions = minetest.find_nodes_in_area(
v.minp,
v.maxp,
{ 'everness:chest' }
)
if #chest_positions > 0 then
Everness:populate_loot_chests(chest_positions)
end
end
end
end
end
})

View File

@ -246,3 +246,123 @@ Everness:register_decoration({
decoration = 'everness:bloodspore_plant',
param2 = 8,
})
--
-- On Generated
--
local chance = 20
local disp = 16
local schem = minetest.read_schematic(minetest.get_modpath('everness') .. '/schematics/everness_jungle_temple.mts', {})
local size = { x = 12, y = 14, z = 15 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local y_dis = 3
local c_everness_forsaken_tundra_dirt = minetest.get_content_id('everness:forsaken_tundra_dirt')
local c_everness_forsaken_tundra_dirt_with_grass = minetest.get_content_id('everness:forsaken_tundra_dirt_with_grass')
local c_everness_volcanic_sulfur = minetest.get_content_id('everness:volcanic_sulfur')
local biome_id_everness_forsaken_tundra = minetest.get_biome_id('everness:forsaken_tundra')
Everness:add_to_queue_on_generated({
name = 'everness:forsaken_tundra',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_forsaken_tundra) ~= -1
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
local sidelength = maxp.x - minp.x + 1
local x_disp = rand:next(0, disp)
local z_disp = rand:next(0, disp)
shared_args.schem_positions = {}
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] == minetest.CONTENT_AIR
and (
data[vi] == c_everness_forsaken_tundra_dirt
or data[vi] == c_everness_forsaken_tundra_dirt_with_grass
or data[vi] == c_everness_volcanic_sulfur
)
and rand:next(0, 100) < chance
then
local s_pos = area:position(vi)
--
-- Jungle Temple
--
-- add Y displacement
local schem_pos = vector.new(s_pos.x, s_pos.y - y_dis, s_pos.z)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:forsaken_tundra_dirt',
'everness:forsaken_tundra_dirt_with_grass',
'everness:volcanic_sulfur'
}
)
if #positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air'
}
)
if #air_positions > (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'
)
shared_args.schem_positions.everness_jungle_temple = shared_args.schem_positions.everness_jungle_temple or {}
table.insert(shared_args.schem_positions.everness_jungle_temple, {
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] Jungle Temple was placed at ' .. schem_pos:to_string())
end
end
end
end,
after_write_to_map = function(shared_args)
local schem_positions = shared_args.schem_positions or {}
for name, tbl in pairs(schem_positions) do
if next(tbl) then
for i, v in ipairs(tbl) do
local chest_positions = minetest.find_nodes_in_area(
v.minp,
v.maxp,
{ 'everness:chest' }
)
if #chest_positions > 0 then
Everness:populate_loot_chests(chest_positions)
end
end
end
end
end
})

View File

@ -155,6 +155,33 @@ Everness:register_decoration({
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({
name = 'everness:forsaken_tundra_under_bloodspore_plant_small',
deco_type = 'simple',
@ -250,84 +277,95 @@ register_agave_leaf_decoration(0, 0.06, 1)
-- On Generated
--
local c_air = minetest.get_content_id('air')
local c_mold_stone_with_moss = minetest.get_content_id('everness:mold_stone_with_moss')
local biome_id_everness_forsaken_tundra_under = minetest.get_biome_id('everness:forsaken_tundra_under')
-- Localize data buffer table outside the loop, to be re-used for all
-- 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
local deco_id_everness_forsaken_tundra_under_willow_tree = minetest.get_decoration_id('everness:forsaken_tundra_under_willow_tree')
-- 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 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)
local rand = PcgRandom(blockseed)
minetest.set_gen_notify({ decoration = true }, { deco_id_everness_forsaken_tundra_under_willow_tree })
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
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)
local sidelength = maxp.x - minp.x + 1
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
Everness:add_to_queue_on_generated({
name = 'everness:forsaken_tundra_under',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_forsaken_tundra_under) ~= -1
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
--
-- Willow Tree
--
local schem_pos = vector.new(s_pos.x, s_pos.y, s_pos.z)
local air_positions = minetest.find_nodes_in_area(
vector.new(s_pos.x - 19, s_pos.y, s_pos.z - 19),
vector.new(s_pos.x + 19, s_pos.y + 28, s_pos.z + 19),
{'air'},
for _, pos in ipairs(gennotify['decoration#' .. (deco_id_everness_forsaken_tundra_under_willow_tree or '')] or {}) do
-- `pos` is position of the 'place_on' node
local marker_pos = vector.new(pos.x, pos.y + 1, pos.z)
local marker_node = minetest.get_node(marker_pos)
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
)
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(
vm,
schem_pos,
vector.new(marker_pos.x, marker_pos.y - y_dis, marker_pos.z),
willow_tree_schem,
rotation,
'random',
nil,
true,
'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)
})

View File

@ -120,3 +120,119 @@ Everness:register_decoration({
spawn_by = 'everness:frosted_snowblock',
num_spawn_by = 8,
})
--
-- On Generated
--
local chance = 20
local disp = 16
local schem = minetest.read_schematic(minetest.get_modpath('everness') .. '/schematics/everness_frosted_icesheet_igloo.mts', {})
local size = { x = 16, y = 13, z = 16 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local y_dis = 8
local c_frosted_snowblock = minetest.get_content_id('everness:frosted_snowblock')
local c_frosted_ice = minetest.get_content_id('everness:frosted_ice')
local biome_id_everness_frosted_icesheet = minetest.get_biome_id('everness:frosted_icesheet')
Everness:add_to_queue_on_generated({
name = 'everness:frosted_icesheet',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_frosted_icesheet) ~= -1
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
local sidelength = maxp.x - minp.x + 1
local x_disp = rand:next(0, disp)
local z_disp = rand:next(0, disp)
shared_args.schem_positions = {}
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] == minetest.CONTENT_AIR
and (
data[vi] == c_frosted_snowblock
or data[vi] == c_frosted_ice
)
and rand:next(0, 100) < chance
then
local s_pos = area:position(vi)
--
-- Igloo
--
-- add Y displacement
local schem_pos = vector.new(s_pos.x, s_pos.y - y_dis, s_pos.z)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:frosted_snowblock',
'everness:frosted_ice'
}
)
if #positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air'
}
)
if #air_positions > (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'
)
shared_args.schem_positions.everness_frosted_icesheet_igloo = shared_args.schem_positions.everness_frosted_icesheet_igloo or {}
table.insert(shared_args.schem_positions.everness_frosted_icesheet_igloo, {
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] Igloo was placed at ' .. schem_pos:to_string())
end
end
end
end,
after_write_to_map = function(shared_args)
local schem_positions = shared_args.schem_positions or {}
for name, tbl in pairs(schem_positions) do
if next(tbl) then
for i, v in ipairs(tbl) do
local chest_positions = minetest.find_nodes_in_area(
v.minp,
v.maxp,
{ 'everness:chest' }
)
if #chest_positions > 0 then
Everness:populate_loot_chests(chest_positions)
end
end
end
end
end
})

View File

@ -313,9 +313,18 @@ Everness:register_decoration({
-- 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_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(
{ decoration = true },
{
@ -324,15 +333,12 @@ minetest.set_gen_notify(
}
)
minetest.register_on_generated(function(minp, maxp, blockseed)
local gennotify = minetest.get_mapgen_object('gennotify')
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)
Everness:add_to_queue_on_generated({
name = 'everness:frosted_icesheet_under',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_frosted_icesheet_under) ~= -1
end,
after_write_to_map = function(shared_args, gennotify)
--
-- Frosted Large Icicle Ceiling
--
@ -395,4 +401,5 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end
end
end
end)
end
})

View File

@ -239,6 +239,13 @@ local c_water_weeds = {
c_everness_mineral_water_weed_2
}
local chance = 20
local disp = 16
local schem = minetest.get_modpath('everness') .. '/schematics/everness_mineral_waters_tower.mts'
local size = { x = 7, y = 16, z = 9 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local function find_irecursive(table, c_id)
local found = false
@ -294,11 +301,6 @@ local function place_decoration(pos, vm, area, data, deco_id, callback)
end
end
-- Localize data buffer table outside the loop, to be re-used for all
-- mapchunks, therefore minimising memory use
local data = {}
local p2data = {}
minetest.set_gen_notify({ decoration = true }, {
d_everness_palm_trees,
d_everness_water_geyser,
@ -306,29 +308,14 @@ minetest.set_gen_notify({ decoration = true }, {
d_rose_bush
})
-- 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()
-- 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')
local chest_positions = {}
-- Above sea level
if maxp.y >= y_min and table.indexof(biomemap, biome_id_everness_mineral_waters) ~= -1 then
local rand = PcgRandom(blockseed)
Everness:add_to_queue_on_generated({
name = 'everness:mineral_waters',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_mineral_waters) ~= -1
end,
on_data = function(minp, maxp, area, data, p2data, gennotify, rand, shared_args)
local rand_version = rand:next(1, 2)
-- Load the voxelmanip with the result of engine mapgen
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
-- Returns a table mapping requested generation notification types to arrays of positions at which the corresponding generated structures are located within the current chunk
local gennotify = minetest.get_mapgen_object('gennotify')
-- '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)
vm:get_param2_data(p2data)
local chest_positions = {}
local pot_pos = {}
if rand_version == 1 then
@ -564,6 +551,7 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end
-- Place decorations after generating (2nd pass)
-- luacheck: ignore 512
for y = minp.y, maxp.y do
for z = minp.z, maxp.z do
for x = minp.x, maxp.x do
@ -605,14 +593,14 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
for j = -radius, radius do
local idx = ai + i + (area.zstride * j) + area.ystride
local distance = math.round(vector.distance(area:position(ai), area:position(idx)))
local chance = math.round(chance_max / distance)
local chance_lotus_leaf = math.round(chance_max / distance)
if chance > chance_max then
chance = chance_max
if chance_lotus_leaf > chance_max then
chance_lotus_leaf = chance_max
end
if
rand:next(0, 100) < chance
rand:next(0, 100) < chance_lotus_leaf
and data[idx] == minetest.CONTENT_AIR
and data[idx - area.ystride] == c_everness_mineral_water_source
then
@ -721,12 +709,84 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end
end
vm:set_data(data)
vm:set_param2_data(p2data)
-- Set `shared_args`
shared_args.chest_positions = chest_positions
shared_args.pot_pos = pot_pos
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
local sidelength = maxp.x - minp.x + 1
local x_disp = rand:next(0, disp)
local z_disp = rand:next(0, disp)
shared_args.schem_positions = {}
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] == minetest.CONTENT_AIR
and (
data[vi] == c_everness_mineral_water_source
or data[vi] == c_everness_mineral_sand
)
and rand:next(0, 100) < chance
then
local s_pos = area:position(vi)
--
-- Mineral Waters Tower
--
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
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),
{
'everness:mineral_sand',
'everness:mineral_water_source'
}
)
if #positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_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),
{
'air'
}
)
if #air_positions > (size.x * size.y * size.z) / 2 then
minetest.place_schematic_on_vmanip(
vm,
s_pos,
schem,
'random',
nil,
true,
'place_center_x, place_center_z'
)
shared_args.schem_positions.everness_mineral_waters_tower = shared_args.schem_positions.everness_mineral_waters_tower or {}
table.insert(shared_args.schem_positions.everness_mineral_waters_tower, {
pos = s_pos,
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)
})
minetest.log('action', '[Everness] Mineral Waters Tower was placed at ' .. s_pos:to_string())
end
end
end
--
-- Place Decorations
--
local pot_pos = shared_args.pot_pos or {}
--
-- Palm Trees
@ -820,25 +880,32 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
inv:set_stack('main', 1, stack)
end
end
-- Set the lighting within the `VoxelManip` to a uniform value
vm:set_lighting({ day = 0, night = 0 }, minp, maxp)
-- 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,
after_write_to_map = function(shared_args)
-- Populate loot chest inventory
local chest_def = minetest.registered_nodes['everness:chest']
local chest_positions = shared_args.chest_positions or {}
if chest_def and next(chest_positions) then
if next(chest_positions) then
Everness:populate_loot_chests(chest_positions)
end
end
-- Print generation time of this mapchunk.
-- local chugent = math.ceil((os.clock() - t0) * 1000)
-- print('[lvm_example] Mapchunk generation time ' .. chugent .. ' ms')
end)
-- Populate loot chest inventory for schematics
local schem_positions = shared_args.schem_positions or {}
for name, tbl in pairs(schem_positions) do
if next(tbl) then
for i, v in ipairs(tbl) do
local chest_positions2 = minetest.find_nodes_in_area(
v.minp,
v.maxp,
{ 'everness:chest' }
)
if #chest_positions2 > 0 then
Everness:populate_loot_chests(chest_positions2)
end
end
end
end
end
})

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -71,6 +71,45 @@ stairs.register_stair_and_slab(
true
)
stairs.register_stair_and_slab(
'cursed_sandstone_block',
'everness:cursed_sandstone_block',
{ cracky = 2 },
{ 'everness_cursed_sandstone_block.png' },
'Cursed Sandstone Block Stair',
'Cursed Sandstone Block Slab',
Everness.node_sound_stone_defaults(),
true
)
stairs.register_stair_and_slab(
'cursed_sandstone_brick',
'everness:cursed_sandstone_brick',
{ cracky = 2 },
{ 'everness_cursed_sandstone_brick.png' },
'Cursed Sandstone Brick Stair',
'Cursed Sandstone Brick Slab',
Everness.node_sound_stone_defaults(),
true
)
stairs.register_stair_and_slab(
'cursed_stone_carved',
'everness:cursed_stone_carved',
{ cracky = 2 },
{
{
name = 'everness_cursed_stone_carved.png',
align_style = 'world',
scale = 2
}
},
'Cursed Stone Carved Stair',
'Cursed Stone Carved Slab',
Everness.node_sound_stone_defaults(),
true
)
-- Quartz
stairs.register_stair_and_slab(
@ -131,6 +170,17 @@ stairs.register_stair_and_slab(
true
)
stairs.register_stair_and_slab(
'dry_tree',
'everness:dry_tree',
{ choppy = 2, oddly_breakable_by_hand = 2, flammable = 2 },
{ 'everness_dry_tree_top.png', 'everness_dry_tree_top.png', 'everness_dry_tree.png' },
S('Dry Tree Trunk Stair'),
S('Dry Tree Trunk Slab'),
Everness.node_sound_wood_defaults(),
true
)
-- Coral Wood
stairs.register_stair_and_slab(
@ -203,6 +253,39 @@ stairs.register_stair_and_slab(
true
)
stairs.register_stair_and_slab(
'forsaken_desert_engraved_stone',
'everness:forsaken_desert_engraved_stone',
{ cracky = 2, stone = 1 },
{ 'everness_forsaken_desert_engraved_stone.png' },
S('Forsaken Desert Engraved Stone Stair'),
S('Forsaken Desert Engraved Stone Slab'),
Everness.node_sound_stone_defaults(),
true
)
stairs.register_stair_and_slab(
'forsaken_desert_cobble',
'everness:forsaken_desert_cobble',
{ cracky = 2, stone = 1 },
{ 'everness_forsaken_desert_cobble.png' },
S('Forsaken Desert Cobblestone Stair'),
S('Forsaken Desert Cobblestone Slab'),
Everness.node_sound_stone_defaults(),
true
)
stairs.register_stair_and_slab(
'forsaken_desert_cobble_red',
'everness:forsaken_desert_cobble_red',
{ cracky = 2, stone = 1 },
{ 'everness_forsaken_desert_cobble_red.png' },
S('Forsaken Desert Cobblestone Red Stair'),
S('Forsaken Desert Cobblestone Red Slab'),
Everness.node_sound_stone_defaults(),
true
)
-- Baobab Wood
stairs.register_stair_and_slab(

View File

@ -163,3 +163,85 @@ walls.register(
'everness:crystal_mossy_cobble',
Everness.node_sound_stone_defaults()
)
walls.register(
'everness:cursed_sandstone_brick_wall',
S('Cursed Sandstone Brick Wall'),
{ 'everness_cursed_sandstone_brick.png' },
'everness:cursed_sandstone_brick',
Everness.node_sound_stone_defaults()
)
walls.register(
'everness:cursed_sandstone_block_wall',
S('Cursed Sandstone Block Wall'),
{ 'everness_cursed_sandstone_block.png' },
'everness:cursed_sandstone_block',
Everness.node_sound_stone_defaults()
)
walls.register(
'everness:cursed_stone_carved_wall',
S('Cursed Stone Carved Wall'),
{
{
name = 'everness_cursed_stone_carved.png',
align_style = 'world',
scale = 2
}
},
'everness:cursed_stone_carved',
Everness.node_sound_stone_defaults()
)
walls.register(
'everness:forsaken_desert_cobble_wall',
S('Forsaken Desert Cobblestone Wall'),
{ 'everness_forsaken_desert_cobble.png' },
'everness:forsaken_desert_cobble',
Everness.node_sound_stone_defaults()
)
walls.register(
'everness:forsaken_desert_cobble_red_wall',
S('Forsaken Desert Cobblestone Red Wall'),
{ 'everness_forsaken_desert_cobble_red.png' },
'everness:forsaken_desert_cobble_red',
Everness.node_sound_stone_defaults()
)
walls.register(
'everness:forsaken_desert_brick_wall',
S('Forsaken Desert Brick Wall'),
{ 'everness_forsaken_desert_brick.png' },
'everness:forsaken_desert_brick',
Everness.node_sound_stone_defaults()
)
walls.register(
'everness:forsaken_desert_brick_red_wall',
S('Forsaken Desert Brick Red Wall'),
{ 'everness_forsaken_desert_brick_red.png' },
'everness:forsaken_desert_brick_red',
Everness.node_sound_stone_defaults()
)
walls.register(
'everness:forsaken_desert_chiseled_stone_wall',
S('Forsaken Desert Chiseled Stone'),
{
'everness_forsaken_desert_chiseled_stone_top.png',
'everness_forsaken_desert_chiseled_stone_bottom.png',
'everness_forsaken_desert_chiseled_stone_side.png'
},
'everness:forsaken_desert_chiseled_stone',
Everness.node_sound_stone_defaults()
)
walls.register(
'everness:forsaken_desert_engraved_stone_wall',
S('Forsaken Desert Engraved Stone Wall'),
{ 'everness_forsaken_desert_engraved_stone.png' },
'everness:forsaken_desert_engraved_stone',
Everness.node_sound_stone_defaults()
)