forked from mtcontrib/bonemeal
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
a200c9913e | |||
be412804df | |||
d6893aae07 | |||
81f36673d3 |
217
init.lua
217
init.lua
@ -1,50 +1,45 @@
|
||||
|
||||
-- MineClonia / VoxeLibre check
|
||||
|
||||
local mcl = core.get_modpath("mcl_core")
|
||||
|
||||
-- global
|
||||
|
||||
bonemeal = {
|
||||
item_list = {
|
||||
bucket_water = "bucket:bucket_water",
|
||||
bucket_empty = "bucket:bucket_empty",
|
||||
dirt = "default:dirt",
|
||||
torch = "default:torch",
|
||||
coral = "default:coral_skeleton"
|
||||
bucket_water = mcl and "mcl_buckets:bucket_water" or "bucket:bucket_water",
|
||||
bucket_empty = mcl and "mcl_buckets:bucker_empty" or "bucket:bucket_empty",
|
||||
dirt = mcl and "mcl_core:dirt" or "default:dirt",
|
||||
torch = mcl and "mcl_torches:torch" or "default:torch",
|
||||
coral = mcl and "mcl_ocean:dead_horn_coral_block" or "default:coral_skeleton"
|
||||
}
|
||||
}
|
||||
|
||||
-- translation support and vars
|
||||
|
||||
local S = core.get_translator("bonemeal")
|
||||
local a = bonemeal.item_list
|
||||
|
||||
if minetest.get_modpath("mcl_core") then
|
||||
|
||||
a.bucket_water = "mcl_buckets:bucket_water"
|
||||
a.bucket_empty = "mcl_buckets:bucker_empty"
|
||||
a.dirt = "mcl_core:dirt"
|
||||
a.torch = "mcl_torches:torch"
|
||||
a.coral = "mcl_ocean:dead_horn_coral_block"
|
||||
end
|
||||
|
||||
|
||||
local path = minetest.get_modpath("bonemeal")
|
||||
local path = core.get_modpath("bonemeal")
|
||||
local min, max, random = math.min, math.max, math.random
|
||||
|
||||
-- translation support
|
||||
local S = minetest.get_translator("bonemeal")
|
||||
-- creative check helper
|
||||
|
||||
-- creative check
|
||||
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
|
||||
local creative_mode_cache = core.settings:get_bool("creative_mode")
|
||||
function bonemeal.is_creative(name)
|
||||
return creative_mode_cache or minetest.check_player_privs(name, {creative = true})
|
||||
return creative_mode_cache or core.check_player_privs(name, {creative = true})
|
||||
end
|
||||
|
||||
-- API tables
|
||||
|
||||
local crops = {}
|
||||
local saplings = {}
|
||||
local deco = {}
|
||||
|
||||
--
|
||||
-- local functions
|
||||
--
|
||||
-- particle effect
|
||||
|
||||
-- particles
|
||||
local function particle_effect(pos)
|
||||
|
||||
minetest.add_particlespawner({
|
||||
core.add_particlespawner({
|
||||
amount = 4,
|
||||
time = 0.15,
|
||||
minpos = pos,
|
||||
@ -62,38 +57,31 @@ local function particle_effect(pos)
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
-- tree type check
|
||||
|
||||
local function grow_tree(pos, object)
|
||||
|
||||
if type(object) == "table" and object.axiom then
|
||||
|
||||
-- grow L-system tree
|
||||
minetest.remove_node(pos)
|
||||
minetest.spawn_tree(pos, object)
|
||||
core.remove_node(pos)
|
||||
core.spawn_tree(pos, object) -- grow L-system tree
|
||||
|
||||
elseif type(object) == "string" and minetest.registered_nodes[object] then
|
||||
elseif type(object) == "string" and core.registered_nodes[object] then
|
||||
|
||||
-- place node
|
||||
minetest.set_node(pos, {name = object})
|
||||
core.set_node(pos, {name = object}) -- place node
|
||||
|
||||
elseif type(object) == "function" then
|
||||
|
||||
-- function
|
||||
object(pos)
|
||||
object(pos) -- execute function
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- sapling check
|
||||
|
||||
local function check_sapling(pos, sapling_node, strength, light_ok)
|
||||
|
||||
-- what is sapling placed on?
|
||||
local under = minetest.get_node({
|
||||
x = pos.x,
|
||||
y = pos.y - 1,
|
||||
z = pos.z
|
||||
})
|
||||
local under = core.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
|
||||
local can_grow, grow_on
|
||||
|
||||
@ -114,7 +102,7 @@ local function check_sapling(pos, sapling_node, strength, light_ok)
|
||||
|
||||
local group = grow_on:split(":")[2]
|
||||
|
||||
if minetest.get_item_group(under.name, group) > 0 then
|
||||
if core.get_item_group(under.name, group) > 0 then
|
||||
can_grow = true
|
||||
end
|
||||
|
||||
@ -138,8 +126,8 @@ local function check_sapling(pos, sapling_node, strength, light_ok)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- crops check
|
||||
|
||||
local function check_crops(pos, nodename, strength, light_ok)
|
||||
|
||||
local mod, crop, stage, nod, def
|
||||
@ -169,7 +157,7 @@ local function check_crops(pos, nodename, strength, light_ok)
|
||||
|
||||
-- check for place_param setting
|
||||
nod = crops[n][1] .. stage
|
||||
def = minetest.registered_nodes[nod]
|
||||
def = core.registered_nodes[nod]
|
||||
|
||||
-- make sure crop exists or isn't fully grown already
|
||||
if not def or nod == nodename then
|
||||
@ -178,19 +166,19 @@ local function check_crops(pos, nodename, strength, light_ok)
|
||||
|
||||
def = def and def.place_param2 or 0
|
||||
|
||||
minetest.set_node(pos, {name = nod, param2 = def})
|
||||
core.set_node(pos, {name = nod, param2 = def})
|
||||
|
||||
particle_effect(pos)
|
||||
|
||||
minetest.get_node_timer(pos):start(10) -- restart any timers
|
||||
core.get_node_timer(pos):start(10) -- restart any timers
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- check soil for specific decoration placement
|
||||
|
||||
local function check_soil(pos, nodename, strength)
|
||||
|
||||
-- set radius according to strength
|
||||
@ -198,7 +186,7 @@ local function check_soil(pos, nodename, strength)
|
||||
local tall = max(strength - 2, 0)
|
||||
|
||||
-- get area of land with free space above
|
||||
local dirt = minetest.find_nodes_in_area_under_air(
|
||||
local dirt = core.find_nodes_in_area_under_air(
|
||||
{x = pos.x - side, y = pos.y - tall, z = pos.z - side},
|
||||
{x = pos.x + side, y = pos.y + tall, z = pos.z + side}, {nodename})
|
||||
|
||||
@ -247,43 +235,39 @@ local function check_soil(pos, nodename, strength)
|
||||
if nod and nod ~= "" then
|
||||
|
||||
-- get crop param2 value
|
||||
def = minetest.registered_nodes[nod]
|
||||
def = core.registered_nodes[nod]
|
||||
def = def and def.place_param2
|
||||
|
||||
-- if param2 not preset then get from existing node
|
||||
if not def then
|
||||
|
||||
local node = minetest.get_node_or_nil(pos2)
|
||||
local node = core.get_node_or_nil(pos2)
|
||||
|
||||
def = node and node.param2 or 0
|
||||
end
|
||||
|
||||
minetest.set_node(pos2, {name = nod, param2 = def})
|
||||
core.set_node(pos2, {name = nod, param2 = def})
|
||||
end
|
||||
|
||||
particle_effect(pos2)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- helper function
|
||||
|
||||
local function use_checks(user, pointed_thing)
|
||||
|
||||
-- make sure we use on node
|
||||
if pointed_thing.type ~= "node" then
|
||||
return false
|
||||
end
|
||||
if pointed_thing.type ~= "node" then return false end
|
||||
|
||||
-- get position and node info
|
||||
local pos = pointed_thing.under
|
||||
local node = minetest.get_node(pos)
|
||||
local def = minetest.registered_items[node.name]
|
||||
local node = core.get_node(pos)
|
||||
local def = core.registered_items[node.name]
|
||||
local dirt = def and def.groups
|
||||
|
||||
-- does node have groups set
|
||||
if not dirt then
|
||||
return false
|
||||
end
|
||||
if not dirt then return false end
|
||||
|
||||
-- if we're using on ground, move position up
|
||||
if dirt.soil or dirt.sand or dirt.can_bonemeal then
|
||||
@ -291,16 +275,14 @@ local function use_checks(user, pointed_thing)
|
||||
end
|
||||
|
||||
-- check if protected
|
||||
if minetest.is_protected(pos, user:get_player_name()) then
|
||||
if core.is_protected(pos, user:get_player_name()) then
|
||||
return false
|
||||
end
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
|
||||
-- global functions
|
||||
|
||||
--= Global functions
|
||||
|
||||
-- add to sapling list
|
||||
-- {sapling node, schematic or function name, "soil"|"sand"|specific_node|"group:"}
|
||||
@ -313,10 +295,10 @@ function bonemeal:add_sapling(list)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- add to crop list to force grow
|
||||
-- {crop name start_, growth steps, seed node (if required)}
|
||||
-- e.g. {"farming:wheat_", 8, "farming:seed_wheat"}
|
||||
|
||||
function bonemeal:add_crop(list)
|
||||
|
||||
for n = 1, #list do
|
||||
@ -324,12 +306,12 @@ function bonemeal:add_crop(list)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- add grass and flower/plant decoration for specific dirt types
|
||||
-- {dirt_node, {grass_nodes}, {flower_nodes}
|
||||
-- e.g. {"default:dirt_with_dry_grass", dry_grass, flowers}
|
||||
-- if an entry already exists for a given dirt type, it will add new entries and all empty
|
||||
-- entries, allowing to both add decorations and decrease their frequency.
|
||||
|
||||
function bonemeal:add_deco(list)
|
||||
|
||||
for l = 1, #list do
|
||||
@ -347,8 +329,7 @@ function bonemeal:add_deco(list)
|
||||
for _, entry in pairs(deco[n][2]) do
|
||||
|
||||
if extra == entry then
|
||||
extra = false
|
||||
break
|
||||
extra = false ; break
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -366,8 +347,7 @@ function bonemeal:add_deco(list)
|
||||
for __, entry in pairs(deco[n][3]) do
|
||||
|
||||
if extra == entry then
|
||||
extra = false
|
||||
break
|
||||
extra = false ; break
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -377,8 +357,7 @@ function bonemeal:add_deco(list)
|
||||
end
|
||||
end
|
||||
|
||||
list[l] = false
|
||||
break
|
||||
list[l] = false ; break
|
||||
end
|
||||
end
|
||||
|
||||
@ -388,9 +367,9 @@ function bonemeal:add_deco(list)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- definitively set a decration scheme
|
||||
-- this function will either add a new entry as is, or replace the existing one
|
||||
|
||||
function bonemeal:set_deco(list)
|
||||
|
||||
for l = 1, #list do
|
||||
@ -415,17 +394,15 @@ function bonemeal:set_deco(list)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- global on_use function for bonemeal
|
||||
|
||||
function bonemeal:on_use(pos, strength, node)
|
||||
|
||||
-- get node pointed at
|
||||
local node = node or minetest.get_node(pos)
|
||||
local node = node or core.get_node(pos)
|
||||
|
||||
-- return if nothing there
|
||||
if node.name == "ignore" then
|
||||
return
|
||||
end
|
||||
if node.name == "ignore" then return end
|
||||
|
||||
-- make sure strength is between 1 and 4
|
||||
strength = strength or 1
|
||||
@ -437,31 +414,25 @@ function bonemeal:on_use(pos, strength, node)
|
||||
|
||||
default.grow_papyrus(pos, node)
|
||||
|
||||
particle_effect(pos)
|
||||
|
||||
return true
|
||||
particle_effect(pos) ; return true
|
||||
|
||||
elseif node.name == "default:cactus" then
|
||||
|
||||
default.grow_cactus(pos, node)
|
||||
|
||||
particle_effect(pos)
|
||||
|
||||
return true
|
||||
particle_effect(pos) ; return true
|
||||
|
||||
elseif node.name == "default:dry_dirt" and strength == 1 then
|
||||
|
||||
minetest.set_node(pos, {name = "default:dry_dirt_with_dry_grass"})
|
||||
core.set_node(pos, {name = "default:dry_dirt_with_dry_grass"})
|
||||
|
||||
particle_effect(pos)
|
||||
|
||||
return true
|
||||
particle_effect(pos) ; return true
|
||||
end
|
||||
|
||||
-- grow grass and flowers
|
||||
if minetest.get_item_group(node.name, "soil") > 0
|
||||
or minetest.get_item_group(node.name, "sand") > 0
|
||||
or minetest.get_item_group(node.name, "can_bonemeal") > 0 then
|
||||
if core.get_item_group(node.name, "soil") > 0
|
||||
or core.get_item_group(node.name, "sand") > 0
|
||||
or core.get_item_group(node.name, "can_bonemeal") > 0 then
|
||||
|
||||
check_soil(pos, node.name, strength)
|
||||
|
||||
@ -471,7 +442,7 @@ function bonemeal:on_use(pos, strength, node)
|
||||
-- light check depending on strength (strength of 4 = no light needed)
|
||||
local light_ok = true
|
||||
|
||||
if (minetest.get_node_light(pos) or 0) < (12 - (strength * 3)) then
|
||||
if (core.get_node_light(pos) or 0) < (12 - (strength * 3)) then
|
||||
light_ok = nil
|
||||
end
|
||||
|
||||
@ -486,14 +457,11 @@ function bonemeal:on_use(pos, strength, node)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- items
|
||||
--
|
||||
|
||||
--= Items
|
||||
|
||||
-- mulch (strength 1)
|
||||
minetest.register_craftitem("bonemeal:mulch", {
|
||||
|
||||
core.register_craftitem("bonemeal:mulch", {
|
||||
description = S("Mulch"),
|
||||
inventory_image = "bonemeal_mulch.png",
|
||||
|
||||
@ -517,9 +485,9 @@ minetest.register_craftitem("bonemeal:mulch", {
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
-- bonemeal (strength 2)
|
||||
minetest.register_craftitem("bonemeal:bonemeal", {
|
||||
|
||||
core.register_craftitem("bonemeal:bonemeal", {
|
||||
description = S("Bone Meal"),
|
||||
inventory_image = "bonemeal_item.png",
|
||||
|
||||
@ -543,9 +511,9 @@ minetest.register_craftitem("bonemeal:bonemeal", {
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
-- fertiliser (strength 3)
|
||||
minetest.register_craftitem("bonemeal:fertiliser", {
|
||||
|
||||
core.register_craftitem("bonemeal:fertiliser", {
|
||||
description = S("Fertiliser"),
|
||||
inventory_image = "bonemeal_fertiliser.png",
|
||||
|
||||
@ -569,28 +537,27 @@ minetest.register_craftitem("bonemeal:fertiliser", {
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
-- bone
|
||||
minetest.register_craftitem("bonemeal:bone", {
|
||||
|
||||
core.register_craftitem("bonemeal:bone", {
|
||||
description = S("Bone"),
|
||||
inventory_image = "bonemeal_bone.png",
|
||||
groups = {bone = 1}
|
||||
})
|
||||
|
||||
-- gelatin powder
|
||||
minetest.register_craftitem("bonemeal:gelatin_powder", {
|
||||
|
||||
core.register_craftitem("bonemeal:gelatin_powder", {
|
||||
description = S("Gelatin Powder"),
|
||||
inventory_image = "bonemeal_gelatin_powder.png",
|
||||
groups = {food_gelatin = 1, flammable = 2}
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- crafting recipes
|
||||
--
|
||||
--= Recipes
|
||||
|
||||
-- gelatin powder
|
||||
minetest.register_craft({
|
||||
|
||||
core.register_craft({
|
||||
output = "bonemeal:gelatin_powder 4",
|
||||
recipe = {
|
||||
{"group:bone", "group:bone", "group:bone"},
|
||||
@ -603,7 +570,8 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
-- bonemeal (from bone)
|
||||
minetest.register_craft({
|
||||
|
||||
core.register_craft({
|
||||
type = "cooking",
|
||||
output = "bonemeal:bonemeal 2",
|
||||
recipe = "group:bone",
|
||||
@ -611,22 +579,25 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
-- bonemeal (from player bones)
|
||||
if minetest.settings:get_bool("bonemeal.disable_deathbones_recipe") ~= true then
|
||||
|
||||
minetest.register_craft({
|
||||
if core.settings:get_bool("bonemeal.disable_deathbones_recipe") ~= true then
|
||||
|
||||
core.register_craft({
|
||||
output = "bonemeal:bone 2",
|
||||
recipe = {{"bones:bones"}}
|
||||
})
|
||||
end
|
||||
|
||||
-- bonemeal (from coral skeleton)
|
||||
minetest.register_craft({
|
||||
|
||||
core.register_craft({
|
||||
output = "bonemeal:bonemeal 2",
|
||||
recipe = {{a.coral}}
|
||||
})
|
||||
|
||||
-- mulch
|
||||
minetest.register_craft({
|
||||
|
||||
core.register_craft({
|
||||
output = "bonemeal:mulch 4",
|
||||
recipe = {
|
||||
{"group:tree", "group:leaves", "group:leaves"},
|
||||
@ -635,7 +606,7 @@ minetest.register_craft({
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
core.register_craft({
|
||||
output = "bonemeal:mulch",
|
||||
recipe = {
|
||||
{"group:seed", "group:seed", "group:seed"},
|
||||
@ -645,15 +616,17 @@ minetest.register_craft({
|
||||
})
|
||||
|
||||
-- fertiliser
|
||||
minetest.register_craft({
|
||||
|
||||
core.register_craft({
|
||||
output = "bonemeal:fertiliser 2",
|
||||
recipe = {{"bonemeal:bonemeal", "bonemeal:mulch"}}
|
||||
})
|
||||
|
||||
-- add bones to dirt
|
||||
if minetest.registered_items[a.dirt] then
|
||||
|
||||
minetest.override_item(a.dirt, {
|
||||
if core.registered_items[a.dirt] then
|
||||
|
||||
core.override_item(a.dirt, {
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
@ -670,10 +643,12 @@ if minetest.registered_items[a.dirt] then
|
||||
end
|
||||
|
||||
-- add support for mods
|
||||
|
||||
dofile(path .. "/mods.lua")
|
||||
|
||||
-- lucky block support
|
||||
if minetest.get_modpath("lucky_block") then
|
||||
|
||||
if core.get_modpath("lucky_block") then
|
||||
dofile(path .. "/lucky_block.lua")
|
||||
end
|
||||
|
||||
|
@ -1,15 +1,16 @@
|
||||
|
||||
-- add lucky blocks
|
||||
-- helper function
|
||||
|
||||
local function growy(pos, player)
|
||||
|
||||
local dpos = minetest.find_node_near(pos, 1, "group:soil")
|
||||
local dpos = core.find_node_near(pos, 1, "group:soil")
|
||||
|
||||
if dpos then
|
||||
bonemeal:on_use(dpos, 5)
|
||||
end
|
||||
end
|
||||
|
||||
-- add lucky blocks
|
||||
|
||||
lucky_block:add_blocks({
|
||||
{"lig"},
|
||||
|
112
mods.lua
112
mods.lua
@ -1,21 +1,23 @@
|
||||
|
||||
-- craft bones from animalmaterials into bonemeal
|
||||
if minetest.get_modpath("animalmaterials") then
|
||||
|
||||
minetest.register_craft({
|
||||
if core.get_modpath("animalmaterials") then
|
||||
|
||||
core.register_craft({
|
||||
output = "bonemeal:bonemeal 2",
|
||||
recipe = {{"animalmaterials:bone"}}
|
||||
})
|
||||
end
|
||||
|
||||
-- default additions
|
||||
|
||||
if minetest.get_modpath("default") then
|
||||
if core.get_modpath("default") then
|
||||
|
||||
-- saplings
|
||||
|
||||
local function pine_grow(pos)
|
||||
|
||||
if minetest.find_node_near(pos, 1,
|
||||
if core.find_node_near(pos, 1,
|
||||
{"default:snow", "default:snowblock", "default:dirt_with_snow"}) then
|
||||
|
||||
default.grow_new_snowy_pine_tree(pos)
|
||||
@ -25,11 +27,11 @@ if minetest.get_modpath("default") then
|
||||
end
|
||||
|
||||
local function cactus_grow(pos)
|
||||
default.grow_cactus(pos, minetest.get_node(pos))
|
||||
default.grow_cactus(pos, core.get_node(pos))
|
||||
end
|
||||
|
||||
local function papyrus_grow(pos)
|
||||
default.grow_papyrus(pos, minetest.get_node(pos))
|
||||
default.grow_papyrus(pos, core.get_node(pos))
|
||||
end
|
||||
|
||||
bonemeal:add_sapling({
|
||||
@ -62,9 +64,10 @@ if minetest.get_modpath("default") then
|
||||
|
||||
local flowers = {}
|
||||
|
||||
minetest.after(0.1, function()
|
||||
-- add flowers from other mods
|
||||
core.after(0.1, function()
|
||||
|
||||
for node, def in pairs(minetest.registered_nodes) do
|
||||
for node, def in pairs(core.registered_nodes) do
|
||||
|
||||
if def.groups
|
||||
and def.groups.flower
|
||||
@ -92,6 +95,7 @@ if minetest.get_modpath("default") then
|
||||
})
|
||||
end
|
||||
|
||||
-- default farming crops
|
||||
|
||||
if farming then
|
||||
|
||||
@ -101,6 +105,7 @@ if farming then
|
||||
})
|
||||
end
|
||||
|
||||
-- farming redo crops
|
||||
|
||||
if farming and farming.mod and farming.mod == "redo" then
|
||||
|
||||
@ -148,8 +153,9 @@ if farming and farming.mod and farming.mod == "redo" then
|
||||
})
|
||||
end
|
||||
|
||||
-- ethereal crops, saplings and grass
|
||||
|
||||
if minetest.get_modpath("ethereal") then
|
||||
if core.get_modpath("ethereal") then
|
||||
|
||||
bonemeal:add_crop({
|
||||
{"ethereal:strawberry_", 8},
|
||||
@ -174,7 +180,8 @@ if minetest.get_modpath("ethereal") then
|
||||
{"ethereal:sakura_sapling", ethereal.grow_sakura_tree, "soil"},
|
||||
{"ethereal:lemon_tree_sapling", ethereal.grow_lemon_tree, "soil"},
|
||||
{"ethereal:olive_tree_sapling", ethereal.grow_olive_tree, "soil"},
|
||||
{"ethereal:basandra_bush_sapling", ethereal.grow_basandra_bush, "soil"}
|
||||
{"ethereal:basandra_bush_sapling", ethereal.grow_basandra_bush, "soil"},
|
||||
{"ethereal:mangrove_sapling", ethereal.grow_mangrove_tree, "soil"}
|
||||
})
|
||||
|
||||
local grass = {"default:grass_3", "default:grass_4", "default:grass_5", ""}
|
||||
@ -191,17 +198,20 @@ if minetest.get_modpath("ethereal") then
|
||||
"ethereal:spore_grass", "ethereal:spore_grass", "", "", ""}},
|
||||
{"ethereal:jungle_dirt", grass, {"default:junglegrass", "", "", ""}},
|
||||
{"ethereal:grove_dirt", grass, {"ethereal:fern", "", "", ""}},
|
||||
{"ethereal:bamboo_dirt", grass, {}}
|
||||
{"ethereal:bamboo_dirt", grass, {}},
|
||||
{"ethereal:mud", {"default:fern_1", "default:fern_2", "default:fern_3", "", "",
|
||||
"default:grass_5", "default:junglegrass"}, {"ethereal:bamboo"}}
|
||||
})
|
||||
end
|
||||
|
||||
-- moretrees saplings
|
||||
|
||||
if minetest.get_modpath("moretrees") then
|
||||
if core.get_modpath("moretrees") then
|
||||
|
||||
-- special fir check for snow
|
||||
local function fir_grow(pos)
|
||||
|
||||
if minetest.find_node_near(pos, 1,
|
||||
if core.find_node_near(pos, 1,
|
||||
{"default:snow", "default:snowblock", "default:dirt_with_snow"}) then
|
||||
|
||||
moretrees.grow_fir_snow(pos)
|
||||
@ -228,23 +238,27 @@ if minetest.get_modpath("moretrees") then
|
||||
{"moretrees:rubber_tree_sapling", moretrees.spawn_rubber_tree_object, "soil"},
|
||||
{"moretrees:fir_sapling", fir_grow, "soil"}
|
||||
})
|
||||
end
|
||||
|
||||
elseif minetest.get_modpath("technic_worldgen") then
|
||||
-- technic rubber tree
|
||||
|
||||
if core.get_modpath("technic_worldgen") then
|
||||
|
||||
bonemeal:add_sapling({
|
||||
{"moretrees:rubber_tree_sapling", technic.rubber_tree_model, "soil"}
|
||||
})
|
||||
end
|
||||
|
||||
-- caverealms mushroom
|
||||
|
||||
if minetest.get_modpath("caverealms") then
|
||||
if core.get_modpath("caverealms") then
|
||||
|
||||
local fil = minetest.get_modpath("caverealms") .. "/schematics/shroom.mts"
|
||||
local fil = core.get_modpath("caverealms") .. "/schematics/shroom.mts"
|
||||
local add_shroom = function(pos)
|
||||
|
||||
minetest.swap_node(pos, {name = "air"})
|
||||
core.swap_node(pos, {name = "air"})
|
||||
|
||||
minetest.place_schematic(
|
||||
core.place_schematic(
|
||||
{x = pos.x - 5, y = pos.y, z = pos.z - 5}, fil, 0, nil, false)
|
||||
end
|
||||
|
||||
@ -253,6 +267,7 @@ if minetest.get_modpath("caverealms") then
|
||||
})
|
||||
end
|
||||
|
||||
-- helper
|
||||
|
||||
local function y_func(grow_func)
|
||||
return function(pos)
|
||||
@ -260,30 +275,38 @@ local function y_func(grow_func)
|
||||
end
|
||||
end
|
||||
|
||||
if minetest.get_modpath("ferns") then
|
||||
-- ferns
|
||||
|
||||
if core.get_modpath("ferns") then
|
||||
|
||||
bonemeal:add_sapling({
|
||||
{"ferns:sapling_giant_tree_fern", y_func(abstract_ferns.grow_giant_tree_fern), "soil"},
|
||||
{"ferns:sapling_giant_tree_fern", y_func(abstract_ferns.grow_giant_tree_fern), "sand"},
|
||||
{"ferns:sapling_tree_fern", y_func(abstract_ferns.grow_tree_fern), "soil"}
|
||||
{"ferns:sapling_giant_tree_fern",
|
||||
y_func(abstract_ferns.grow_giant_tree_fern), "soil"},
|
||||
{"ferns:sapling_giant_tree_fern",
|
||||
y_func(abstract_ferns.grow_giant_tree_fern), "sand"},
|
||||
{"ferns:sapling_tree_fern",
|
||||
y_func(abstract_ferns.grow_tree_fern), "soil"}
|
||||
})
|
||||
end
|
||||
|
||||
if minetest.get_modpath("dryplants") then
|
||||
-- dryplants sapling
|
||||
|
||||
if core.get_modpath("dryplants") then
|
||||
|
||||
bonemeal:add_sapling({
|
||||
{"dryplants:reedmace_sapling", y_func(abstract_dryplants.grow_reedmace), "soil"}
|
||||
})
|
||||
end
|
||||
|
||||
-- add bonemeal dyes
|
||||
|
||||
if minetest.get_modpath("dye") then
|
||||
if core.get_modpath("dye") then
|
||||
|
||||
local bonemeal_dyes = {bonemeal = "white", fertiliser = "green", mulch = "brown"}
|
||||
|
||||
for mat, dye in pairs(bonemeal_dyes) do
|
||||
|
||||
minetest.register_craft({
|
||||
core.register_craft({
|
||||
output = "dye:" .. dye .. " 4",
|
||||
recipe = {
|
||||
{"bonemeal:" .. mat}
|
||||
@ -292,35 +315,36 @@ if minetest.get_modpath("dye") then
|
||||
end
|
||||
end
|
||||
|
||||
-- df_trees saplings
|
||||
|
||||
if minetest.get_modpath("df_trees") then
|
||||
if core.get_modpath("df_trees") then
|
||||
|
||||
local function spore_tree_fix(pos)
|
||||
minetest.remove_node(pos) ; df_trees.spawn_spore_tree(pos)
|
||||
core.remove_node(pos) ; df_trees.spawn_spore_tree(pos)
|
||||
end
|
||||
|
||||
local function fungiwood_fix(pos)
|
||||
minetest.remove_node(pos) ; df_trees.spawn_fungiwood(pos)
|
||||
core.remove_node(pos) ; df_trees.spawn_fungiwood(pos)
|
||||
end
|
||||
|
||||
local function tunnel_fix(pos)
|
||||
minetest.remove_node(pos) ; df_trees.spawn_tunnel_tube(pos)
|
||||
core.remove_node(pos) ; df_trees.spawn_tunnel_tube(pos)
|
||||
end
|
||||
|
||||
local function black_cap_fix(pos)
|
||||
minetest.remove_node(pos) ; df_trees.spawn_black_cap(pos)
|
||||
core.remove_node(pos) ; df_trees.spawn_black_cap(pos)
|
||||
end
|
||||
|
||||
local function goblin_cap_fix(pos)
|
||||
minetest.remove_node(pos) ; df_trees.spawn_goblin_cap(pos)
|
||||
core.remove_node(pos) ; df_trees.spawn_goblin_cap(pos)
|
||||
end
|
||||
|
||||
local function tower_cap_fix(pos)
|
||||
minetest.remove_node(pos) ; df_trees.spawn_tower_cap(pos)
|
||||
core.remove_node(pos) ; df_trees.spawn_tower_cap(pos)
|
||||
end
|
||||
|
||||
local function nether_cap_fix(pos)
|
||||
minetest.remove_node(pos) ; df_trees.spawn_nether_cap(pos)
|
||||
core.remove_node(pos) ; df_trees.spawn_nether_cap(pos)
|
||||
end
|
||||
|
||||
bonemeal:add_sapling({
|
||||
@ -335,8 +359,9 @@ if minetest.get_modpath("df_trees") then
|
||||
})
|
||||
end
|
||||
|
||||
-- df_farming crops
|
||||
|
||||
if minetest.get_modpath("df_farming") then
|
||||
if core.get_modpath("df_farming") then
|
||||
|
||||
bonemeal:add_crop({
|
||||
{"df_farming:cave_wheat_", 8, "df_farming:cave_wheat_seed", true},
|
||||
@ -348,24 +373,25 @@ if minetest.get_modpath("df_farming") then
|
||||
})
|
||||
end
|
||||
|
||||
-- df_primordial saplings and plants
|
||||
|
||||
if minetest.get_modpath("df_primordial_items") then
|
||||
if core.get_modpath("df_primordial_items") then
|
||||
|
||||
local function mush_fix(pos)
|
||||
minetest.set_node(pos, {name = "air"})
|
||||
core.set_node(pos, {name = "air"})
|
||||
mapgen_helper.place_schematic(pos,
|
||||
df_primordial_items.get_primordial_mushroom(), (math.random(4) - 1) * 90)
|
||||
end
|
||||
|
||||
local function fern_fix(pos)
|
||||
minetest.set_node(pos, {name = "air"})
|
||||
core.set_node(pos, {name = "air"})
|
||||
local rotations = {0, 90, 180, 270}
|
||||
mapgen_helper.place_schematic(pos,
|
||||
df_primordial_items.get_fern_schematic(), rotations[math.random(#rotations)])
|
||||
end
|
||||
|
||||
local function blood_fix(pos)
|
||||
df_trees.grow_blood_thorn(pos, minetest.get_node(pos))
|
||||
df_trees.grow_blood_thorn(pos, core.get_node(pos))
|
||||
end
|
||||
|
||||
bonemeal:add_sapling({
|
||||
@ -417,8 +443,9 @@ if minetest.get_modpath("df_primordial_items") then
|
||||
})
|
||||
end
|
||||
|
||||
-- everness saplings
|
||||
|
||||
if minetest.get_modpath("everness") then
|
||||
if core.get_modpath("everness") then
|
||||
|
||||
bonemeal:add_sapling({
|
||||
{"everness:baobab_sapling", Everness.grow_baobab_tree, "soil"},
|
||||
@ -436,17 +463,18 @@ if minetest.get_modpath("everness") then
|
||||
})
|
||||
end
|
||||
|
||||
-- bush classic fruit
|
||||
|
||||
if minetest.get_modpath("bushes_classic") then
|
||||
if core.get_modpath("bushes_classic") then
|
||||
|
||||
local function grow_bush(pos)
|
||||
|
||||
local meta = minetest.get_meta(pos)
|
||||
local meta = core.get_meta(pos)
|
||||
local bush_name = meta:get_string("bush_type")
|
||||
|
||||
-- only change if meta found
|
||||
if meta and bush_name then
|
||||
minetest.swap_node(pos, {name = "bushes:" .. bush_name .. "_bush"})
|
||||
core.swap_node(pos, {name = "bushes:" .. bush_name .. "_bush"})
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user