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_craftitems = {},
registered_biomes = {}, registered_biomes = {},
registered_decorations = {}, registered_decorations = {},
registered_ores = {} registered_ores = {},
on_generated_queue = {}
} }
function Everness.grow_cactus(self, pos, node, params) function Everness.grow_cactus(self, pos, node, params)
@ -2117,3 +2118,13 @@ function Everness.find_content_in_vm_area(minp, maxp, contentIds, data, area)
return indexes, id_count return indexes, id_count
end 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. -- Get the content IDs for the nodes used.
local c_water_source = minetest.get_content_id('mapgen_water_source') 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_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_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_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_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_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_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_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_water_source = minetest.get_content_id('everness:mineral_water_source')
local c_everness_mineral_sand = minetest.get_content_id('everness:mineral_sand') local c_everness_mineral_sand = minetest.get_content_id('everness:mineral_sand')
-- Biome IDs -- Biome IDs
local biome_id_everness_cursed_lands_dunes = minetest.get_biome_id('everness:cursed_lands_dunes') 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_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_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_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_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 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 -- MTG
-- mapchunks, therefore minimising memory use.
local data = {}
local chance = 20 local chance = 20
local chance_sea_level = 10 local chance_sea_level = 10
local disp = 16 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 biome_id_rainforest = minetest.get_biome_id('rainforest')
local rand = PcgRandom(blockseed) local biome_id_rainforest_swamp = minetest.get_biome_id('rainforest_swamp')
local biomemap = minetest.get_mapgen_object('biomemap')
-- Load the voxelmanip with the result of engine mapgen Everness:add_to_queue_on_generated({
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip') name = 'default:rainforest_and_rainforest_swamp',
-- 'area' is used later to get the voxelmanip indexes for positions can_run = function(biomemap)
local area = VoxelArea:new({ MinEdge = emin, MaxEdge = emax }) return table.indexof(biomemap, biome_id_rainforest) ~= -1
-- Get the content ID data from the voxelmanip in the form of a flat array. or table.indexof(biomemap, biome_id_rainforest_swamp) ~= -1
-- Set the buffer parameter to use and reuse 'data' for this. end,
vm:get_data(data) after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
-- Side length of mapchunk
local sidelength = maxp.x - minp.x + 1 local sidelength = maxp.x - minp.x + 1
local x_disp = rand:next(0, disp) local x_disp = rand:next(0, disp)
local z_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 for y = minp.y, maxp.y do
local vi = area:index(minp.x + sidelength / 2 + x_disp, y, minp.z + sidelength / 2 + z_disp) local vi = area:index(minp.x + sidelength / 2 + x_disp, y, minp.z + sidelength / 2 + z_disp)
if data[vi + area.ystride] == minetest.CONTENT_AIR 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) 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 -- 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 -- 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 -- find floor big enough
local positions = minetest.find_nodes_in_area_under_air( 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_jungle_temple_x, s_pos.y - 1, s_pos.z - size_jungle_temple_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),
{ {
'default:dirt_with_rainforest_litter' 'default:dirt_with_rainforest_litter'
} }
) )
-- Can force over these blocks -- Can force over these blocks
local force_positions = minetest.find_nodes_in_area( 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_jungle_temple_x, s_pos.y - 1, s_pos.z - size_jungle_temple_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),
{ {
'group:tree', 'group:tree',
'group:flower', '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 -- not enough space
return return
end end
-- enough air to place structure ? -- enough air to place structure ?
local air_positions = minetest.find_nodes_in_area( 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_jungle_temple_x, s_pos.y, s_pos.z - size_jungle_temple_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 + size_jungle_temple.y, s_pos.z + size_jungle_temple_z),
{ {
'air', 'air',
'group:tree', '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( minetest.place_schematic_on_vmanip(
vm, vm,
schem_pos, schem_pos,
schem, schem_jungle_temple,
'random', 'random',
nil, nil,
true, true,
'place_center_x, place_center_z' '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, pos = schem_pos,
minp = vector.new(s_pos.x - size_x, s_pos.y - y_dis, 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_x, s_pos.y - y_dis + size.y, s_pos.z + size_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()) minetest.log('action', '[Everness] Jungle Temple was placed at ' .. schem_pos:to_string())
end end
elseif end
data[vi] == c_dirt_with_cursed_grass end
and rand:next(0, 100) < chance end,
then after_write_to_map = function(shared_args)
local schem = minetest.get_modpath('everness') .. '/schematics/everness_haunted_house.mts' local schem_positions = shared_args.schem_positions or {}
-- for name, tbl in pairs(schem_positions) do
-- Haunted House if next(tbl) then
-- for i, v in ipairs(tbl) do
local chest_positions = minetest.find_nodes_in_area(
local size = { x = 11, y = 22, z = 10 } v.minp,
local size_x = math.round(size.x / 2) v.maxp,
local size_z = math.round(size.z / 2) { 'everness:chest' }
-- 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 if #chest_positions > 0 then
-- not enough space Everness:populate_loot_chests(chest_positions)
return end
end
end
end
end
})
-- Localize data buffer table outside the loop, to be re-used for all
-- mapchunks, therefore minimising memory use.
local data = {}
local p2data = {}
minetest.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
end end
-- enough air to place structure ? -- set data after they have been manipulated (above)
local air_positions = minetest.find_nodes_in_area( vm:set_data(data)
vector.new(s_pos.x - size_x, s_pos.y, s_pos.z - size_z), vm:set_param2_data(p2data)
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 -- after_set_data
minetest.place_schematic_on_vmanip( -- can read (but cant and should not manipulate) voxelmanip `data`
vm, -- used for `place_schematic_on_vmanip` which will invalidate `data` therefore we are doing it after we set the data
schem_pos, for _, def in ipairs(Everness.on_generated_queue) do
schem, if def.can_run(biomemap) and def.after_set_data then
'random', shared_args[def.name] = shared_args[def.name] or {}
nil, -- print('after_set_data', def.name, minp:to_string(), maxp:to_string())
true, def.after_set_data(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args[def.name])
'place_center_x, place_center_z'
)
schem_positions.everness_haunted_house = schem_positions.everness_haunted_house or {}
table.insert(schem_positions.everness_haunted_house, {
pos = schem_pos,
minp = vector.new(s_pos.x - size_x, s_pos.y - y_dis, s_pos.z - size_z),
maxp = vector.new(s_pos.x + size_x, s_pos.y - y_dis + size.y, s_pos.z + size_z)
})
minetest.log('action', '[Everness] Haunted House was placed at ' .. schem_pos:to_string())
end 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 end
-- enough air to place structure ? for y = minp.y, maxp.y do
local air_positions = minetest.find_nodes_in_area( local vi = area:index(minp.x + sidelength / 2 + x_disp, y, minp.z + sidelength / 2 + z_disp)
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 if data[vi + area.ystride] == minetest.CONTENT_AIR then
minetest.place_schematic_on_vmanip( local s_pos = area:position(vi)
vm,
schem_pos,
schem,
'random',
nil,
true,
'place_center_x, place_center_z'
)
schem_positions.everness_quartz_temple = schem_positions.everness_quartz_temple or {} if maxp.y >= water_level then
-- Above sea level or at water level
table.insert(schem_positions.everness_quartz_temple, { if
pos = schem_pos,
minp = vector.new(s_pos.x - size_x, s_pos.y, s_pos.z - size_z),
maxp = vector.new(s_pos.x + size_x, s_pos.y + size.y, s_pos.z + size_z)
})
minetest.log('action', '[Everness] Quartz Temple was placed at ' .. schem_pos:to_string())
end
elseif
(
data[vi] == c_forsaken_desert_sand
or data[vi] == c_dry_ocean_dirt
)
and rand:next(0, 100) < chance
then
local schem = minetest.get_modpath('everness') .. '/schematics/everness_forsaken_desert_temple.mts'
--
-- Forsaken Desert Temple
--
local size = { x = 9, y = 16, z = 9 }
local size_x = math.round(size.x / 2)
local size_z = math.round(size.z / 2)
local schem_pos = vector.new(s_pos)
-- find floor big enough
local positions = minetest.find_nodes_in_area_under_air(
vector.new(s_pos.x - size_x, s_pos.y - 1, s_pos.z - size_z),
vector.new(s_pos.x + size_x, s_pos.y + 1, s_pos.z + size_z),
{
'everness:forsaken_desert_sand',
'everness:dry_ocean_dirt'
}
)
if #positions < size.x * size.z then
-- not enough space
return
end
-- enough air to place structure ?
local air_positions = minetest.find_nodes_in_area(
vector.new(s_pos.x - size_x, s_pos.y, s_pos.z - size_z),
vector.new(s_pos.x + size_x, s_pos.y + size.y, s_pos.z + size_z),
{
'air'
}
)
if #air_positions > (size.x * size.y * size.z) / 2 then
minetest.place_schematic_on_vmanip(
vm,
schem_pos,
schem,
'random',
nil,
true,
'place_center_x, place_center_z'
)
schem_positions.everness_forsaken_desert_temple = schem_positions.everness_forsaken_desert_temple or {}
table.insert(schem_positions.everness_forsaken_desert_temple, {
pos = schem_pos,
minp = vector.new(s_pos.x - size_x, s_pos.y, s_pos.z - size_z),
maxp = vector.new(s_pos.x + size_x, s_pos.y + size.y, s_pos.z + size_z)
})
minetest.log('action', '[Everness] Forsaken Desert Temple was placed at ' .. schem_pos:to_string())
end
elseif
( (
data[vi] == c_dirt_with_snow data[vi] == c_dirt_with_snow
or data[vi] == c_dirt_with_coniferous_litter or data[vi] == c_dirt_with_coniferous_litter
@ -473,71 +273,6 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end 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 elseif
( (
data[vi] == c_everness_mineral_water_source 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()) minetest.log('action', '[Everness] Cursed Lands Deep Ocean Island was placed at ' .. schem_pos:to_string())
end 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 elseif
( (
table.indexof(biomemap, biome_id_everness_crystal_forest_dunes) ~= -1 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() vm:update_liquids()
-- Write what has been created to the world. -- Write what has been created to the world.
vm:write_to_map() vm:write_to_map()
minetest.fix_light(minp, maxp)
-- 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 -- Populate loot chests
for name, tbl in pairs(schem_positions) do 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 -- On Generated
-- --
local data = {} local disp = 16
local p2data = {} local chance = 20
local schem = minetest.get_modpath('everness') .. '/schematics/everness_japanese_shrine.mts'
local c_everness_bamboo_1 = minetest.get_content_id('everness:bamboo_1')
local c_everness_bamboo_3 = minetest.get_content_id('everness:bamboo_3') local c_everness_bamboo_3 = minetest.get_content_id('everness:bamboo_3')
local c_everness_bamboo_4 = minetest.get_content_id('everness:bamboo_4') local c_everness_bamboo_4 = minetest.get_content_id('everness:bamboo_4')
local c_everness_bamboo_5 = minetest.get_content_id('everness:bamboo_5') local c_everness_bamboo_5 = minetest.get_content_id('everness:bamboo_5')
local c_dirt_with_grass_1 = minetest.get_content_id('everness:dirt_with_grass_1')
local c_dirt_with_grass_extras_1 = minetest.get_content_id('everness:dirt_with_grass_extras_1')
local c_dirt_with_grass_extras_2 = minetest.get_content_id('everness:dirt_with_grass_extras_2')
local biome_id_bamboo_forest = minetest.get_biome_id('everness:bamboo_forest')
local d_everness_bamboo_forest_large_bamboo = minetest.get_decoration_id('everness:bamboo_forest_large_bamboo') local d_everness_bamboo_forest_large_bamboo = minetest.get_decoration_id('everness:bamboo_forest_large_bamboo')
minetest.set_gen_notify({ decoration = true }, { d_everness_bamboo_forest_large_bamboo }) minetest.set_gen_notify({ decoration = true }, { d_everness_bamboo_forest_large_bamboo })
minetest.register_on_generated(function(minp, maxp, blockseed) Everness:add_to_queue_on_generated({
-- Load the voxelmanip with the result of engine mapgen name = 'everness:bamboo_forest',
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip') can_run = function(biomemap)
-- 'area' is used later to get the voxelmanip indexes for positions return table.indexof(biomemap, biome_id_bamboo_forest) ~= -1
local area = VoxelArea:new({ MinEdge = emin, MaxEdge = emax }) end,
-- Get the content ID data from the voxelmanip in the form of a flat array. on_data = function(minp, maxp, area, data, p2data, gennotify, rand, shared_args)
-- Set the buffer parameter to use and reuse 'data' for this.
vm:get_data(data)
vm:get_param2_data(p2data)
local gennotify = minetest.get_mapgen_object('gennotify')
-- --
-- Bamboo -- Bamboo
-- --
@ -321,11 +322,119 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end end
end 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) for y = minp.y, maxp.y do
vm:set_param2_data(p2data) local vi = area:index(minp.x + sidelength / 2 + x_disp, y, minp.z + sidelength / 2 + z_disp)
-- Calculate lighting for what has been created.
vm:calc_lighting() if
-- Write what has been created to the world. (
vm:write_to_map() data[vi + area.ystride] == minetest.CONTENT_AIR
end) 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 -- On Generated
-- --
local biome_id_baobab_savanna = minetest.get_biome_id('everness:baobab_savanna')
local deco_ids_baobab = { local deco_ids_baobab = {
minetest.get_decoration_id('everness:baobab_savanna_baobab_tree_1'), minetest.get_decoration_id('everness:baobab_savanna_baobab_tree_1'),
minetest.get_decoration_id('everness:baobab_savanna_baobab_tree_2') minetest.get_decoration_id('everness:baobab_savanna_baobab_tree_2')
@ -181,17 +183,19 @@ if #deco_ids_baobab > 1 then
minetest.set_gen_notify({ decoration = true }, deco_ids_baobab) minetest.set_gen_notify({ decoration = true }, deco_ids_baobab)
end end
minetest.register_on_generated(function(minp, maxp, blockseed) Everness:add_to_queue_on_generated({
local gennotify = minetest.get_mapgen_object('gennotify') name = 'everness:baobab_savanna',
can_run = function(biomemap)
if maxp.y > 0 then return table.indexof(biomemap, biome_id_baobab_savanna) ~= -1
end,
on_data = function(minp, maxp, area, data, p2data, gennotify, rand)
-- --
-- Baobab Tree - fix light -- Baobab Tree - fix light
-- --
for _, deco_id in ipairs(deco_ids_baobab) do for _, deco_id in ipairs(deco_ids_baobab) do
for _, pos in ipairs(gennotify['decoration#' .. deco_id] or {}) do for _, pos in ipairs(gennotify['decoration#' .. (deco_id or '')] or {}) do
minetest.fix_light(vector.offset(pos, -1, -1, -1), vector.offset(pos, 24, 39, 24)) minetest.fix_light(vector.offset(pos, -1, -1, -1), vector.offset(pos, 24, 39, 24))
end end
end end
end end
end) })

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -294,11 +294,6 @@ local function place_decoration(pos, vm, area, data, deco_id, callback)
end end
end end
-- Localize data buffer table outside the loop, to be re-used for all
-- mapchunks, therefore minimising memory use
local data = {}
local p2data = {}
minetest.set_gen_notify({ decoration = true }, { minetest.set_gen_notify({ decoration = true }, {
d_everness_palm_trees, d_everness_palm_trees,
d_everness_water_geyser, d_everness_water_geyser,
@ -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. -- 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) Everness:add_to_queue_on_generated({
-- Start time of mapchunk generation. name = 'everness:mineral_waters',
-- local t0 = os.clock() can_run = function(biomemap)
-- Returns an array containing the biome IDs of nodes in the most recently generated chunk by the current mapgen return table.indexof(biomemap, biome_id_everness_mineral_waters) ~= -1
local biomemap = minetest.get_mapgen_object('biomemap') end,
local chest_positions = {} on_data = function(minp, maxp, area, data, p2data, gennotify, rand, shared_args)
-- Above sea level
if maxp.y >= y_min and table.indexof(biomemap, biome_id_everness_mineral_waters) ~= -1 then
local rand = PcgRandom(blockseed)
local rand_version = rand:next(1, 2) local rand_version = rand:next(1, 2)
-- Load the voxelmanip with the result of engine mapgen local chest_positions = {}
local vm, emin, emax = minetest.get_mapgen_object('voxelmanip')
-- Returns a table mapping requested generation notification types to arrays of positions at which the corresponding generated structures are located within the current chunk
local gennotify = minetest.get_mapgen_object('gennotify')
-- 'area' is used later to get the voxelmanip indexes for positions
local area = VoxelArea:new({ MinEdge = emin, MaxEdge = emax })
-- Get the content ID data from the voxelmanip in the form of a flat array.
-- Set the buffer parameter to use and reuse 'data' for this.
vm:get_data(data)
vm:get_param2_data(p2data)
local pot_pos = {} local pot_pos = {}
if rand_version == 1 then if rand_version == 1 then
@ -564,6 +545,7 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end end
-- Place decorations after generating (2nd pass) -- Place decorations after generating (2nd pass)
-- luacheck: ignore 512
for y = minp.y, maxp.y do for y = minp.y, maxp.y do
for z = minp.z, maxp.z do for z = minp.z, maxp.z do
for x = minp.x, maxp.x do for x = minp.x, maxp.x do
@ -721,12 +703,15 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
end end
end end
vm:set_data(data) -- Set `shared_args`
vm:set_param2_data(p2data) shared_args.chest_positions = chest_positions
shared_args.pot_pos = pot_pos
end,
after_set_data = function(minp, maxp, vm, area, data, p2data, gennotify, rand, shared_args)
-- --
-- Place Decorations -- Place Decorations
-- --
local pot_pos = shared_args.pot_pos or {}
-- --
-- Palm Trees -- Palm Trees
@ -820,25 +805,14 @@ minetest.register_on_generated(function(minp, maxp, blockseed)
inv:set_stack('main', 1, stack) inv:set_stack('main', 1, stack)
end end
end end
end,
-- Set the lighting within the `VoxelManip` to a uniform value after_write_to_map = function(shared_args)
vm:set_lighting({ day = 0, night = 0 }, minp, maxp)
-- Calculate lighting for what has been created.
vm:calc_lighting()
-- Liquid nodes were placed so set them flowing.
vm:update_liquids()
-- Write what has been created to the world.
vm:write_to_map()
-- Populate loot chest inventory -- Populate loot chest inventory
local chest_positions = shared_args.chest_positions or {}
local chest_def = minetest.registered_nodes['everness:chest'] local chest_def = minetest.registered_nodes['everness:chest']
if chest_def and next(chest_positions) then if chest_def and next(chest_positions) then
Everness:populate_loot_chests(chest_positions) Everness:populate_loot_chests(chest_positions)
end end
end end
})
-- Print generation time of this mapchunk.
-- local chugent = math.ceil((os.clock() - t0) * 1000)
-- print('[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 true
) )
stairs.register_stair_and_slab(
'cursed_sandstone_block',
'everness:cursed_sandstone_block',
{ cracky = 2 },
{ 'everness_cursed_sandstone_block.png' },
'Cursed Sandstone Block Stair',
'Cursed Sandstone Block Slab',
Everness.node_sound_stone_defaults(),
true
)
stairs.register_stair_and_slab(
'cursed_sandstone_brick',
'everness:cursed_sandstone_brick',
{ cracky = 2 },
{ 'everness_cursed_sandstone_brick.png' },
'Cursed Sandstone Brick Stair',
'Cursed Sandstone Brick Slab',
Everness.node_sound_stone_defaults(),
true
)
stairs.register_stair_and_slab(
'cursed_stone_carved',
'everness:cursed_stone_carved',
{ cracky = 2 },
{
{
name = 'everness_cursed_stone_carved.png',
align_style = 'world',
scale = 2
}
},
'Cursed Stone Carved Stair',
'Cursed Stone Carved Slab',
Everness.node_sound_stone_defaults(),
true
)
-- Quartz -- Quartz
stairs.register_stair_and_slab( stairs.register_stair_and_slab(
@ -131,6 +170,17 @@ stairs.register_stair_and_slab(
true true
) )
stairs.register_stair_and_slab(
'dry_tree',
'everness:dry_tree',
{ choppy = 2, oddly_breakable_by_hand = 2, flammable = 2 },
{ 'everness_dry_tree_top.png', 'everness_dry_tree_top.png', 'everness_dry_tree.png' },
S('Dry Tree Trunk Stair'),
S('Dry Tree Trunk Slab'),
Everness.node_sound_wood_defaults(),
true
)
-- Coral Wood -- Coral Wood
stairs.register_stair_and_slab( stairs.register_stair_and_slab(
@ -203,6 +253,39 @@ stairs.register_stair_and_slab(
true true
) )
stairs.register_stair_and_slab(
'forsaken_desert_engraved_stone',
'everness:forsaken_desert_engraved_stone',
{ cracky = 2, stone = 1 },
{ 'everness_forsaken_desert_engraved_stone.png' },
S('Forsaken Desert Engraved Stone Stair'),
S('Forsaken Desert Engraved Stone Slab'),
Everness.node_sound_stone_defaults(),
true
)
stairs.register_stair_and_slab(
'forsaken_desert_cobble',
'everness:forsaken_desert_cobble',
{ cracky = 2, stone = 1 },
{ 'everness_forsaken_desert_cobble.png' },
S('Forsaken Desert Cobblestone Stair'),
S('Forsaken Desert Cobblestone Slab'),
Everness.node_sound_stone_defaults(),
true
)
stairs.register_stair_and_slab(
'forsaken_desert_cobble_red',
'everness:forsaken_desert_cobble_red',
{ cracky = 2, stone = 1 },
{ 'everness_forsaken_desert_cobble_red.png' },
S('Forsaken Desert Cobblestone Red Stair'),
S('Forsaken Desert Cobblestone Red Slab'),
Everness.node_sound_stone_defaults(),
true
)
-- Baobab Wood -- Baobab Wood
stairs.register_stair_and_slab( stairs.register_stair_and_slab(

View File

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