diff --git a/.luacheckrc b/.luacheckrc index bffcc44..36b4451 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -75,4 +75,5 @@ read_globals = { "xpanes", "XTumbleweed", "x_obsidianmese", + "x_farming", } diff --git a/.luarc.json b/.luarc.json index ab6ba88..55ef361 100644 --- a/.luarc.json +++ b/.luarc.json @@ -109,7 +109,8 @@ "walls", "stairs", "XTumbleweed", - "x_obsidianmese" + "x_obsidianmese", + "x_farming" ] } } diff --git a/README.md b/README.md index afb246c..fd8d2c6 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ https://bitbucket.org/minetest_gamers/everness/issues - walls - x_obsidianmese (for paths) - x_tumbleweed (adds tumbleweeds to deserts) +- x_farming (bonemeal, recipes...) ## License diff --git a/init.lua b/init.lua index 72be55f..e9eeb8f 100644 --- a/init.lua +++ b/init.lua @@ -178,7 +178,7 @@ end -- Mod Support -- -if minetest.get_modpath('x_farming') then +if minetest.get_modpath('x_farming') and minetest.global_exists('x_farming') then dofile(path .. '/mod_support_x_farming.lua') end @@ -188,6 +188,7 @@ end if minetest.get_modpath('x_obsidianmese') and minetest.global_exists('x_obsidianmese') + -- backwards compatibility check and x_obsidianmese.register_path_node then dofile(path .. '/mod_support_x_obsidianmese.lua') diff --git a/mod.conf b/mod.conf index 38ae196..58c085d 100644 --- a/mod.conf +++ b/mod.conf @@ -1,6 +1,6 @@ name = everness description = Never ending discovery in Everness mapgen. depends = default -optional_depends = xpanes, doors, stairs, walls, x_obsidianmese, x_tumbleweed +optional_depends = xpanes, doors, stairs, walls, x_obsidianmese, x_tumbleweed, x_farming supported_games = minetest_game min_minetest_version = 5.4 diff --git a/mod_support_x_farming.lua b/mod_support_x_farming.lua index 1890cec..e1964b8 100644 --- a/mod_support_x_farming.lua +++ b/mod_support_x_farming.lua @@ -16,6 +16,101 @@ License along with this library; if not, write to juraj.vajda@gmail.com --]] +-- +-- Bonemeal Trees +-- + +x_farming.x_bonemeal:register_tree_defs({ + { + -- sapling name + name = 'everness:coral_tree_sapling', + -- 1 out of `chance`, e.g. 2 = 50% chance + chance = 3, + -- grow tree from sapling + grow_tree = Everness.grow_sapling + }, + { + -- sapling name + name = 'everness:coral_tree_bioluminescent_sapling', + -- 1 out of `chance`, e.g. 2 = 50% chance + chance = 3, + -- grow tree from sapling + grow_tree = Everness.grow_sapling + }, + { + -- sapling name + name = 'everness:crystal_bush_sapling', + -- 1 out of `chance`, e.g. 2 = 50% chance + chance = 3, + -- grow tree from sapling + grow_tree = Everness.grow_sapling + }, + { + -- sapling name + name = 'everness:cursed_bush_sapling', + -- 1 out of `chance`, e.g. 2 = 50% chance + chance = 3, + -- grow tree from sapling + grow_tree = Everness.grow_sapling + }, + { + -- sapling name + name = 'everness:baobab_sapling', + -- 1 out of `chance`, e.g. 2 = 50% chance + chance = 3, + -- grow tree from sapling + grow_tree = Everness.grow_sapling + }, + { + -- sapling name + name = 'everness:dry_tree_sapling', + -- 1 out of `chance`, e.g. 2 = 50% chance + chance = 3, + -- grow tree from sapling + grow_tree = Everness.grow_sapling + }, + { + -- sapling name + name = 'everness:willow_tree_sapling', + -- 1 out of `chance`, e.g. 2 = 50% chance + chance = 3, + -- grow tree from sapling + grow_tree = Everness.grow_sapling + }, + { + -- sapling name + name = 'everness:sequoia_tree_sapling', + -- 1 out of `chance`, e.g. 2 = 50% chance + chance = 3, + -- grow tree from sapling + grow_tree = Everness.grow_sapling + }, + { + -- sapling name + name = 'everness:crystal_tree_sapling', + -- 1 out of `chance`, e.g. 2 = 50% chance + chance = 3, + -- grow tree from sapling + grow_tree = Everness.grow_sapling + }, + { + -- sapling name + name = 'everness:crystal_tree_large_sapling', + -- 1 out of `chance`, e.g. 2 = 50% chance + chance = 3, + -- grow tree from sapling + grow_tree = Everness.grow_sapling + }, + { + -- sapling name + name = 'everness:cursed_dream_tree_sapling', + -- 1 out of `chance`, e.g. 2 = 50% chance + chance = 3, + -- grow tree from sapling + grow_tree = Everness.grow_sapling + }, +}) + -- -- Recipes -- diff --git a/trees.lua b/trees.lua index c5b89c9..e0652e5 100644 --- a/trees.lua +++ b/trees.lua @@ -54,6 +54,20 @@ function Everness.grow_willow_tree(pos) local path = minetest.get_modpath('everness') .. '/schematics/everness_willow_tree_from_sapling.mts' minetest.place_schematic({ x = pos.x - 19, y = pos.y, z = pos.z - 19 }, path, 'random', nil, false) + + -- trigger vines + minetest.after(1, function(v_pos) + local size = { x = 39, y = 27, z = 39 } + local positions = minetest.find_nodes_in_area( + vector.round(vector.new(v_pos.x - (size.x / 2), v_pos.y, v_pos.z - (size.z / 2))), + vector.round(vector.new(v_pos.x + (size.x / 2), v_pos.y + size.y, v_pos.z + (size.z / 2))), + { 'group:vine' } + ) + + for _, vine_pos in ipairs(positions) do + Everness:tick_vine(vine_pos) + end + end, pos) end function Everness.grow_sequoia_tree(pos)