Merge on generated calls

This commit is contained in:
Juraj Vajda 2024-02-07 08:47:36 -05:00
parent 4db7e9930e
commit 466cfd4258
24 changed files with 5398 additions and 607 deletions

13
api.lua
View File

@ -236,7 +236,8 @@ Everness = {
registered_craftitems = {},
registered_biomes = {},
registered_decorations = {},
registered_ores = {}
registered_ores = {},
on_generated_queue = {}
}
function Everness.grow_cactus(self, pos, node, params)
@ -2117,3 +2118,13 @@ function Everness.find_content_in_vm_area(minp, maxp, contentIds, data, area)
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

View File

@ -16,173 +16,78 @@
-- 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')
local water_level = tonumber(minetest.settings:get('water_level')) or 1
-- Localize data buffer table outside the loop, to be re-used for all
-- mapchunks, therefore minimising memory use.
local data = {}
-- MTG
local chance = 20
local chance_sea_level = 10
local disp = 16
local water_level = tonumber(minetest.settings:get('water_level')) or 1
local schem_jungle_temple = minetest.get_modpath('everness') .. '/schematics/everness_jungle_temple.mts'
local size_jungle_temple = { x = 12, y = 14, z = 15 }
local size_jungle_temple_x = math.round(size_jungle_temple.x / 2)
local size_jungle_temple_z = math.round(size_jungle_temple.z / 2)
local y_dis_jungle_temple = 3
minetest.register_on_generated(function(minp, maxp, blockseed)
local rand = PcgRandom(blockseed)
local biomemap = minetest.get_mapgen_object('biomemap')
-- Load the voxelmanip with the result of engine mapgen
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
-- 'area' is used later to get the voxelmanip indexes for positions
local area = VoxelArea:new({ MinEdge = emin, MaxEdge = emax })
-- Get the content ID data from the voxelmanip in the form of a flat array.
-- Set the buffer parameter to use and reuse 'data' for this.
vm:get_data(data)
-- Side length of mapchunk
local biome_id_rainforest = minetest.get_biome_id('rainforest')
local biome_id_rainforest_swamp = minetest.get_biome_id('rainforest_swamp')
Everness:add_to_queue_on_generated({
name = 'default:rainforest_and_rainforest_swamp',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_rainforest) ~= -1
or table.indexof(biomemap, biome_id_rainforest_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)
local schem_positions = {}
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
if data[vi + area.ystride] == minetest.CONTENT_AIR
and data[vi] == c_dirt_with_rainforest_litter
and rand:next(0, 100) < chance
then
local s_pos = area:position(vi)
if maxp.y >= water_level then
-- Above sea level or at water level
if
(
data[vi] == c_dirt_with_grass_1
or data[vi] == c_dirt_with_grass_extras_1
or data[vi] == c_dirt_with_grass_extras_2
)
and rand:next(0, 100) < chance
then
local schem = minetest.get_modpath('everness') .. '/schematics/everness_japanese_shrine.mts'
--
-- 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'
)
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)
local schem_pos = vector.new(s_pos.x, s_pos.y - y_dis_jungle_temple, 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),
vector.new(s_pos.x - size_jungle_temple_x, s_pos.y - 1, s_pos.z - size_jungle_temple_z),
vector.new(s_pos.x + size_jungle_temple_x, s_pos.y + 1, s_pos.z + size_jungle_temple_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),
vector.new(s_pos.x - size_jungle_temple_x, s_pos.y - 1, s_pos.z - size_jungle_temple_z),
vector.new(s_pos.x + size_jungle_temple_x, s_pos.y + 1, s_pos.z + size_jungle_temple_z),
{
'group:tree',
'group:flower',
@ -193,15 +98,15 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
}
)
if #positions + #force_positions < size.x * size.z then
if #positions + #force_positions < size_jungle_temple.x * size_jungle_temple.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),
vector.new(s_pos.x - size_jungle_temple_x, s_pos.y, s_pos.z - size_jungle_temple_z),
vector.new(s_pos.x + size_jungle_temple_x, s_pos.y + size_jungle_temple.y, s_pos.z + size_jungle_temple_z),
{
'air',
'group:tree',
@ -210,216 +115,111 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
}
)
if #air_positions > (size.x * size.y * size.z) / 2 then
if #air_positions > (size_jungle_temple.x * size_jungle_temple.y * size_jungle_temple.z) / 2 then
minetest.place_schematic_on_vmanip(
vm,
schem_pos,
schem,
schem_jungle_temple,
'random',
nil,
true,
'place_center_x, place_center_z'
)
schem_positions.everness_jungle_temple = schem_positions.everness_jungle_temple or {}
shared_args.schem_positions.everness_jungle_temple = shared_args.schem_positions.everness_jungle_temple or {}
table.insert(schem_positions.everness_jungle_temple, {
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)
minp = vector.new(s_pos.x - size_jungle_temple_x, s_pos.y - y_dis_jungle_temple, s_pos.z - size_jungle_temple_z),
maxp = vector.new(s_pos.x + size_jungle_temple_x, s_pos.y - y_dis_jungle_temple + size_jungle_temple.y, s_pos.z + size_jungle_temple_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
end
end,
after_write_to_map = function(shared_args)
local schem_positions = shared_args.schem_positions or {}
-- 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'
}
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 #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)
if #chest_positions > 0 then
Everness:populate_loot_chests(chest_positions)
end
end
end
end
end
})
minetest.log('action', '[Everness] Haunted House was placed at ' .. schem_pos:to_string())
-- Localize data buffer table outside the loop, to be re-used for all
-- mapchunks, therefore minimising memory use.
local data = {}
local p2data = {}
minetest.register_on_generated(function(minp, maxp, blockseed)
local rand = PcgRandom(blockseed)
local biomemap = minetest.get_mapgen_object('biomemap')
local gennotify = minetest.get_mapgen_object('gennotify')
-- Load the voxelmanip with the result of engine mapgen
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
-- 'area' is used later to get the voxelmanip indexes for positions
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)
-- Side length of mapchunk
local sidelength = maxp.x - minp.x + 1
local x_disp = rand:next(0, disp)
local z_disp = rand:next(0, disp)
local schem_positions = {}
local shared_args = {}
-- on_data
-- read/write to `data` what will be eventually saved (set_data)
-- used for voxelmanip `data` manipulation
for _, def in ipairs(Everness.on_generated_queue) do
if def.can_run(biomemap) and def.on_data then
shared_args[def.name] = shared_args[def.name] or {}
-- print('--- on_data', def.name, minp:to_string(), maxp:to_string())
def.on_data(minp, maxp, area, data, p2data, gennotify, rand, shared_args[def.name])
-- print('shared_args', dump(shared_args))
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'
}
)
-- set data after they have been manipulated (above)
vm:set_data(data)
vm:set_param2_data(p2data)
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())
-- after_set_data
-- can read (but cant and should not manipulate) voxelmanip `data`
-- used for `place_schematic_on_vmanip` which will invalidate `data` therefore we are doing it after we set the data
for _, def in ipairs(Everness.on_generated_queue) do
if def.can_run(biomemap) and def.after_set_data then
shared_args[def.name] = shared_args[def.name] or {}
-- print('after_set_data', def.name, minp:to_string(), maxp:to_string())
def.after_set_data(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args[def.name])
end
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'
for y = minp.y, maxp.y do
local vi = area:index(minp.x + sidelength / 2 + x_disp, y, minp.z + sidelength / 2 + z_disp)
--
-- Forsaken Desert Temple
--
if data[vi + area.ystride] == minetest.CONTENT_AIR then
local s_pos = area:position(vi)
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
if maxp.y >= water_level then
-- Above sea level or at water level
if
(
data[vi] == c_dirt_with_snow
or data[vi] == c_dirt_with_coniferous_litter
@ -473,71 +273,6 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
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
@ -678,76 +413,6 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
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
@ -918,7 +583,20 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
vm:update_liquids()
-- Write what has been created to the world.
vm:write_to_map()
minetest.fix_light(minp, maxp)
-- after_write_to_map
-- Cannot read/write voxelmanip or its data
-- Used for direct manipulation of the world chunk nodes where the definitions of nodes are available and node callback can be executed
-- minetest.fix_light(minp, maxp)
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 {}
-- print('after_write_to_map', def.name, minp:to_string(), maxp:to_string())
def.after_write_to_map(shared_args[def.name])
end
end
-- Populate loot chests
for name, tbl in pairs(schem_positions) do

View File

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

View File

@ -172,6 +172,8 @@ register_dry_grass_decoration(0.07, -0.01, 1)
-- On Generated
--
local biome_id_baobab_savanna = minetest.get_biome_id('everness:baobab_savanna')
local deco_ids_baobab = {
minetest.get_decoration_id('everness:baobab_savanna_baobab_tree_1'),
minetest.get_decoration_id('everness:baobab_savanna_baobab_tree_2')
@ -181,17 +183,19 @@ if #deco_ids_baobab > 1 then
minetest.set_gen_notify({ decoration = true }, deco_ids_baobab)
end
minetest.register_on_generated(function(minp, maxp, blockseed)
local gennotify = minetest.get_mapgen_object('gennotify')
if maxp.y > 0 then
Everness:add_to_queue_on_generated({
name = 'everness:baobab_savanna',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_baobab_savanna) ~= -1
end,
on_data = function(minp, maxp, area, data, p2data, gennotify, rand)
--
-- Baobab Tree - fix light
--
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))
end
end
end
end)
})

View File

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

View File

@ -178,3 +178,123 @@ Everness:register_decoration({
y_min = y_min,
decoration = 'everness:coral_shrub'
})
--
-- On Generated
--
local disp = 16
local chance_sea_level = 10
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 = {}
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
and rand:next(0, 100) < chance_sea_level
-- 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())
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,123 @@ Everness:register_decoration({
'everness:coral_skeleton'
},
})
--
-- On Generated
--
local disp = 16
local chance_sea_level = 10
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 = {}
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
and rand:next(0, 100) < chance_sea_level
-- 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())
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

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

View File

@ -139,3 +139,122 @@ Everness:register_decoration({
flags = 'place_center_x, place_center_z',
rotation = 'random',
})
--
-- On Generated
--
local chance = 20
local disp = 16
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 c_crystal_sand = minetest.get_content_id('everness:crystal_sand')
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
and data[vi] == c_crystal_sand
and rand:next(0, 100) < chance
then
local s_pos = area:position(vi)
--
-- 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
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

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

View File

@ -161,3 +161,113 @@ Everness:register_decoration({
flags = 'place_center_x, place_center_z',
rotation = 'random',
})
--
-- 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 c_cursed_sand = minetest.get_content_id('everness:cursed_sand')
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
and data[vi] == c_cursed_sand
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, 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,
'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
end
end,
after_write_to_map = function(shared_args)
local schem_positions = shared_args.schem_positions or {}
for name, tbl in pairs(schem_positions) do
if next(tbl) then
for i, v in ipairs(tbl) do
local chest_positions = minetest.find_nodes_in_area(
v.minp,
v.maxp,
{ 'everness:chest' }
)
if #chest_positions > 0 then
Everness:populate_loot_chests(chest_positions)
end
end
end
end
end
})

View File

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

View File

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

View File

@ -44,6 +44,113 @@ Everness:register_biome({
humidity_point = 30,
})
--
-- 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

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

View File

@ -294,11 +294,6 @@ local function place_decoration(pos, vm, area, data, deco_id, callback)
end
end
-- Localize data buffer table outside the loop, to be re-used for all
-- mapchunks, therefore minimising memory use
local data = {}
local p2data = {}
minetest.set_gen_notify({ decoration = true }, {
d_everness_palm_trees,
d_everness_water_geyser,
@ -307,28 +302,14 @@ minetest.set_gen_notify({ decoration = true }, {
})
-- Called after generating a piece of world. Modifying nodes inside the area is a bit faster than usual.
minetest.register_on_generated(function(minp, maxp, blockseed)
-- Start time of mapchunk generation.
-- local t0 = os.clock()
-- Returns an array containing the biome IDs of nodes in the most recently generated chunk by the current mapgen
local biomemap = minetest.get_mapgen_object('biomemap')
local chest_positions = {}
-- Above sea level
if maxp.y >= y_min and table.indexof(biomemap, biome_id_everness_mineral_waters) ~= -1 then
local rand = PcgRandom(blockseed)
Everness:add_to_queue_on_generated({
name = 'everness:mineral_waters',
can_run = function(biomemap)
return table.indexof(biomemap, biome_id_everness_mineral_waters) ~= -1
end,
on_data = function(minp, maxp, area, data, p2data, gennotify, rand, shared_args)
local rand_version = rand:next(1, 2)
-- Load the voxelmanip with the result of engine mapgen
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
-- Returns a table mapping requested generation notification types to arrays of positions at which the corresponding generated structures are located within the current chunk
local gennotify = minetest.get_mapgen_object('gennotify')
-- 'area' is used later to get the voxelmanip indexes for positions
local area = VoxelArea:new({ MinEdge = emin, MaxEdge = emax })
-- Get the content ID data from the voxelmanip in the form of a flat array.
-- Set the buffer parameter to use and reuse 'data' for this.
vm:get_data(data)
vm:get_param2_data(p2data)
local chest_positions = {}
local pot_pos = {}
if rand_version == 1 then
@ -564,6 +545,7 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end
-- Place decorations after generating (2nd pass)
-- luacheck: ignore 512
for y = minp.y, maxp.y do
for z = minp.z, maxp.z do
for x = minp.x, maxp.x do
@ -721,12 +703,15 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end
end
vm:set_data(data)
vm:set_param2_data(p2data)
-- Set `shared_args`
shared_args.chest_positions = chest_positions
shared_args.pot_pos = pot_pos
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
--
-- Place Decorations
--
local pot_pos = shared_args.pot_pos or {}
--
-- Palm Trees
@ -820,25 +805,14 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
inv:set_stack('main', 1, stack)
end
end
-- Set the lighting within the `VoxelManip` to a uniform value
vm:set_lighting({ day = 0, night = 0 }, minp, maxp)
-- Calculate lighting for what has been created.
vm:calc_lighting()
-- Liquid nodes were placed so set them flowing.
vm:update_liquids()
-- Write what has been created to the world.
vm:write_to_map()
end,
after_write_to_map = function(shared_args)
-- Populate loot chest inventory
local chest_positions = shared_args.chest_positions or {}
local chest_def = minetest.registered_nodes['everness:chest']
if chest_def and next(chest_positions) then
Everness:populate_loot_chests(chest_positions)
end
end
-- Print generation time of this mapchunk.
-- local chugent = math.ceil((os.clock() - t0) * 1000)
-- print('[lvm_example] Mapchunk generation time ' .. chugent .. ' ms')
end)
})

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

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

View File

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