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

51
api.lua
View File

@ -236,7 +236,8 @@ Everness = {
registered_craftitems = {}, registered_craftitems = {},
registered_biomes = {}, registered_biomes = {},
registered_decorations = {}, registered_decorations = {},
registered_ores = {} registered_ores = {},
on_generated_queue = {}
} }
function Everness.grow_cactus(self, pos, node, params) 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) Everness.loot_chest.default = table.copy(loot_items)
end end
function Everness.populate_loot_chests(self, positions, loot_chest_items_group) function Everness.populate_loot_chests(self, positions, params)
local _loot_chest_items_group = loot_chest_items_group or 'default' local _params = params or {}
local _loot_chest_items_group = _params.loot_chest_items_group or 'default'
-- Get inventories -- Get inventories
local string_positions = ''; local string_positions = '';
local inventories = {} local inventories = {}
for i, pos in ipairs(positions) do for i, pos in ipairs(positions) do
local chest_def = minetest.registered_nodes['everness:chest']
chest_def.on_construct(pos)
local inv = minetest.get_inventory({ type = 'node', pos = pos }) 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)
inv = minetest.get_inventory({ type = 'node', pos = pos })
end
if inv then if inv then
table.insert(inventories, inv) table.insert(inventories, inv)
string_positions = string_positions .. ' ' .. pos:to_string() string_positions = string_positions .. ' ' .. pos:to_string()
else 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
end end
@ -2117,3 +2122,35 @@ function Everness.find_content_in_vm_area(minp, maxp, contentIds, data, area)
return indexes, id_count return indexes, id_count
end 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 -- Localize data buffer table outside the loop, to be re-used for all
-- mapchunks, therefore minimising memory use. -- mapchunks, therefore minimising memory use.
local data = {} local data = {}
local chance = 20 local p2data = {}
local chance_sea_level = 10
local disp = 16
local water_level = tonumber(minetest.settings:get('water_level')) or 1
minetest.register_on_generated(function(minp, maxp, blockseed) minetest.register_on_generated(function(minp, maxp, blockseed)
-- Start time of mapchunk generation.
-- local t0 = os.clock()
local rand = PcgRandom(blockseed) 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') 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 -- Load the voxelmanip with the result of engine mapgen
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip') local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
-- 'area' is used later to get the voxelmanip indexes for positions -- 'area' is used later to get the voxelmanip indexes for positions
@ -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. -- 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. -- Set the buffer parameter to use and reuse 'data' for this.
vm:get_data(data) vm:get_data(data)
-- Raw `param2` data read into the `VoxelManip` object
vm:get_param2_data(p2data)
-- Side length of mapchunk -- Side length of mapchunk
local sidelength = maxp.x - minp.x + 1 local shared_args = {}
local x_disp = rand:next(0, disp)
local z_disp = rand:next(0, disp) --
local schem_positions = {} -- on_data
--
for y = minp.y, maxp.y do -- read/write to `data` what will be eventually saved (set_data)
local vi = area:index(minp.x + sidelength / 2 + x_disp, y, minp.z + sidelength / 2 + z_disp) -- used for voxelmanip `data` manipulation
for _, def in ipairs(Everness.on_generated_queue) do
if data[vi + area.ystride] == minetest.CONTENT_AIR then if def.can_run(biomemap) and def.on_data then
local s_pos = area:position(vi) shared_args[def.name] = shared_args[def.name] or {}
def.on_data(minp, maxp, area, data, p2data, gennotify, rand, shared_args[def.name])
if maxp.y >= water_level then end
-- Above sea level or at water level end
if
( -- set data after they have been manipulated (from above)
data[vi] == c_dirt_with_grass_1 vm:set_data(data)
or data[vi] == c_dirt_with_grass_extras_1 vm:set_param2_data(p2data)
or data[vi] == c_dirt_with_grass_extras_2
) --
and rand:next(0, 100) < chance -- after_set_data
then --
local schem = minetest.get_modpath('everness') .. '/schematics/everness_japanese_shrine.mts' -- 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
-- Japanese Shrine 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 {}
local size = { x = 11, y = 19, z = 15 } def.after_set_data(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args[def.name])
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'
)
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'
--
-- Jungle Temple
--
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
end end
end end
@ -918,22 +76,22 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
vm:update_liquids() vm:update_liquids()
-- Write what has been created to the world. -- Write what has been created to the world.
vm:write_to_map() vm:write_to_map()
minetest.fix_light(minp, maxp)
-- Populate loot chests --
for name, tbl in pairs(schem_positions) do -- after_write_to_map
if next(tbl) then --
for i, v in ipairs(tbl) do -- Cannot read/write voxelmanip or its data
local chest_positions = minetest.find_nodes_in_area( -- Used for direct manipulation of the world chunk nodes where the
v.minp, -- definitions of nodes are available and node callback can be executed
v.maxp, -- or e.g. for `minetest.fix_light`
{ 'everness:chest' } 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 {}
if #chest_positions > 0 then def.after_write_to_map(shared_args[def.name], gennotify)
Everness:populate_loot_chests(chest_positions)
end
end
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) end)

View File

@ -251,81 +251,190 @@ register_flower_magenta_decoration(0.015, 0.045, 1)
-- On Generated -- On Generated
-- --
local data = {} local disp = 16
local p2data = {} 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_3 = minetest.get_content_id('everness:bamboo_3')
local c_everness_bamboo_4 = minetest.get_content_id('everness:bamboo_4') 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_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') 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.set_gen_notify({ decoration = true }, { d_everness_bamboo_forest_large_bamboo })
minetest.register_on_generated(function(minp, maxp, blockseed) Everness:add_to_queue_on_generated({
-- Load the voxelmanip with the result of engine mapgen name = 'everness:bamboo_forest',
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip') can_run = function(biomemap)
-- 'area' is used later to get the voxelmanip indexes for positions return table.indexof(biomemap, biome_id_bamboo_forest) ~= -1
local area = VoxelArea:new({ MinEdge = emin, MaxEdge = emax }) end,
-- Get the content ID data from the voxelmanip in the form of a flat array. on_data = function(minp, maxp, area, data, p2data, gennotify, rand, shared_args)
-- Set the buffer parameter to use and reuse 'data' for this. --
vm:get_data(data) -- Bamboo
vm:get_param2_data(p2data) --
for _, pos in ipairs(gennotify['decoration#' .. (d_everness_bamboo_forest_large_bamboo or '')] or {}) do
-- For bamboo large this is position of the 'place_on' node, e.g. 'everness:dirt_with_grass_extras_2'
local vi = area:indexp(pos)
local while_counter = 1
local bamboo_height = 0
local last_vi = vi + area.ystride * while_counter
local gennotify = minetest.get_mapgen_object('gennotify') -- Get bamboo height
while data[last_vi] == c_everness_bamboo_3 do
last_vi = vi + area.ystride * while_counter
bamboo_height = bamboo_height + 1
while_counter = while_counter + 1
end
-- -- Back up the last from `while_counter`
-- Bamboo last_vi = last_vi - area.ystride
--
for _, pos in ipairs(gennotify['decoration#' .. (d_everness_bamboo_forest_large_bamboo or '')] or {}) do
-- For bamboo large this is position of the 'place_on' node, e.g. 'everness:dirt_with_grass_extras_2'
local vi = area:indexp(pos)
local while_counter = 1
local bamboo_height = 0
local last_vi = vi + area.ystride * while_counter
-- Get bamboo height -- Add top bamboo nodes with leaves based on their generated height
while data[last_vi] == c_everness_bamboo_3 do if bamboo_height > 4 then
last_vi = vi + area.ystride * while_counter for i = 1, 3 do
bamboo_height = bamboo_height + 1 if data[last_vi + area.ystride * i] == minetest.CONTENT_AIR then
while_counter = while_counter + 1 if i == 1 then
end data[last_vi + area.ystride * i] = c_everness_bamboo_4
else
data[last_vi + area.ystride * i] = c_everness_bamboo_5
end
-- Back up the last from `while_counter` p2data[last_vi + area.ystride * i] = p2data[vi + area.ystride]
last_vi = last_vi - area.ystride
-- Add top bamboo nodes with leaves based on their generated height
if bamboo_height > 4 then
for i = 1, 3 do
if data[last_vi + area.ystride * i] == minetest.CONTENT_AIR then
if i == 1 then
data[last_vi + area.ystride * i] = c_everness_bamboo_4
else
data[last_vi + area.ystride * i] = c_everness_bamboo_5
end end
end
else
for i = 1, 2 do
if data[last_vi + area.ystride * i] == minetest.CONTENT_AIR then
if i == 1 then
data[last_vi + area.ystride * i] = c_everness_bamboo_4
else
data[last_vi + area.ystride * i] = c_everness_bamboo_5
end
p2data[last_vi + area.ystride * i] = p2data[vi + area.ystride] p2data[last_vi + area.ystride * i] = p2data[vi + area.ystride]
end
end end
end end
else end
for i = 1, 2 do end,
if data[last_vi + area.ystride * i] == minetest.CONTENT_AIR then after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
if i == 1 then local sidelength = maxp.x - minp.x + 1
data[last_vi + area.ystride * i] = c_everness_bamboo_4 local x_disp = rand:next(0, disp)
else local z_disp = rand:next(0, disp)
data[last_vi + area.ystride * i] = c_everness_bamboo_5 shared_args.schem_positions = {}
end
p2data[last_vi + area.ystride * i] = p2data[vi + area.ystride] 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
end end
end end
})
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)

View File

@ -172,6 +172,26 @@ register_dry_grass_decoration(0.07, -0.01, 1)
-- On Generated -- 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 = { local deco_ids_baobab = {
minetest.get_decoration_id('everness:baobab_savanna_baobab_tree_1'), minetest.get_decoration_id('everness:baobab_savanna_baobab_tree_1'),
minetest.get_decoration_id('everness:baobab_savanna_baobab_tree_2') 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) minetest.set_gen_notify({ decoration = true }, deco_ids_baobab)
end end
minetest.register_on_generated(function(minp, maxp, blockseed) Everness:add_to_queue_on_generated({
local gennotify = minetest.get_mapgen_object('gennotify') 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 -- Baobab Tree - fix light
-- --
for _, deco_id in ipairs(deco_ids_baobab) do for _, deco_id in ipairs(deco_ids_baobab) do
for _, pos in ipairs(gennotify['decoration#' .. deco_id] or {}) do for _, pos in ipairs(gennotify['decoration#' .. (deco_id or '')] or {}) do
minetest.fix_light(vector.offset(pos, -1, -1, -1), vector.offset(pos, 24, 39, 24)) 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
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 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 } local coral_bones_tree_size = { x = 16, y = 35, z = 16 }
minetest.set_gen_notify({ decoration = true }, { deco_id_coral_bones_tree }) minetest.set_gen_notify({ decoration = true }, { deco_id_coral_bones_tree })
minetest.register_on_generated(function(minp, maxp, blockseed) Everness:add_to_queue_on_generated({
local gennotify = minetest.get_mapgen_object('gennotify') name = 'everness:coral_forest',
can_run = function(biomemap)
if maxp.y > 0 then return table.indexof(biomemap, biome_id_coral_forest) ~= -1
end,
after_write_to_map = function(shared_args, gennotify)
-- --
-- Coral bone tree - fix light -- Coral bone tree - fix light
-- --
@ -275,4 +280,4 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
) )
end end
end end
end) })

View File

@ -321,121 +321,115 @@ local c_everness_coral_forest_deep_ocean_coral_4 = minetest.get_content_id('ever
-- Biome IDs -- Biome IDs
local biome_id_everness_coral_forest_deep_ocean = minetest.get_biome_id('everness:coral_forest_deep_ocean') local biome_id_everness_coral_forest_deep_ocean = minetest.get_biome_id('everness:coral_forest_deep_ocean')
-- Localize data buffer table outside the loop, to be re-used for all local chance = 30
-- mapchunks, therefore minimising memory use.
local data = {}
local chance = 25
local schem = minetest.get_modpath('everness') .. '/schematics/everness_coral_forest_deep_ocean_house.mts' local schem = minetest.get_modpath('everness') .. '/schematics/everness_coral_forest_deep_ocean_house.mts'
local size = { x = 11, y = 17, z = 12 } local size = { x = 11, y = 17, z = 12 }
local size_x = math.round(size.x / 2) local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2) local size_z = math.round(size.z / 2)
minetest.register_on_generated(function(minp, maxp, blockseed) Everness:add_to_queue_on_generated({
local rand = PcgRandom(blockseed) name = 'everness:coral_forest_deep_ocean',
local biomemap = minetest.get_mapgen_object('biomemap') can_run = function(biomemap)
local schem_positions = {} return table.indexof(biomemap, biome_id_everness_coral_forest_deep_ocean) ~= -1
local schem_placed = false 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 if rand:next(0, 100) < chance then
-- Load the voxelmanip with the result of engine mapgen for y = maxp.y, minp.y, -1 do
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip') if schem_placed then
-- 'area' is used later to get the voxelmanip indexes for positions break
local area = VoxelArea:new({ MinEdge = emin, MaxEdge = emax }) end
-- Get the content ID data from the voxelmanip in the form of a flat array.
-- Set the buffer parameter to use and reuse 'data' for this.
vm:get_data(data)
for y = maxp.y, minp.y, -1 do for z = minp.z, maxp.z do
for z = minp.z, maxp.z do if schem_placed then
for x = minp.x, maxp.x do break
local vi = area:index(x, y, z) end
if for x = minp.x, maxp.x do
data[vi] == c_everness_coral_forest_deep_ocean_sand local vi = area:index(x, y, z)
and data[vi + area.ystride] == c_water_source
and not schem_placed
then
local s_pos = area:position(vi)
-- if
-- Coral Forest Deep Ocean House data[vi] == c_everness_coral_forest_deep_ocean_sand
-- and data[vi + area.ystride] == c_water_source
then
local s_pos = area:position(vi)
local schem_pos = vector.new(s_pos) --
-- Coral Forest Deep Ocean House
--
-- find floor big enough local schem_pos = vector.new(s_pos)
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_everness_coral_forest_deep_ocean_sand,
c_everness_coral_forest_deep_ocean_coral_plant_1,
c_everness_coral_forest_deep_ocean_coral_plant_2,
c_everness_coral_forest_deep_ocean_coral_plant_3,
c_everness_coral_forest_deep_ocean_coral_1,
c_everness_coral_forest_deep_ocean_coral_2,
c_everness_coral_forest_deep_ocean_coral_3,
c_everness_coral_forest_deep_ocean_coral_4
},
data,
area
)
if #indexes < size.x * size.z then -- find floor big enough
-- not enough space local indexes = Everness.find_content_in_vm_area(
return vector.new(s_pos.x - size_x, s_pos.y - 1, s_pos.z - size_z),
end vector.new(s_pos.x + size_x, s_pos.y + 1, s_pos.z + size_z),
{
-- enough water to place structure ? c_everness_coral_forest_deep_ocean_sand,
local water_indexes = Everness.find_content_in_vm_area( c_everness_coral_forest_deep_ocean_coral_plant_1,
vector.new(s_pos.x - size_x, s_pos.y, s_pos.z - size_z), c_everness_coral_forest_deep_ocean_coral_plant_2,
vector.new(s_pos.x + size_x, s_pos.y + size.y, s_pos.z + size_z), c_everness_coral_forest_deep_ocean_coral_plant_3,
{ c_everness_coral_forest_deep_ocean_coral_1,
c_water_source c_everness_coral_forest_deep_ocean_coral_2,
}, c_everness_coral_forest_deep_ocean_coral_3,
data, c_everness_coral_forest_deep_ocean_coral_4
area },
) data,
area
if #water_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_placed = true if #indexes < size.x * size.z then
-- not enough space
return
end
schem_positions.everness_coral_forest_deep_ocean_house = schem_positions.everness_coral_forest_deep_ocean_house or {} -- enough water to place structure ?
local water_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
},
data,
area
)
table.insert(schem_positions.everness_coral_forest_deep_ocean_house, { if #water_indexes > (size.x * size.y * size.z) / 2 then
pos = schem_pos, minetest.place_schematic_on_vmanip(
minp = vector.new(s_pos.x - size_x, s_pos.y, s_pos.z - size_z), vm,
maxp = vector.new(s_pos.x + size_x, s_pos.y + size.y, s_pos.z + size_z) schem_pos,
}) schem,
'random',
nil,
true,
'place_center_x, place_center_z'
)
minetest.log('action', '[Everness] Coral Forest Deep Ocean House was placed at ' .. schem_pos:to_string()) schem_placed = true
shared_args.schem_positions.everness_coral_forest_deep_ocean_house = shared_args.schem_positions.everness_coral_forest_deep_ocean_house or {}
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())
break
end
end end
end end
end end
end end
end end
end,
after_write_to_map = function(shared_args)
local schem_positions = shared_args.schem_positions or {}
-- 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)
-- Populate loot chests
for name, tbl in pairs(schem_positions) do for name, tbl in pairs(schem_positions) do
if next(tbl) then if next(tbl) then
for i, v in ipairs(tbl) do for i, v in ipairs(tbl) do
@ -452,4 +446,4 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end end
end end
end end
end) })

View File

@ -178,3 +178,126 @@ Everness:register_decoration({
y_min = y_min, y_min = y_min,
decoration = 'everness:coral_shrub' 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' '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 -- On Generated
-- --
local biome_id_everness_coral_forest_under = minetest.get_biome_id('everness:coral_forest_under')
local deco_id_coral_forest_under_coral_tree_bioluminescent = minetest.get_decoration_id('everness:coral_forest_under_coral_tree_bioluminescent') local deco_id_coral_forest_under_coral_tree_bioluminescent = minetest.get_decoration_id('everness:coral_forest_under_coral_tree_bioluminescent')
local schem_bioluminescent_tree = minetest.get_modpath('everness') .. '/schematics/everness_coral_tree_bioluminescent.mts' local schem_bioluminescent_tree = minetest.get_modpath('everness') .. '/schematics/everness_coral_tree_bioluminescent.mts'
@ -226,78 +228,79 @@ bioluminescent_tree_place_on = type(bioluminescent_tree_place_on) == 'string' an
minetest.set_gen_notify({ decoration = true }, { deco_id_coral_forest_under_coral_tree_bioluminescent }) minetest.set_gen_notify({ decoration = true }, { deco_id_coral_forest_under_coral_tree_bioluminescent })
minetest.register_on_generated(function(minp, maxp, blockseed) Everness:add_to_queue_on_generated({
-- Load the voxelmanip with the result of engine mapgen name = 'everness:coral_forest_under',
local vm = minetest.get_mapgen_object('voxelmanip') can_run = function(biomemap)
-- Returns a table mapping requested generation notification types to arrays of positions at which the corresponding generated structures are located within the current chunk return table.indexof(biomemap, biome_id_everness_coral_forest_under) ~= -1
local gennotify = minetest.get_mapgen_object('gennotify') end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
--
-- Coral Tree Bioluminescent
--
for _, pos in ipairs(gennotify['decoration#' .. (deco_id_coral_forest_under_coral_tree_bioluminescent 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
-- Coral Tree Bioluminescent return
-- end
for _, pos in ipairs(gennotify['decoration#' .. (deco_id_coral_forest_under_coral_tree_bioluminescent 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 if marker_node.name ~= 'everness:marker' then
return -- not a valid "place_on" position (e.g. something else was placed there)
end return
end
if marker_node.name ~= 'everness:marker' then minetest.remove_node(marker_pos)
-- not a valid "place_on" position (e.g. something else was placed there)
return
end
minetest.remove_node(marker_pos) if table.indexof(bioluminescent_tree_place_on, place_on_node.name) == -1 then
-- not a valid "place_on" position (e.g. something else was placed there)
return
end
if table.indexof(bioluminescent_tree_place_on, place_on_node.name) == -1 then -- no need to check for the floor "big enough" size since its a tree and has ~ 1x1 base size
-- 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(
-- enough air to place structure ? vector.new(
local positions = minetest.find_nodes_in_area( pos.x - bioluminescent_tree_size_x,
vector.new( pos.y - bioluminescent_tree_y_dis,
pos.x - bioluminescent_tree_size_x, pos.z - bioluminescent_tree_size_z
pos.y - bioluminescent_tree_y_dis, ),
pos.z - bioluminescent_tree_size_z vector.new(
), pos.x + bioluminescent_tree_size_x,
vector.new( pos.y - bioluminescent_tree_y_dis + coral_bioluminescent_tree_size.y,
pos.x + bioluminescent_tree_size_x, pos.z + bioluminescent_tree_size_z
pos.y - bioluminescent_tree_y_dis + coral_bioluminescent_tree_size.y, ),
pos.z + bioluminescent_tree_size_z {
), 'air',
{ 'everness:coral_tree'
'air', },
'everness:coral_tree' true
},
true
)
local air = positions.air or {}
local tree = positions['everness:coral_tree'] or {}
if #tree > 1 then
-- will overlap another tree
return
end
if #air > bioluminescent_tree_safe_volume then
minetest.place_schematic_on_vmanip(
vm,
vector.new(marker_pos.x, marker_pos.y - bioluminescent_tree_y_dis, marker_pos.z),
schem_bioluminescent_tree,
'random',
nil,
true,
'place_center_x, place_center_z'
) )
-- minetest.log('action', '[Everness] Coral Tree Bioluminescent was placed at ' .. pos:to_string()) local air = positions.air or {}
local tree = positions['everness:coral_tree'] or {}
if #tree > 1 then
-- will overlap another tree
return
end
if #air > bioluminescent_tree_safe_volume then
minetest.place_schematic_on_vmanip(
vm,
vector.new(marker_pos.x, marker_pos.y - bioluminescent_tree_y_dis, marker_pos.z),
schem_bioluminescent_tree,
'random',
nil,
true,
'place_center_x, place_center_z'
)
-- minetest.log('action', '[Everness] Coral Tree Bioluminescent was placed at ' .. pos:to_string())
end
end 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.03, 0.09, 3)
register_crystal_grass_decoration(-0.015, 0.075, 2) register_crystal_grass_decoration(-0.015, 0.075, 2)
register_crystal_grass_decoration(0, 0.06, 1) 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,120 +190,114 @@ local c_everness_crystal_forest_deep_ocean_coral_3 = minetest.get_content_id('ev
-- Biome IDs -- Biome IDs
local biome_id_everness_crystal_forest_deep_ocean = minetest.get_biome_id('everness:crystal_forest_deep_ocean') local biome_id_everness_crystal_forest_deep_ocean = minetest.get_biome_id('everness:crystal_forest_deep_ocean')
-- Localize data buffer table outside the loop, to be re-used for all local chance = 30
-- mapchunks, therefore minimising memory use.
local data = {}
local chance = 25
local schem = minetest.get_modpath('everness') .. '/schematics/everness_crystal_forest_deep_ocean_ruins.mts' local schem = minetest.get_modpath('everness') .. '/schematics/everness_crystal_forest_deep_ocean_ruins.mts'
local size = { x = 14, y = 12, z = 9 } local size = { x = 14, y = 12, z = 9 }
local size_x = math.round(size.x / 2) local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2) local size_z = math.round(size.z / 2)
minetest.register_on_generated(function(minp, maxp, blockseed) Everness:add_to_queue_on_generated({
local rand = PcgRandom(blockseed) name = 'everness:crystal_forest_deep_ocean',
local biomemap = minetest.get_mapgen_object('biomemap') can_run = function(biomemap)
local schem_positions = {} return table.indexof(biomemap, biome_id_everness_crystal_forest_deep_ocean) ~= -1
local schem_placed = false 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 if rand:next(0, 100) < chance then
-- Load the voxelmanip with the result of engine mapgen for y = maxp.y, minp.y, -1 do
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip') if schem_placed then
-- 'area' is used later to get the voxelmanip indexes for positions break
local area = VoxelArea:new({ MinEdge = emin, MaxEdge = emax }) end
-- Get the content ID data from the voxelmanip in the form of a flat array.
-- Set the buffer parameter to use and reuse 'data' for this.
vm:get_data(data)
for y = maxp.y, minp.y, -1 do for z = minp.z, maxp.z do
for z = minp.z, maxp.z do if schem_placed then
for x = minp.x, maxp.x do break
local vi = area:index(x, y, z) end
if for x = minp.x, maxp.x do
data[vi] == c_everness_crystal_forest_deep_ocean_sand local vi = area:index(x, y, z)
and data[vi + area.ystride] == c_water_source
and not schem_placed
then
local s_pos = area:position(vi)
-- if
-- Crystal Forest Deep Ocean Ruins data[vi] == c_everness_crystal_forest_deep_ocean_sand
-- and data[vi + area.ystride] == c_water_source
then
local s_pos = area:position(vi)
local schem_pos = vector.new(s_pos) --
-- Crystal Forest Deep Ocean Ruins
--
-- find floor big enough local schem_pos = vector.new(s_pos)
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_everness_crystal_forest_deep_ocean_sand,
c_everness_crystal_forest_deep_ocean_coral_plant_1,
c_everness_crystal_forest_deep_ocean_coral_plant_2,
c_everness_crystal_forest_deep_ocean_coral_plant_3,
c_everness_crystal_forest_deep_ocean_coral_1,
c_everness_crystal_forest_deep_ocean_coral_2,
c_everness_crystal_forest_deep_ocean_coral_3
},
data,
area
)
if #indexes < size.x * size.z then -- find floor big enough
-- not enough space local indexes = Everness.find_content_in_vm_area(
return vector.new(s_pos.x - size_x, s_pos.y - 1, s_pos.z - size_z),
end vector.new(s_pos.x + size_x, s_pos.y + 1, s_pos.z + size_z),
{
-- enough water to place structure ? c_everness_crystal_forest_deep_ocean_sand,
local water_indexes = Everness.find_content_in_vm_area( c_everness_crystal_forest_deep_ocean_coral_plant_1,
vector.new(s_pos.x - size_x, s_pos.y, s_pos.z - size_z), c_everness_crystal_forest_deep_ocean_coral_plant_2,
vector.new(s_pos.x + size_x, s_pos.y + size.y, s_pos.z + size_z), c_everness_crystal_forest_deep_ocean_coral_plant_3,
{ c_everness_crystal_forest_deep_ocean_coral_1,
c_water_source c_everness_crystal_forest_deep_ocean_coral_2,
}, c_everness_crystal_forest_deep_ocean_coral_3
data, },
area data,
) area
if #water_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_placed = true if #indexes < size.x * size.z then
-- not enough space
return
end
schem_positions.everness_crystal_forest_deep_ocean_ruins = schem_positions.everness_crystal_forest_deep_ocean_ruins or {} -- enough water to place structure ?
local water_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
},
data,
area
)
table.insert(schem_positions.everness_crystal_forest_deep_ocean_ruins, { if #water_indexes > (size.x * size.y * size.z) / 2 then
pos = schem_pos, minetest.place_schematic_on_vmanip(
minp = vector.new(s_pos.x - size_x, s_pos.y, s_pos.z - size_z), vm,
maxp = vector.new(s_pos.x + size_x, s_pos.y + size.y, s_pos.z + size_z) schem_pos,
}) schem,
'random',
nil,
true,
'place_center_x, place_center_z'
)
minetest.log('action', '[Everness] Crystal Forest Deep Ocean Ruins was placed at ' .. schem_pos:to_string()) schem_placed = true
shared_args.schem_positions.everness_crystal_forest_deep_ocean_ruins = shared_args.schem_positions.everness_crystal_forest_deep_ocean_ruins or {}
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())
break
end
end end
end end
end end
end end
end end
end,
after_write_to_map = function(shared_args)
local schem_positions = shared_args.schem_positions or {}
-- 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)
-- Populate loot chests
for name, tbl in pairs(schem_positions) do for name, tbl in pairs(schem_positions) do
if next(tbl) then if next(tbl) then
for i, v in ipairs(tbl) do for i, v in ipairs(tbl) do
@ -320,4 +314,4 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end end
end end
end end
end) })

View File

@ -139,3 +139,199 @@ Everness:register_decoration({
flags = 'place_center_x, place_center_z', flags = 'place_center_x, place_center_z',
rotation = 'random', 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 -- On Generated
-- --
local biome_id_everness_crystal_forest_under = minetest.get_biome_id('everness:crystal_forest_under')
local deco_id_crystal_forest_under_crystal_cluster = minetest.get_decoration_id('everness:crystal_forest_under_crystal_cluster') local deco_id_crystal_forest_under_crystal_cluster = minetest.get_decoration_id('everness:crystal_forest_under_crystal_cluster')
local deco_id_crystal_forest_under_crystal_sphere_cluster = minetest.get_decoration_id('everness:crystal_forest_under_crystal_sphere_cluster') local deco_id_crystal_forest_under_crystal_sphere_cluster = minetest.get_decoration_id('everness:crystal_forest_under_crystal_sphere_cluster')
@ -248,174 +250,174 @@ minetest.set_gen_notify({ decoration = true }, {
deco_id_crystal_forest_under_crystal_sphere_cluster deco_id_crystal_forest_under_crystal_sphere_cluster
}) })
minetest.register_on_generated(function(minp, maxp, blockseed) Everness:add_to_queue_on_generated({
local rand = PcgRandom(blockseed) name = 'everness:crystal_forest_under',
-- Load the voxelmanip with the result of engine mapgen can_run = function(biomemap)
local vm = minetest.get_mapgen_object('voxelmanip') return table.indexof(biomemap, biome_id_everness_crystal_forest_under) ~= -1
-- Returns a table mapping requested generation notification types to arrays of positions at which the corresponding generated structures are located within the current chunk end,
local gennotify = minetest.get_mapgen_object('gennotify') after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
--
-- Crystal Cluster
--
for _, pos in ipairs(gennotify['decoration#' .. (deco_id_crystal_forest_under_crystal_cluster 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
-- Crystal Cluster return
--
for _, pos in ipairs(gennotify['decoration#' .. (deco_id_crystal_forest_under_crystal_cluster 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(crystal_cluster_place_on, place_on_node.name) == -1 then
-- not a valid "place_on" position (e.g. something else was placed there)
return
end
-- enough air to place structure ?
local positions = minetest.find_nodes_in_area(
vector.new(
pos.x - crystal_cluster_size_x,
pos.y,
pos.z - crystal_cluster_size_z
),
vector.new(
pos.x + crystal_cluster_size_x,
pos.y + crystal_cluster_size.y,
pos.z + crystal_cluster_size_z
),
{
'air'
},
true
)
local air = positions.air or {}
if #air > crystal_cluster_safe_volume then
local replacements
local rand_color
if rand:next(0, 100) < 25 then
local colors = { 'purple', 'cyan' }
rand_color = colors[rand:next(1, #colors)]
replacements = {
['everness:crystal_block_orange'] = 'everness:crystal_block_' .. rand_color,
['everness:crystal_orange'] = 'everness:crystal_' .. rand_color
}
end end
minetest.place_schematic_on_vmanip( if marker_node.name ~= 'everness:marker' then
vm, -- not a valid "place_on" position (e.g. something else was placed there)
vector.new(marker_pos.x, marker_pos.y, marker_pos.z), return
schem_crystal_cluster,
'random',
replacements,
true,
'place_center_x, place_center_z'
)
-- minetest.log('action', '[Everness] Crystal Cluster ' .. (rand_color or 'orange') .. ' was placed at ' .. pos:to_string())
end
end
--
-- Crystal Sphere Cluster
--
for _, pos in ipairs(gennotify['decoration#' .. (deco_id_crystal_forest_under_crystal_sphere_cluster 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)
local crystal_sphere_cluster_y_dis = rand:next(5, 9)
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(crystal_sphere_cluster_place_on, place_on_node.name) == -1 then
-- not a valid "place_on" position (e.g. something else was placed there)
return
end
-- enough air to place structure ?
local positions = minetest.find_nodes_in_area(
vector.new(
pos.x - crystal_sphere_cluster_size_x,
pos.y - crystal_sphere_cluster_y_dis,
pos.z - crystal_sphere_cluster_size_z
),
vector.new(
pos.x + crystal_sphere_cluster_size_x,
pos.y - crystal_sphere_cluster_y_dis + crystal_sphere_cluster_size.y,
pos.z + crystal_sphere_cluster_size_z
),
{
'air',
'everness:coral_tree',
'everness:crystal_block_orange',
'everness:crystal_block_purple',
'everness:crystal_block_cyan',
},
true
)
local air = positions.air or {}
local tree = positions['everness:coral_tree'] or {}
local block_orange = positions['everness:crystal_block_orange'] or {}
local block_purple = positions['everness:crystal_block_purple'] or {}
local block_cyan = positions['everness:crystal_block_cyan'] or {}
if #tree > 0
or #block_orange > 0
or #block_purple > 0
or #block_cyan > 0
then
-- will overlap
return
end
if #air > crystal_sphere_cluster_safe_volume then
local replacements
local rand_color
if rand:next(0, 100) < 25 then
local colors = { 'orange', 'cyan' }
rand_color = colors[rand:next(1, #colors)]
replacements = {
['everness:crystal_block_purple'] = 'everness:crystal_block_' .. rand_color,
['everness:crystal_purple'] = 'everness:crystal_' .. rand_color
}
end end
minetest.place_schematic_on_vmanip( minetest.remove_node(marker_pos)
vm,
vector.new(marker_pos.x, marker_pos.y - crystal_sphere_cluster_y_dis, marker_pos.z), if table.indexof(crystal_cluster_place_on, place_on_node.name) == -1 then
schem_crystal_sphere_cluster, -- not a valid "place_on" position (e.g. something else was placed there)
'random', return
replacements, end
true,
'place_center_x, place_center_z' -- enough air to place structure ?
local positions = minetest.find_nodes_in_area(
vector.new(
pos.x - crystal_cluster_size_x,
pos.y,
pos.z - crystal_cluster_size_z
),
vector.new(
pos.x + crystal_cluster_size_x,
pos.y + crystal_cluster_size.y,
pos.z + crystal_cluster_size_z
),
{
'air'
},
true
) )
-- minetest.log('action', '[Everness] Crystal Sphere Cluster ' .. (rand_color or 'orange') .. ' was placed at ' .. pos:to_string()) local air = positions.air or {}
if #air > crystal_cluster_safe_volume then
local replacements
local rand_color
if rand:next(0, 100) < 25 then
local colors = { 'purple', 'cyan' }
rand_color = colors[rand:next(1, #colors)]
replacements = {
['everness:crystal_block_orange'] = 'everness:crystal_block_' .. rand_color,
['everness:crystal_orange'] = 'everness:crystal_' .. rand_color
}
end
minetest.place_schematic_on_vmanip(
vm,
vector.new(marker_pos.x, marker_pos.y, marker_pos.z),
schem_crystal_cluster,
'random',
replacements,
true,
'place_center_x, place_center_z'
)
-- minetest.log('action', '[Everness] Crystal Cluster ' .. (rand_color or 'orange') .. ' was placed at ' .. pos:to_string())
end
end
--
-- Crystal Sphere Cluster
--
for _, pos in ipairs(gennotify['decoration#' .. (deco_id_crystal_forest_under_crystal_sphere_cluster 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)
local crystal_sphere_cluster_y_dis = rand:next(5, 9)
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(crystal_sphere_cluster_place_on, place_on_node.name) == -1 then
-- not a valid "place_on" position (e.g. something else was placed there)
return
end
-- enough air to place structure ?
local positions = minetest.find_nodes_in_area(
vector.new(
pos.x - crystal_sphere_cluster_size_x,
pos.y - crystal_sphere_cluster_y_dis,
pos.z - crystal_sphere_cluster_size_z
),
vector.new(
pos.x + crystal_sphere_cluster_size_x,
pos.y - crystal_sphere_cluster_y_dis + crystal_sphere_cluster_size.y,
pos.z + crystal_sphere_cluster_size_z
),
{
'air',
'everness:coral_tree',
'everness:crystal_block_orange',
'everness:crystal_block_purple',
'everness:crystal_block_cyan',
},
true
)
local air = positions.air or {}
local tree = positions['everness:coral_tree'] or {}
local block_orange = positions['everness:crystal_block_orange'] or {}
local block_purple = positions['everness:crystal_block_purple'] or {}
local block_cyan = positions['everness:crystal_block_cyan'] or {}
if #tree > 0
or #block_orange > 0
or #block_purple > 0
or #block_cyan > 0
then
-- will overlap
return
end
if #air > crystal_sphere_cluster_safe_volume then
local replacements
local rand_color
if rand:next(0, 100) < 25 then
local colors = { 'orange', 'cyan' }
rand_color = colors[rand:next(1, #colors)]
replacements = {
['everness:crystal_block_purple'] = 'everness:crystal_block_' .. rand_color,
['everness:crystal_purple'] = 'everness:crystal_' .. rand_color
}
end
minetest.place_schematic_on_vmanip(
vm,
vector.new(marker_pos.x, marker_pos.y - crystal_sphere_cluster_y_dis, marker_pos.z),
schem_crystal_sphere_cluster,
'random',
replacements,
true,
'place_center_x, place_center_z'
)
-- minetest.log('action', '[Everness] Crystal Sphere Cluster ' .. (rand_color or 'orange') .. ' was placed at ' .. pos:to_string())
end
end end
end end
end) })

View File

@ -311,3 +311,114 @@ Everness:register_decoration({
schematic = minetest.get_modpath('everness') .. '/schematics/everness_cursed_bush.mts', schematic = minetest.get_modpath('everness') .. '/schematics/everness_cursed_bush.mts',
flags = 'place_center_x, place_center_z', 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,120 +190,114 @@ local c_everness_cursed_lands_deep_ocean_coral_octocurse = minetest.get_content_
-- Biome IDs -- Biome IDs
local biome_id_everness_cursed_lands_deep_ocean = minetest.get_biome_id('everness:cursed_lands_deep_ocean') local biome_id_everness_cursed_lands_deep_ocean = minetest.get_biome_id('everness:cursed_lands_deep_ocean')
-- Localize data buffer table outside the loop, to be re-used for all local chance = 30
-- mapchunks, therefore minimising memory use.
local data = {}
local chance = 25
local schem = minetest.get_modpath('everness') .. '/schematics/everness_cursed_lands_deep_ocean_skull.mts' local schem = minetest.get_modpath('everness') .. '/schematics/everness_cursed_lands_deep_ocean_skull.mts'
local size = { x = 10, y = 11, z = 11 } local size = { x = 10, y = 11, z = 11 }
local size_x = math.round(size.x / 2) local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2) local size_z = math.round(size.z / 2)
minetest.register_on_generated(function(minp, maxp, blockseed) Everness:add_to_queue_on_generated({
local rand = PcgRandom(blockseed) name = 'everness:cursed_lands_deep_ocean',
local biomemap = minetest.get_mapgen_object('biomemap') can_run = function(biomemap)
local schem_positions = {} return table.indexof(biomemap, biome_id_everness_cursed_lands_deep_ocean) ~= -1
local schem_placed = false 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 if rand:next(0, 100) < chance then
-- Load the voxelmanip with the result of engine mapgen for y = maxp.y, minp.y, -1 do
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip') if schem_placed then
-- 'area' is used later to get the voxelmanip indexes for positions break
local area = VoxelArea:new({ MinEdge = emin, MaxEdge = emax }) end
-- Get the content ID data from the voxelmanip in the form of a flat array.
-- Set the buffer parameter to use and reuse 'data' for this.
vm:get_data(data)
for y = maxp.y, minp.y, -1 do for z = minp.z, maxp.z do
for z = minp.z, maxp.z do if schem_placed then
for x = minp.x, maxp.x do break
local vi = area:index(x, y, z) end
if for x = minp.x, maxp.x do
data[vi] == c_everness_cursed_lands_deep_ocean_sand local vi = area:index(x, y, z)
and data[vi + area.ystride] == c_water_source
and not schem_placed
then
local s_pos = area:position(vi)
-- if
-- Cursed Lands Deep Ocean Skull data[vi] == c_everness_cursed_lands_deep_ocean_sand
-- and data[vi + area.ystride] == c_water_source
then
local s_pos = area:position(vi)
local schem_pos = vector.new(s_pos) --
-- Cursed Lands Deep Ocean Skull
--
-- find floor big enough local schem_pos = vector.new(s_pos)
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_everness_cursed_lands_deep_ocean_sand,
c_everness_cursed_lands_deep_ocean_coral_plant_anemone,
c_everness_cursed_lands_deep_ocean_coral_plant_darkilluma,
c_everness_cursed_lands_deep_ocean_coral_plant_demon,
c_everness_cursed_lands_deep_ocean_coral_alcyonacea,
c_everness_cursed_lands_deep_ocean_coral_ostracod,
c_everness_cursed_lands_deep_ocean_coral_octocurse
},
data,
area
)
if #indexes < size.x * size.z then -- find floor big enough
-- not enough space local indexes = Everness.find_content_in_vm_area(
return vector.new(s_pos.x - size_x, s_pos.y - 1, s_pos.z - size_z),
end vector.new(s_pos.x + size_x, s_pos.y + 1, s_pos.z + size_z),
{
-- enough water to place structure ? c_everness_cursed_lands_deep_ocean_sand,
local water_indexes = Everness.find_content_in_vm_area( c_everness_cursed_lands_deep_ocean_coral_plant_anemone,
vector.new(s_pos.x - size_x, s_pos.y, s_pos.z - size_z), c_everness_cursed_lands_deep_ocean_coral_plant_darkilluma,
vector.new(s_pos.x + size_x, s_pos.y + size.y, s_pos.z + size_z), c_everness_cursed_lands_deep_ocean_coral_plant_demon,
{ c_everness_cursed_lands_deep_ocean_coral_alcyonacea,
c_water_source c_everness_cursed_lands_deep_ocean_coral_ostracod,
}, c_everness_cursed_lands_deep_ocean_coral_octocurse
data, },
area data,
) area
if #water_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_placed = true if #indexes < size.x * size.z then
-- not enough space
return
end
schem_positions.everness_cursed_lands_deep_ocean_skull = schem_positions.everness_cursed_lands_deep_ocean_skull or {} -- enough water to place structure ?
local water_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
},
data,
area
)
table.insert(schem_positions.everness_cursed_lands_deep_ocean_skull, { if #water_indexes > (size.x * size.y * size.z) / 2 then
pos = schem_pos, minetest.place_schematic_on_vmanip(
minp = vector.new(s_pos.x - size_x, s_pos.y, s_pos.z - size_z), vm,
maxp = vector.new(s_pos.x + size_x, s_pos.y + size.y, s_pos.z + size_z) schem_pos,
}) schem,
'random',
nil,
true,
'place_center_x, place_center_z'
)
minetest.log('action', '[Everness] Cursed Lands Deep Ocean Skull was placed at ' .. schem_pos:to_string()) schem_placed = true
shared_args.schem_positions.everness_cursed_lands_deep_ocean_skull = shared_args.schem_positions.everness_cursed_lands_deep_ocean_skull or {}
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())
break
end
end end
end end
end end
end end
end end
end,
after_write_to_map = function(shared_args)
local schem_positions = shared_args.schem_positions or {}
-- 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)
-- Populate loot chests
for name, tbl in pairs(schem_positions) do for name, tbl in pairs(schem_positions) do
if next(tbl) then if next(tbl) then
for i, v in ipairs(tbl) do for i, v in ipairs(tbl) do
@ -320,4 +314,4 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end end
end end
end end
end) })

View File

@ -161,3 +161,188 @@ Everness:register_decoration({
flags = 'place_center_x, place_center_z', flags = 'place_center_x, place_center_z',
rotation = 'random', 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, y_min = y_max,
schematic = minetest.get_modpath('everness') .. '/schematics/everness_marsh_grass.mts', 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 -- On Generated
-- --
local biome_id_everness_cursed_lands_under = minetest.get_biome_id('everness:cursed_lands_under')
local deco_id_cursed_lands_under_cursed_dream_tree = minetest.get_decoration_id('everness:cursed_lands_under_cursed_dream_tree') local deco_id_cursed_lands_under_cursed_dream_tree = minetest.get_decoration_id('everness:cursed_lands_under_cursed_dream_tree')
local schem_cursed_dream_tree = minetest.get_modpath('everness') .. '/schematics/everness_cursed_dream_tree.mts' local schem_cursed_dream_tree = minetest.get_modpath('everness') .. '/schematics/everness_cursed_dream_tree.mts'
@ -232,78 +234,79 @@ cursed_dream_tree_place_on = type(cursed_dream_tree_place_on) == 'string' and {
minetest.set_gen_notify({ decoration = true }, { deco_id_cursed_lands_under_cursed_dream_tree }) minetest.set_gen_notify({ decoration = true }, { deco_id_cursed_lands_under_cursed_dream_tree })
minetest.register_on_generated(function(minp, maxp, blockseed) Everness:add_to_queue_on_generated({
-- Load the voxelmanip with the result of engine mapgen name = 'everness:cursed_lands_under',
local vm = minetest.get_mapgen_object('voxelmanip') can_run = function(biomemap)
-- Returns a table mapping requested generation notification types to arrays of positions at which the corresponding generated structures are located within the current chunk return table.indexof(biomemap, biome_id_everness_cursed_lands_under) ~= -1
local gennotify = minetest.get_mapgen_object('gennotify') end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
--
-- Cursed Dream Tree
--
for _, pos in ipairs(gennotify['decoration#' .. (deco_id_cursed_lands_under_cursed_dream_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
-- Cursed Dream Tree return
-- end
for _, pos in ipairs(gennotify['decoration#' .. (deco_id_cursed_lands_under_cursed_dream_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 if marker_node.name ~= 'everness:marker' then
return -- not a valid "place_on" position (e.g. something else was placed there)
end return
end
if marker_node.name ~= 'everness:marker' then minetest.remove_node(marker_pos)
-- not a valid "place_on" position (e.g. something else was placed there)
return
end
minetest.remove_node(marker_pos) if table.indexof(cursed_dream_tree_place_on, place_on_node.name) == -1 then
-- not a valid "place_on" position (e.g. something else was placed there)
return
end
if table.indexof(cursed_dream_tree_place_on, place_on_node.name) == -1 then -- no need to check for the floor "big enough" size since its a tree and has ~ 1x1 base size
-- 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(
-- enough air to place structure ? vector.new(
local positions = minetest.find_nodes_in_area( pos.x - cursed_dream_tree_size_x,
vector.new( pos.y - cursed_dream_tree_y_dis,
pos.x - cursed_dream_tree_size_x, pos.z - cursed_dream_tree_size_z
pos.y - cursed_dream_tree_y_dis, ),
pos.z - cursed_dream_tree_size_z vector.new(
), pos.x + cursed_dream_tree_size_x,
vector.new( pos.y - cursed_dream_tree_y_dis + cursed_dream_tree_size.y,
pos.x + cursed_dream_tree_size_x, pos.z + cursed_dream_tree_size_z
pos.y - cursed_dream_tree_y_dis + cursed_dream_tree_size.y, ),
pos.z + cursed_dream_tree_size_z {
), 'air',
{ 'everness:dry_tree'
'air', },
'everness:dry_tree' true
},
true
)
local air = positions.air or {}
local tree = positions['everness:dry_tree'] or {}
if #tree > 1 then
-- will overlap another tree
return
end
if #air > cursed_dream_tree_safe_volume then
minetest.place_schematic_on_vmanip(
vm,
vector.new(marker_pos.x, marker_pos.y - cursed_dream_tree_y_dis, marker_pos.z),
schem_cursed_dream_tree,
'random',
nil,
true,
'place_center_x, place_center_z'
) )
-- minetest.log('action', '[Everness] Cursed Dream Tree was placed at ' .. pos:to_string()) local air = positions.air or {}
local tree = positions['everness:dry_tree'] or {}
if #tree > 1 then
-- will overlap another tree
return
end
if #air > cursed_dream_tree_safe_volume then
minetest.place_schematic_on_vmanip(
vm,
vector.new(marker_pos.x, marker_pos.y - cursed_dream_tree_y_dis, marker_pos.z),
schem_cursed_dream_tree,
'random',
nil,
true,
'place_center_x, place_center_z'
)
-- minetest.log('action', '[Everness] Cursed Dream Tree was placed at ' .. pos:to_string())
end
end end
end end
end) })

View File

@ -193,3 +193,112 @@ Everness:register_decoration({
flags = 'place_center_x, place_center_z', flags = 'place_center_x, place_center_z',
rotation = 'random', 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, height_max = 7,
flags = 'all_floors' 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', decoration = 'everness:bloodspore_plant',
param2 = 8, 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' flags = 'all_floors'
}) })
Everness:register_decoration({
name = 'everness:forsaken_tundra_under_willow_tree',
deco_type = 'simple',
place_on = {
'everness:mold_stone_with_moss',
'everness:blue_crying_obsidian',
'everness:blue_weeping_obsidian',
'everness:weeping_obsidian'
},
sidelen = 16,
noise_params = {
offset = 0,
scale = 0.002,
spread = { x = 250, y = 250, z = 250 },
seed = 2,
octaves = 3,
persist = 0.66
},
biomes = { 'everness:forsaken_tundra_under' },
y_max = y_max - 1500 > y_min and y_max - 1500 or y_max,
y_min = y_min,
flags = 'all_floors',
decoration = {
'everness:marker'
},
})
Everness:register_decoration({ Everness:register_decoration({
name = 'everness:forsaken_tundra_under_bloodspore_plant_small', name = 'everness:forsaken_tundra_under_bloodspore_plant_small',
deco_type = 'simple', deco_type = 'simple',
@ -250,84 +277,95 @@ register_agave_leaf_decoration(0, 0.06, 1)
-- On Generated -- On Generated
-- --
local c_air = minetest.get_content_id('air') local biome_id_everness_forsaken_tundra_under = minetest.get_biome_id('everness:forsaken_tundra_under')
local c_mold_stone_with_moss = minetest.get_content_id('everness:mold_stone_with_moss')
-- Localize data buffer table outside the loop, to be re-used for all local deco_id_everness_forsaken_tundra_under_willow_tree = minetest.get_decoration_id('everness:forsaken_tundra_under_willow_tree')
-- mapchunks, therefore minimising memory use.
local data = {}
local chance = 50
local disp = 16
local rotations = { '0', '90', '180', '270' }
local everness_forsaken_tundra_under_y_max = y_max - 1500 > y_min and y_max - 1500 or y_max
local everness_forsaken_tundra_under_y_min = y_min
-- size = { x = 39, y = 28, z = 39 }
local willow_tree_volume = 39 * 39 * 28
local willow_tree_schem = minetest.get_modpath('everness') .. '/schematics/everness_willow_tree.mts' local willow_tree_schem = minetest.get_modpath('everness') .. '/schematics/everness_willow_tree.mts'
local size = { x = 39, y = 28, z = 39 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local safe_volume = (size.x * size.y * size.z) / 1.5
local y_dis = 1
local willow_tree_place_on = minetest.registered_decorations['everness:forsaken_tundra_under_willow_tree'].place_on
willow_tree_place_on = type(willow_tree_place_on) == 'string' and { willow_tree_place_on } or willow_tree_place_on
minetest.register_on_generated(function(minp, maxp, blockseed) minetest.set_gen_notify({ decoration = true }, { deco_id_everness_forsaken_tundra_under_willow_tree })
local rand = PcgRandom(blockseed)
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip') Everness:add_to_queue_on_generated({
local area = VoxelArea:new({ MinEdge = emin, MaxEdge = emax }) name = 'everness:forsaken_tundra_under',
-- Get the content ID data from the voxelmanip in the form of a flat array. can_run = function(biomemap)
-- Set the buffer parameter to use and reuse 'data' for this. return table.indexof(biomemap, biome_id_everness_forsaken_tundra_under) ~= -1
vm:get_data(data) end,
local sidelength = maxp.x - minp.x + 1 after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
--
-- Willow Tree
--
local x_disp = rand:next(0, disp) for _, pos in ipairs(gennotify['decoration#' .. (deco_id_everness_forsaken_tundra_under_willow_tree or '')] or {}) do
local z_disp = rand:next(0, disp) -- `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 everness_forsaken_tundra_under_y_min < maxp.y if not marker_node then
and maxp.y < everness_forsaken_tundra_under_y_max return
then 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] == c_air and data[vi] == c_mold_stone_with_moss then if marker_node.name ~= 'everness:marker' then
local rotation = rotations[rand:next(1, #rotations)] -- not a valid "place_on" position (e.g. something else was placed there)
local s_pos = area:position(vi) return
local biome_data = minetest.get_biome_data(s_pos) end
if not biome_data then minetest.remove_node(marker_pos)
return
end
local biome_name = minetest.get_biome_name(biome_data.biome) 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
if not biome_name then -- no need to check for the floor "big enough" size since its a tree and has ~ 1x1 base size
return
end
if biome_name == 'everness:forsaken_tundra_under' and rand:next(0, 100) < chance then -- enough air to place structure ?
-- local positions = minetest.find_nodes_in_area(
-- Willow Tree 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
)
local schem_pos = vector.new(s_pos.x, s_pos.y, s_pos.z) local air = positions.air or {}
local air_positions = minetest.find_nodes_in_area( local tree = positions['everness:willow_tree'] or {}
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'},
true
)
if air_positions.air and #air_positions.air > (willow_tree_volume / 2) then if #tree > 1 then
minetest.place_schematic_on_vmanip( -- will overlap another tree
vm, return
schem_pos, end
willow_tree_schem,
rotation,
nil,
true,
'place_center_x, place_center_z'
)
minetest.log('action', '[Everness] Willow Tree was placed at ' .. schem_pos:to_string()) if #air > safe_volume then
end minetest.place_schematic_on_vmanip(
end vm,
vector.new(marker_pos.x, marker_pos.y - y_dis, marker_pos.z),
willow_tree_schem,
'random',
nil,
true,
'place_center_x, place_center_z'
)
-- minetest.log('action', '[Everness] Willow Tree was placed at ' .. pos:to_string())
end end
end end
end end
end) })

View File

@ -120,3 +120,119 @@ Everness:register_decoration({
spawn_by = 'everness:frosted_snowblock', spawn_by = 'everness:frosted_snowblock',
num_spawn_by = 8, 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 -- On Generated
-- --
local size_ceiling = { x = 2, y = 19, z = 2 }
local size_ceiling_x = math.round(size_ceiling.x / 2)
local size_ceiling_z = math.round(size_ceiling.z / 2)
local size_floor = { x = 2, y = 20, z = 2 }
local size_floor_x = math.round(size_floor.x / 2)
local size_floor_z = math.round(size_floor.z / 2)
local deco_id_frosted_icicle_large_ceiling = minetest.get_decoration_id('everness:frosted_icicle_large_ceiling') local deco_id_frosted_icicle_large_ceiling = minetest.get_decoration_id('everness:frosted_icicle_large_ceiling')
local deco_id_frosted_icicle_large_floor = minetest.get_decoration_id('everness:frosted_icicle_large_floor') local deco_id_frosted_icicle_large_floor = minetest.get_decoration_id('everness:frosted_icicle_large_floor')
local biome_id_everness_frosted_icesheet_under = minetest.get_biome_id('everness:frosted_icesheet_under')
minetest.set_gen_notify( minetest.set_gen_notify(
{ decoration = true }, { decoration = true },
{ {
@ -324,75 +333,73 @@ minetest.set_gen_notify(
} }
) )
minetest.register_on_generated(function(minp, maxp, blockseed) Everness:add_to_queue_on_generated({
local gennotify = minetest.get_mapgen_object('gennotify') name = 'everness:frosted_icesheet_under',
local size_ceiling = { x = 2, y = 19, z = 2 } can_run = function(biomemap)
local size_ceiling_x = math.round(size_ceiling.x / 2) return table.indexof(biomemap, biome_id_everness_frosted_icesheet_under) ~= -1
local size_ceiling_z = math.round(size_ceiling.z / 2) end,
local size_floor = { x = 2, y = 20, z = 2 } after_write_to_map = function(shared_args, gennotify)
local size_floor_x = math.round(size_floor.x / 2) --
local size_floor_z = math.round(size_floor.z / 2) -- Frosted Large Icicle Ceiling
--
-- for _, pos in ipairs(gennotify['decoration#' .. deco_id_frosted_icicle_large_ceiling] or {}) do
-- Frosted Large Icicle Ceiling local markers = minetest.find_nodes_in_area(
-- vector.new(pos.x - size_ceiling_x, pos.y - size_ceiling.y + 2, pos.z - size_ceiling_z),
for _, pos in ipairs(gennotify['decoration#' .. deco_id_frosted_icicle_large_ceiling] or {}) do vector.new(pos.x + size_ceiling_x, pos.y - size_ceiling.y, pos.z + size_ceiling_z),
local markers = minetest.find_nodes_in_area( { 'everness:marker' }
vector.new(pos.x - size_ceiling_x, pos.y - size_ceiling.y + 2, pos.z - size_ceiling_z),
vector.new(pos.x + size_ceiling_x, pos.y - size_ceiling.y, pos.z + size_ceiling_z),
{ 'everness:marker' }
)
if #markers > 0 then
local pos_marker = markers[1]
local air_below = minetest.find_nodes_in_area(
vector.new(pos_marker.x, pos_marker.y, pos_marker.z),
vector.new(pos_marker.x, pos_marker.y - 7, pos_marker.z),
{'air'}
) )
-- Replace marker if #markers > 0 then
minetest.set_node(pos_marker, { name = 'everness:frosted_cave_ice_illuminating' }) local pos_marker = markers[1]
local air_below = minetest.find_nodes_in_area(
vector.new(pos_marker.x, pos_marker.y, pos_marker.z),
vector.new(pos_marker.x, pos_marker.y - 7, pos_marker.z),
{'air'}
)
if #air_below == 7 then -- Replace marker
local incrementer = 1 minetest.set_node(pos_marker, { name = 'everness:frosted_cave_ice_illuminating' })
local pos_below = vector.new(pos_marker.x, pos_marker.y - incrementer, pos_marker.z)
local node_below = minetest.get_node(pos_below)
Everness.stack_icicle_recursive(node_below, pos_below, incrementer, pos_marker, 'down') if #air_below == 7 then
local incrementer = 1
local pos_below = vector.new(pos_marker.x, pos_marker.y - incrementer, pos_marker.z)
local node_below = minetest.get_node(pos_below)
Everness.stack_icicle_recursive(node_below, pos_below, incrementer, pos_marker, 'down')
end
end
end
--
-- Frosted Large Icicle Floor
--
for _, pos in ipairs(gennotify['decoration#' .. deco_id_frosted_icicle_large_floor] or {}) do
local markers = minetest.find_nodes_in_area(
vector.new(pos.x - size_floor_x, pos.y + size_floor.y - 2, pos.z - size_floor_z),
vector.new(pos.x + size_floor_x, pos.y + size_floor.y, pos.z + size_floor_z),
{ 'everness:marker' }
)
if #markers > 0 then
local pos_marker = markers[1]
local air_above = minetest.find_nodes_in_area(
vector.new(pos_marker.x, pos_marker.y, pos_marker.z),
vector.new(pos_marker.x, pos_marker.y + 7, pos_marker.z),
{'air'}
)
-- Replace marker
minetest.set_node(pos_marker, { name = 'everness:frosted_cave_ice_illuminating' })
-- Make sure we have some space
if #air_above == 7 then
local incrementer = 1
local pos_above = vector.new(pos_marker.x, pos_marker.y + incrementer, pos_marker.z)
local node_above = minetest.get_node(pos_above)
Everness.stack_icicle_recursive(node_above, pos_above, incrementer, pos_marker, 'up')
end
end end
end end
end end
})
--
-- Frosted Large Icicle Floor
--
for _, pos in ipairs(gennotify['decoration#' .. deco_id_frosted_icicle_large_floor] or {}) do
local markers = minetest.find_nodes_in_area(
vector.new(pos.x - size_floor_x, pos.y + size_floor.y - 2, pos.z - size_floor_z),
vector.new(pos.x + size_floor_x, pos.y + size_floor.y, pos.z + size_floor_z),
{ 'everness:marker' }
)
if #markers > 0 then
local pos_marker = markers[1]
local air_above = minetest.find_nodes_in_area(
vector.new(pos_marker.x, pos_marker.y, pos_marker.z),
vector.new(pos_marker.x, pos_marker.y + 7, pos_marker.z),
{'air'}
)
-- Replace marker
minetest.set_node(pos_marker, { name = 'everness:frosted_cave_ice_illuminating' })
-- Make sure we have some space
if #air_above == 7 then
local incrementer = 1
local pos_above = vector.new(pos_marker.x, pos_marker.y + incrementer, pos_marker.z)
local node_above = minetest.get_node(pos_above)
Everness.stack_icicle_recursive(node_above, pos_above, incrementer, pos_marker, 'up')
end
end
end
end)

View File

@ -239,6 +239,13 @@ local c_water_weeds = {
c_everness_mineral_water_weed_2 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 function find_irecursive(table, c_id)
local found = false local found = false
@ -294,11 +301,6 @@ local function place_decoration(pos, vm, area, data, deco_id, callback)
end end
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 }, { minetest.set_gen_notify({ decoration = true }, {
d_everness_palm_trees, d_everness_palm_trees,
d_everness_water_geyser, d_everness_water_geyser,
@ -306,29 +308,14 @@ minetest.set_gen_notify({ decoration = true }, {
d_rose_bush d_rose_bush
}) })
-- Called after generating a piece of world. Modifying nodes inside the area is a bit faster than usual. Everness:add_to_queue_on_generated({
minetest.register_on_generated(function(minp, maxp, blockseed) name = 'everness:mineral_waters',
-- Start time of mapchunk generation. can_run = function(biomemap)
-- local t0 = os.clock() return table.indexof(biomemap, biome_id_everness_mineral_waters) ~= -1
-- Returns an array containing the biome IDs of nodes in the most recently generated chunk by the current mapgen end,
local biomemap = minetest.get_mapgen_object('biomemap') on_data = function(minp, maxp, area, data, p2data, gennotify, rand, shared_args)
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)
local rand_version = rand:next(1, 2) local rand_version = rand:next(1, 2)
-- Load the voxelmanip with the result of engine mapgen local chest_positions = {}
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 pot_pos = {} local pot_pos = {}
if rand_version == 1 then if rand_version == 1 then
@ -564,6 +551,7 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end end
-- Place decorations after generating (2nd pass) -- Place decorations after generating (2nd pass)
-- luacheck: ignore 512
for y = minp.y, maxp.y do for y = minp.y, maxp.y do
for z = minp.z, maxp.z do for z = minp.z, maxp.z do
for x = minp.x, maxp.x 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 for j = -radius, radius do
local idx = ai + i + (area.zstride * j) + area.ystride local idx = ai + i + (area.zstride * j) + area.ystride
local distance = math.round(vector.distance(area:position(ai), area:position(idx))) 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 if chance_lotus_leaf > chance_max then
chance = chance_max chance_lotus_leaf = chance_max
end end
if if
rand:next(0, 100) < chance rand:next(0, 100) < chance_lotus_leaf
and data[idx] == minetest.CONTENT_AIR and data[idx] == minetest.CONTENT_AIR
and data[idx - area.ystride] == c_everness_mineral_water_source and data[idx - area.ystride] == c_everness_mineral_water_source
then then
@ -721,12 +709,84 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end end
end end
vm:set_data(data) -- Set `shared_args`
vm:set_param2_data(p2data) 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 -- Place Decorations
-- --
local pot_pos = shared_args.pot_pos or {}
-- --
-- Palm Trees -- Palm Trees
@ -820,25 +880,32 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
inv:set_stack('main', 1, stack) inv:set_stack('main', 1, stack)
end end
end end
end,
-- Set the lighting within the `VoxelManip` to a uniform value after_write_to_map = function(shared_args)
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()
-- Populate loot chest inventory -- 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) Everness:populate_loot_chests(chest_positions)
end end
end
-- Print generation time of this mapchunk. -- Populate loot chest inventory for schematics
-- local chugent = math.ceil((os.clock() - t0) * 1000) local schem_positions = shared_args.schem_positions or {}
-- print('[lvm_example] Mapchunk generation time ' .. chugent .. ' ms')
end) 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 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 -- Quartz
stairs.register_stair_and_slab( stairs.register_stair_and_slab(
@ -131,6 +170,17 @@ stairs.register_stair_and_slab(
true 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 -- Coral Wood
stairs.register_stair_and_slab( stairs.register_stair_and_slab(
@ -203,6 +253,39 @@ stairs.register_stair_and_slab(
true 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 -- Baobab Wood
stairs.register_stair_and_slab( stairs.register_stair_and_slab(

View File

@ -163,3 +163,85 @@ walls.register(
'everness:crystal_mossy_cobble', 'everness:crystal_mossy_cobble',
Everness.node_sound_stone_defaults() 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()
)