write something there
200
mods/bonemeal/README.md
Normal file
|
@ -0,0 +1,200 @@
|
|||
minetest mod Bonemeal
|
||||
=====================
|
||||
|
||||
FARM mod that helps and featured the farming to quickly grow samplings, crops, grass, etc
|
||||
|
||||
Information
|
||||
-----------
|
||||
|
||||
Bonemeal is crushed from bones found in dirt or by using player bones, Mulch is
|
||||
made from a tree trunk surrounded by leaves and Fertiliser is a mix of both,
|
||||
each of which can be used to quickly grow saplings, crops and grass/decoration,
|
||||
papyrus on top of dirt and cactus on sand.
|
||||
|
||||
Support for ethereal saplings/crops, farming redo crops and moretrees saplings are included.
|
||||
|
||||

|
||||
|
||||
## Technical info
|
||||
|
||||
This mod is named `bonemeal` and must be installed with such name.
|
||||
|
||||
This mod adds four new items into the game, bones which can be dug from normal
|
||||
dirt which can be cooked into bonemeal, mulch which is is crafted using a tree
|
||||
and 8x leaves, and fertiliser which is a mixture of them both.
|
||||
|
||||
Each item can be used on saplings and crops for a chance to grow them quicker
|
||||
as well as dirt which will generate random grass, flowers or whichever
|
||||
decoration is registered.
|
||||
|
||||
Mulch has a strength of 1, Bonemeal 2 and Fertiliser 3. This means the stronger
|
||||
the item, the more chance of growing saplings in low light, making crops sprout
|
||||
quicker or simply decorate a larger area with grass and flowers.
|
||||
|
||||
#### Dependencies
|
||||
|
||||
Dependencies: default
|
||||
|
||||
Optional Dependencies: farming, ethereal, moretrees, lucky_block, moretrees, flowers, dye, ferns, dryplants, df_trees, df_farming, df_primordial_items, everness
|
||||
|
||||
Lucky Blocks: 6
|
||||
|
||||
#### API
|
||||
|
||||
The [`api.txt`](api.txt) document shows how to add your own saplings,
|
||||
crops and grasses to the list by using one of the 3 commands included and
|
||||
the [`mod.lua`](mod.lua) file gives you many examples by using some of the
|
||||
popular mods available.
|
||||
|
||||
https://forum.minetest.net/viewtopic.php?f=9&t=16446
|
||||
|
||||
#### Nodes
|
||||
|
||||
| Node name | description | notes |
|
||||
| ----------------------- | ------------ | --------------------------------------------------- |
|
||||
| bonemeal:mulch | Mulch | fertilizer to make grow plants and seeds faster |
|
||||
| bonemeal:bonemeal | Bone Meal | 2 x fertilizer to make grow plants and seeds faster |
|
||||
| bonemeal:fertiliser | Fertiliser | 3 x fertilizer to make grow plants and seeds faster |
|
||||
| bonemeal:bone | Bone | cook to made fertilizers, found into dirt rarelly |
|
||||
| bone:bone | Player bones | cook to made fertilizers, found into dirt rarelly |
|
||||
| bonemeal:gelatin_powder | Gelatin Powder | made from bones |
|
||||
|
||||
#### Crafts
|
||||
|
||||
* bonemeal:gelatin_powder 4
|
||||
|
||||
```
|
||||
{"group:bone", "group:bone", "group:bone"},
|
||||
{"bucket:bucket_water", "bucket:bucket_water", "bucket:bucket_water"},
|
||||
{"bucket:bucket_water", "default:torch", "bucket:bucket_water"}
|
||||
```
|
||||
|
||||
* bonemeal:bonemeal 2
|
||||
|
||||
```
|
||||
{{"group:bone"}}
|
||||
```
|
||||
|
||||
* bonemeal:bonemeal 4
|
||||
|
||||
```
|
||||
{{"bones:bones"}}
|
||||
```
|
||||
|
||||
* bonemeal:bonemeal 2
|
||||
|
||||
```
|
||||
{{"default:coral_skeleton"}}
|
||||
```
|
||||
|
||||
* bonemeal:mulch 4
|
||||
|
||||
```
|
||||
{"group:tree", "group:leaves", "group:leaves"},
|
||||
{"group:leaves", "group:leaves", "group:leaves"},
|
||||
{"group:leaves", "group:leaves", "group:leaves"}
|
||||
```
|
||||
|
||||
* bonemeal:mulch
|
||||
|
||||
```
|
||||
{"group:seed", "group:seed", "group:seed"},
|
||||
{"group:seed", "group:seed", "group:seed"},
|
||||
{"group:seed", "group:seed", "group:seed"}
|
||||
```
|
||||
|
||||
* fertiliser 2
|
||||
|
||||
```
|
||||
{{"bonemeal:bonemeal", "bonemeal:mulch"}}
|
||||
```
|
||||
|
||||
## Changelog
|
||||
|
||||
#### Version 0.1
|
||||
|
||||
* Initial release
|
||||
|
||||
#### Version 0.2
|
||||
|
||||
* Added global `on_use` function for bonemeal growth
|
||||
|
||||
#### Version 0.3
|
||||
|
||||
* Added strength to `on_use` global for new items (mulch and fertiliser)
|
||||
|
||||
#### Version 0.4
|
||||
|
||||
* Added `Intllib` support and `fr.txt` file for French translation.
|
||||
|
||||
#### Version 0.5
|
||||
|
||||
* Added support for default bush and acacia bush saplings
|
||||
|
||||
#### Version 0.6
|
||||
|
||||
* Using newer functions. This means Minetest 0.4.16 and above needed to run
|
||||
|
||||
#### Version 0.7
|
||||
|
||||
* Can be used on papyrus and cactus now
|
||||
* Added coral recipe
|
||||
* API addition
|
||||
|
||||
#### Version 0.8
|
||||
|
||||
* Added support for farming redo's new garlic
|
||||
* Added pepper and onion crops
|
||||
|
||||
#### Version 0.9
|
||||
|
||||
* Added support for farming redo's pea and beetroot crops
|
||||
* Checks for `place_param`
|
||||
|
||||
#### Version 1.0
|
||||
|
||||
* `add_deco()` now adds to existing item list while `set_deco()` replaces item
|
||||
list (thanks `h-v-smacker`)
|
||||
|
||||
#### Version 1.1
|
||||
|
||||
* Added `{can_bonemeal=1}` group for special nodes
|
||||
|
||||
#### Version 1.2
|
||||
|
||||
* Added support for Minetest 5.0 cactus seedling, blueberry bush sapling and
|
||||
emergent jungle tree saplings, additional flowers and pine bush sapling
|
||||
|
||||
#### Version 1.3
|
||||
|
||||
* Added ability to craft dye from mulch, bonemeal and fertiliser (thanks
|
||||
`orbea`)
|
||||
|
||||
#### Version 1.4
|
||||
|
||||
* Added support for fern saplings from `plantlife` mod (thanks `nixnoxus`)
|
||||
|
||||
#### Version 1.5
|
||||
|
||||
* Added support for farming redo's asparagus, eggplant, spinach
|
||||
|
||||
#### Version 1.6
|
||||
|
||||
* Added helper function for position and protection check
|
||||
* Added ginger support
|
||||
* Added moretrees poplar sapling
|
||||
|
||||
#### Version 1.7
|
||||
|
||||
* Added farming redo's barley, hemp, rye, oat, mint, sunflower, rice seeds
|
||||
* Added Everness saplings
|
||||
* Update readme (thanks mckaygerhard)
|
||||
* Recipe changes, player bones craft into 2x bones, bones must be cooked to
|
||||
give bonemeal
|
||||
* Added bushes_classic support
|
||||
|
||||
## LICENSE
|
||||
|
||||
Licence: Code is MIT, Media is CC0
|
||||
|
||||
(c) Tenplus1
|
98
mods/bonemeal/api.txt
Normal file
|
@ -0,0 +1,98 @@
|
|||
|
||||
Bonemeal API
|
||||
============
|
||||
|
||||
This guide will show you how to add saplings, crops and dirt types for the
|
||||
bonemeal mod to use from withhin your own mods. Please make sure that bonemeal
|
||||
appears in the depends.txt file of your mod so everything work properly.
|
||||
|
||||
|
||||
Function Usage
|
||||
==============
|
||||
|
||||
|
||||
Adding Crops
|
||||
------------
|
||||
|
||||
bonemeal:add_crop({
|
||||
{ nodename_start, growing_steps, seed_name, ignore_light }
|
||||
})
|
||||
|
||||
This command is used to add new crops for bonemeal to work on.
|
||||
|
||||
e.g.
|
||||
|
||||
bonemeal:add_crop({
|
||||
{"farming:cotton_", 8, "farming:seed_cotton"},
|
||||
{"farming:wheat_", 8, "farming:seed_wheat"},
|
||||
{"mymod:dark_wheat_", 8, "mymod:dark_wheat_seed", true}, -- can grow in darkness
|
||||
})
|
||||
|
||||
|
||||
Adding Saplings
|
||||
---------------
|
||||
|
||||
bonemeal:add_sapling({
|
||||
{ sapling_node, function, soil_type["sand", "dirt", nodename, "group:"], ignore_light }
|
||||
})
|
||||
|
||||
This command will add new saplings for bonemeal to grow on sand, soil or a
|
||||
specified node type.
|
||||
|
||||
bonemeal:add_sapling({
|
||||
{"ethereal:palm_sapling", ethereal.grow_palm_tree, "soil"},
|
||||
{"ethereal:palm_sapling", ethereal.grow_palm_tree, "sand"},
|
||||
{"mymod:dark_tree", mymod.dark_tree, "group:soil", true}, -- can grow in darkness
|
||||
})
|
||||
|
||||
|
||||
Adding Dirt Decoration
|
||||
----------------------
|
||||
|
||||
bonemeal:add_deco({
|
||||
{ dirt_node, {grass_node_list}, {decor_node_list} }
|
||||
})
|
||||
|
||||
This command will add grass and decoration to specific dirt types, use "" to
|
||||
add an empty node. If some decorations have been already defined for this dirt type, new
|
||||
will be added to the respective list. All empty ("") entries will be added regardless,
|
||||
which allows to decrease the frequency of decoration emergence, if needed.
|
||||
|
||||
e.g.
|
||||
|
||||
bonemeal:add_deco({
|
||||
{"default:dirt_with_dry_grass", {"default:dry_grass_1", ""},
|
||||
{"flowers:rose", "flowers:viola"} }
|
||||
})
|
||||
|
||||
Thus, add_deco() always adds (to) a definition, and never overrides. To discard an existing
|
||||
definiton in favor of the new one, use
|
||||
|
||||
bonemeal:set_deco({
|
||||
{ dirt_node, {grass_node_list}, {decor_node_list} }
|
||||
})
|
||||
|
||||
This command will set decoration for a given dirt type, fully replacing any existing definition.
|
||||
|
||||
|
||||
Global ON_USE Function
|
||||
----------------------
|
||||
|
||||
bonemeal:on_use(pos, strength, node)
|
||||
|
||||
This function can be called from other mods to grow plants using alternative
|
||||
bonemeal items and have the same effect.
|
||||
|
||||
{pos} is the location to apply growing
|
||||
{strength} is how strong to grow [low of 1 to high of 4]
|
||||
{node} is the node at pos, but can be left nil to get_node itself
|
||||
|
||||
Note: Higher strength items require lower light levels, and a strength of 4
|
||||
needs no light at all.
|
||||
|
||||
|
||||
Final Words
|
||||
===========
|
||||
|
||||
I hope this guide helps you add your own plants so you can grow them quickly
|
||||
with the items included. Please check the mods.lua for more examples.
|
680
mods/bonemeal/init.lua
Normal file
|
@ -0,0 +1,680 @@
|
|||
|
||||
bonemeal = {
|
||||
item_list = {
|
||||
bucket_water = "bucket:bucket_water",
|
||||
bucket_empty = "bucket:bucket_empty",
|
||||
dirt = "default:dirt",
|
||||
torch = "default:torch",
|
||||
coral = "default:coral_skeleton"
|
||||
}
|
||||
}
|
||||
|
||||
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 min, max, random = math.min, math.max, math.random
|
||||
|
||||
-- translation support
|
||||
local S = minetest.get_translator("bonemeal")
|
||||
|
||||
-- creative check
|
||||
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
|
||||
function bonemeal.is_creative(name)
|
||||
return creative_mode_cache or minetest.check_player_privs(name, {creative = true})
|
||||
end
|
||||
|
||||
local crops = {}
|
||||
local saplings = {}
|
||||
local deco = {}
|
||||
|
||||
--
|
||||
-- local functions
|
||||
--
|
||||
|
||||
-- particles
|
||||
local function particle_effect(pos)
|
||||
|
||||
minetest.add_particlespawner({
|
||||
amount = 4,
|
||||
time = 0.15,
|
||||
minpos = pos,
|
||||
maxpos = pos,
|
||||
minvel = {x = -1, y = 2, z = -1},
|
||||
maxvel = {x = 1, y = 4, z = 1},
|
||||
minacc = {x = -1, y = -1, z = -1},
|
||||
maxacc = {x = 1, y = 1, z = 1},
|
||||
minexptime = 1,
|
||||
maxexptime = 1,
|
||||
minsize = 1,
|
||||
maxsize = 3,
|
||||
texture = "bonemeal_particle.png",
|
||||
glow = 5
|
||||
})
|
||||
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)
|
||||
|
||||
elseif type(object) == "string" and minetest.registered_nodes[object] then
|
||||
|
||||
-- place node
|
||||
minetest.set_node(pos, {name = object})
|
||||
|
||||
elseif type(object) == "function" then
|
||||
|
||||
-- function
|
||||
object(pos)
|
||||
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 can_grow, grow_on
|
||||
|
||||
-- check list for sapling and function
|
||||
for n = 1, #saplings do
|
||||
|
||||
if saplings[n][1] == sapling_node then
|
||||
|
||||
grow_on = saplings[n][3] or ""
|
||||
|
||||
-- backwards compatibility, add 'group:' to older grouping
|
||||
if grow_on == "soil" or grow_on == "sand" then
|
||||
grow_on = "group:" .. grow_on
|
||||
end
|
||||
|
||||
-- sapling grows on top of specific node group
|
||||
if grow_on:find("group:") then
|
||||
|
||||
local group = grow_on:split(":")[2]
|
||||
|
||||
if minetest.get_item_group(under.name, group) > 0 then
|
||||
can_grow = true
|
||||
end
|
||||
|
||||
-- sapling grows on specific node
|
||||
elseif grow_on == under.name then
|
||||
can_grow = true
|
||||
end
|
||||
|
||||
-- check if we can grow sapling at current light level
|
||||
if can_grow and (light_ok or saplings[n][4] == true) then
|
||||
|
||||
particle_effect(pos)
|
||||
|
||||
if math.random(5 - strength) == 1 then
|
||||
grow_tree(pos, saplings[n][2])
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- crops check
|
||||
local function check_crops(pos, node, strength, light_ok)
|
||||
|
||||
local mod, crop, stage, nod, def
|
||||
local nodename = node.name
|
||||
|
||||
-- grow registered crops
|
||||
for n = 1, #crops do
|
||||
|
||||
-- check if crop can grow in current light level
|
||||
if (light_ok or crops[n][4] == true)
|
||||
and (nodename:find("^" .. crops[n][1])
|
||||
or nodename == crops[n][3]) then
|
||||
|
||||
-- separate mod and node name
|
||||
mod = nodename:split(":")[1] .. ":"
|
||||
crop = nodename:split(":")[2]
|
||||
|
||||
-- get stage number or set to 0 for seed
|
||||
if crop:split("_")[3] then
|
||||
stage = crop:split("_")[3]
|
||||
else
|
||||
stage = crop:split("_")[2]
|
||||
end
|
||||
|
||||
stage = tonumber(stage) or 0
|
||||
|
||||
stage = min(stage + strength, crops[n][2])
|
||||
|
||||
-- check for place_param setting
|
||||
nod = crops[n][1] .. stage
|
||||
def = minetest.registered_nodes[nod]
|
||||
|
||||
-- make sure crop exists or isn't fully grown already
|
||||
if not def or nod == nodename then
|
||||
return false
|
||||
end
|
||||
|
||||
minetest.set_node(pos, {name = nod, param2 = node.param2 or def.place_param2})
|
||||
|
||||
particle_effect(pos)
|
||||
|
||||
minetest.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
|
||||
local side = strength - 1
|
||||
local tall = max(strength - 2, 0)
|
||||
|
||||
-- get area of land with free space above
|
||||
local dirt = minetest.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})
|
||||
|
||||
-- set default grass and decoration
|
||||
local grass, decor
|
||||
|
||||
-- choose grass and decoration to use on dirt patch
|
||||
for n = 1, #deco do
|
||||
|
||||
-- do we have a grass match?
|
||||
if nodename == deco[n][1] then
|
||||
|
||||
grass = deco[n][2] or {}
|
||||
decor = deco[n][3] or {}
|
||||
end
|
||||
end
|
||||
|
||||
local pos2, nod, def
|
||||
|
||||
-- loop through soil
|
||||
for _, n in pairs(dirt) do
|
||||
|
||||
if random(5) == 5 then
|
||||
|
||||
if decor and #decor > 0 then
|
||||
|
||||
-- place random decoration (rare)
|
||||
local dnum = #decor or 1
|
||||
|
||||
nod = decor[random(dnum)] or ""
|
||||
end
|
||||
else
|
||||
if grass and #grass > 0 then
|
||||
|
||||
-- place random grass (common)
|
||||
local dgra = #grass or 1
|
||||
|
||||
nod = #grass > 0 and grass[random(dgra)] or ""
|
||||
end
|
||||
end
|
||||
|
||||
pos2 = n
|
||||
|
||||
pos2.y = pos2.y + 1
|
||||
|
||||
if nod and nod ~= "" then
|
||||
|
||||
-- get crop param2 value
|
||||
def = minetest.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)
|
||||
|
||||
def = node and node.param2 or 0
|
||||
end
|
||||
|
||||
minetest.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
|
||||
|
||||
-- get position and node info
|
||||
local pos = pointed_thing.under
|
||||
local node = minetest.get_node(pos)
|
||||
local def = minetest.registered_items[node.name]
|
||||
local dirt = def and def.groups
|
||||
|
||||
-- does node have groups set
|
||||
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
|
||||
pos = pointed_thing.above
|
||||
end
|
||||
|
||||
-- check if protected
|
||||
if minetest.is_protected(pos, user:get_player_name()) then
|
||||
return false
|
||||
end
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
|
||||
-- global functions
|
||||
|
||||
|
||||
-- add to sapling list
|
||||
-- {sapling node, schematic or function name, "soil"|"sand"|specific_node|"group:"}
|
||||
--e.g. {"default:sapling", default.grow_new_apple_tree, "soil"}
|
||||
|
||||
function bonemeal:add_sapling(list)
|
||||
|
||||
for n = 1, #list do
|
||||
saplings[#saplings + 1] = list[n]
|
||||
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
|
||||
crops[#crops + 1] = list[n]
|
||||
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
|
||||
|
||||
for n = 1, #deco do
|
||||
|
||||
-- update existing entry
|
||||
if list[l][1] == deco[n][1] then
|
||||
|
||||
-- adding grass types
|
||||
for _, extra in pairs(list[l][2]) do
|
||||
|
||||
if extra ~= "" then
|
||||
|
||||
for _, entry in pairs(deco[n][2]) do
|
||||
|
||||
if extra == entry then
|
||||
extra = false
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if extra then
|
||||
deco[n][2][#deco[n][2] + 1] = extra
|
||||
end
|
||||
end
|
||||
|
||||
-- adding decoration types
|
||||
for _, extra in ipairs(list[l][3]) do
|
||||
|
||||
if extra ~= "" then
|
||||
|
||||
for __, entry in pairs(deco[n][3]) do
|
||||
|
||||
if extra == entry then
|
||||
extra = false
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if extra then
|
||||
deco[n][3][#deco[n][3] + 1] = extra
|
||||
end
|
||||
end
|
||||
|
||||
list[l] = false
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if list[l] then
|
||||
deco[#deco + 1] = list[l]
|
||||
end
|
||||
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
|
||||
|
||||
for n = 1, #deco do
|
||||
|
||||
-- replace existing entry
|
||||
if list[l][1] == deco[n][1] then
|
||||
|
||||
deco[n][2] = list[l][2]
|
||||
deco[n][3] = list[l][3]
|
||||
|
||||
list[l] = false
|
||||
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if list[l] then
|
||||
deco[#deco + 1] = list[l]
|
||||
end
|
||||
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)
|
||||
|
||||
-- return if nothing there
|
||||
if node.name == "ignore" then
|
||||
return
|
||||
end
|
||||
|
||||
-- make sure strength is between 1 and 4
|
||||
strength = strength or 1
|
||||
strength = max(strength, 1)
|
||||
strength = min(strength, 4)
|
||||
|
||||
-- papyrus and cactus
|
||||
if node.name == "default:papyrus" then
|
||||
|
||||
default.grow_papyrus(pos, node)
|
||||
|
||||
particle_effect(pos)
|
||||
|
||||
return true
|
||||
|
||||
elseif node.name == "default:cactus" then
|
||||
|
||||
default.grow_cactus(pos, node)
|
||||
|
||||
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"})
|
||||
|
||||
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
|
||||
|
||||
check_soil(pos, node.name, strength)
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
-- 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
|
||||
light_ok = nil
|
||||
end
|
||||
|
||||
-- check for sapling growth
|
||||
if check_sapling(pos, node.name, strength, light_ok) then
|
||||
return true
|
||||
end
|
||||
|
||||
-- check for crop growth
|
||||
if check_crops(pos, node, strength, light_ok) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- items
|
||||
--
|
||||
|
||||
|
||||
-- mulch (strength 1)
|
||||
minetest.register_craftitem("bonemeal:mulch", {
|
||||
description = S("Mulch"),
|
||||
inventory_image = "bonemeal_mulch.png",
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
|
||||
-- use helper function to do checks and return position and node
|
||||
local node = use_checks(user, pointed_thing)
|
||||
|
||||
if node then
|
||||
|
||||
-- call global on_use function with strength of 1
|
||||
local used = bonemeal:on_use(pointed_thing.under, 1, node)
|
||||
|
||||
-- take item if not in creative
|
||||
if used and not bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
-- bonemeal (strength 2)
|
||||
minetest.register_craftitem("bonemeal:bonemeal", {
|
||||
description = S("Bone Meal"),
|
||||
inventory_image = "bonemeal_item.png",
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
|
||||
-- use helper function to do checks and return position and node
|
||||
local node = use_checks(user, pointed_thing)
|
||||
|
||||
if node then
|
||||
|
||||
-- call global on_use function with strength of 2
|
||||
local used = bonemeal:on_use(pointed_thing.under, 2, node)
|
||||
|
||||
-- take item if not in creative
|
||||
if used and not bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
-- fertiliser (strength 3)
|
||||
minetest.register_craftitem("bonemeal:fertiliser", {
|
||||
description = S("Fertiliser"),
|
||||
inventory_image = "bonemeal_fertiliser.png",
|
||||
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
|
||||
-- use helper function to do checks and return position and node
|
||||
local node = use_checks(user, pointed_thing)
|
||||
|
||||
if node then
|
||||
|
||||
-- call global on_use function with strength of 3
|
||||
local used = bonemeal:on_use(pointed_thing.under, 3, node)
|
||||
|
||||
-- take item if not in creative
|
||||
if used and not bonemeal.is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
end
|
||||
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
-- bone
|
||||
minetest.register_craftitem("bonemeal:bone", {
|
||||
description = S("Bone"),
|
||||
inventory_image = "bonemeal_bone.png",
|
||||
groups = {bone = 1}
|
||||
})
|
||||
|
||||
-- gelatin powder
|
||||
minetest.register_craftitem("bonemeal:gelatin_powder", {
|
||||
description = S("Gelatin Powder"),
|
||||
inventory_image = "bonemeal_gelatin_powder.png",
|
||||
groups = {food_gelatin = 1, flammable = 2}
|
||||
})
|
||||
|
||||
|
||||
--
|
||||
-- crafting recipes
|
||||
--
|
||||
|
||||
-- gelatin powder
|
||||
minetest.register_craft({
|
||||
output = "bonemeal:gelatin_powder 4",
|
||||
recipe = {
|
||||
{"group:bone", "group:bone", "group:bone"},
|
||||
{a.bucket_water, a.bucket_water, a.bucket_water},
|
||||
{a.bucket_water, a.torch, a.bucket_water}
|
||||
},
|
||||
replacements = {
|
||||
{a.bucket_water, a.bucket_empty .. " 5"}
|
||||
}
|
||||
})
|
||||
|
||||
-- bonemeal (from bone)
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
output = "bonemeal:bonemeal 2",
|
||||
recipe = "group:bone",
|
||||
cooktime = 4
|
||||
})
|
||||
|
||||
-- bonemeal (from player bones)
|
||||
if minetest.settings:get_bool("bonemeal.disable_deathbones_recipe",true) ~= true then
|
||||
|
||||
minetest.register_craft({
|
||||
output = "bonemeal:bone 2",
|
||||
recipe = {{"bones:bones"}}
|
||||
})
|
||||
end
|
||||
|
||||
-- bonemeal (from coral skeleton)
|
||||
minetest.register_craft({
|
||||
output = "bonemeal:bonemeal 2",
|
||||
recipe = {{a.coral}}
|
||||
})
|
||||
|
||||
-- mulch
|
||||
minetest.register_craft({
|
||||
output = "bonemeal:mulch 4",
|
||||
recipe = {
|
||||
{"group:tree", "group:leaves", "group:leaves"},
|
||||
{"group:leaves", "group:leaves", "group:leaves"},
|
||||
{"group:leaves", "group:leaves", "group:leaves"}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "bonemeal:mulch",
|
||||
recipe = {
|
||||
{"group:seed", "group:seed", "group:seed"},
|
||||
{"group:seed", "group:seed", "group:seed"},
|
||||
{"group:seed", "group:seed", "group:seed"}
|
||||
}
|
||||
})
|
||||
|
||||
-- fertiliser
|
||||
minetest.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, {
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{
|
||||
items = {"bonemeal:bone"},
|
||||
rarity = 40
|
||||
},
|
||||
{
|
||||
items = {a.dirt}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
-- add support for mods
|
||||
dofile(path .. "/mods.lua")
|
||||
|
||||
-- lucky block support
|
||||
if minetest.get_modpath("lucky_block") then
|
||||
dofile(path .. "/lucky_block.lua")
|
||||
end
|
||||
|
||||
|
||||
print ("[MOD] Bonemeal loaded")
|
24
mods/bonemeal/license.txt
Normal file
|
@ -0,0 +1,24 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 TenPlus1
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
Textures by TenPlus1 (CC0)
|
6
mods/bonemeal/locale/bonemeal.de.tr
Normal file
|
@ -0,0 +1,6 @@
|
|||
# textdomain:bonemeal
|
||||
Bone=Knochen
|
||||
Bone Meal=Knochenmehl
|
||||
Fertiliser=Dünger
|
||||
Gelatin Powder=Gelatinepulver
|
||||
Mulch=Mulch
|
6
mods/bonemeal/locale/bonemeal.en.tr
Normal file
|
@ -0,0 +1,6 @@
|
|||
# textdomain:bonemeal
|
||||
#Bone=
|
||||
#Bone Meal=
|
||||
#Fertiliser=
|
||||
#Gelatin Powder=
|
||||
#Mulch=
|
6
mods/bonemeal/locale/bonemeal.es.tr
Normal file
|
@ -0,0 +1,6 @@
|
|||
# textdomain:bonemeal
|
||||
Bone=Hueso
|
||||
Bone Meal=Comida de hueso
|
||||
Fertiliser=Fertilizante
|
||||
#Gelatin Powder=
|
||||
Mulch=Mantillo
|
6
mods/bonemeal/locale/bonemeal.fr.tr
Normal file
|
@ -0,0 +1,6 @@
|
|||
# textdomain:bonemeal
|
||||
Bone=Os
|
||||
Bone Meal=Poudre d'os
|
||||
Fertiliser=Engrais
|
||||
Gelatin Powder=Poudre de gélatine
|
||||
Mulch=Paillis
|
6
mods/bonemeal/locale/bonemeal.it.tr
Normal file
|
@ -0,0 +1,6 @@
|
|||
# textdomain:bonemeal
|
||||
Bone=Ossa
|
||||
Bone Meal=Pasto osseo
|
||||
Fertiliser=Fertilizzante
|
||||
#Gelatin Powder=
|
||||
Mulch=Pacciame
|
6
mods/bonemeal/locale/bonemeal.ru.tr
Normal file
|
@ -0,0 +1,6 @@
|
|||
# textdomain:bonemeal
|
||||
Bone=Кость
|
||||
Bone Meal=Костная Мука
|
||||
Fertiliser=Удобрение
|
||||
#Gelatin Powder=
|
||||
Mulch=Мульча
|
25
mods/bonemeal/lucky_block.lua
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
-- add lucky blocks
|
||||
|
||||
local function growy(pos, player)
|
||||
|
||||
local dpos = minetest.find_node_near(pos, 1, "group:soil")
|
||||
|
||||
if dpos then
|
||||
bonemeal:on_use(dpos, 5)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
lucky_block:add_blocks({
|
||||
{"lig"},
|
||||
{"dro", {"bonemeal:mulch"}, 10},
|
||||
{"dro", {"bonemeal:bonemeal"}, 10},
|
||||
{"dro", {"bonemeal:fertiliser"}, 10},
|
||||
{"cus", growy},
|
||||
{"nod", "default:chest", 0, {
|
||||
{name = "bonemeal:mulch", max = 20},
|
||||
{name = "bonemeal:bonemeal", max = 15},
|
||||
{name = "bonemeal:fertiliser", max = 10}
|
||||
}}
|
||||
})
|
4
mods/bonemeal/mod.conf
Normal file
|
@ -0,0 +1,4 @@
|
|||
name = bonemeal
|
||||
description = Adds bone and bonemeal giving the ability to quickly grow plants and saplings.
|
||||
optional_depends = default, mcl_core, lucky_block, farming, ethereal, moretrees, technic_worldgen, flowers, dye, ferns, dryplants, df_trees, df_farming, df_primordial_items, everness, x_farming
|
||||
min_minetest_version = 5.0
|
480
mods/bonemeal/mods.lua
Normal file
|
@ -0,0 +1,480 @@
|
|||
|
||||
-- craft bones from animalmaterials into bonemeal
|
||||
if minetest.get_modpath("animalmaterials") then
|
||||
|
||||
minetest.register_craft({
|
||||
output = "bonemeal:bonemeal 2",
|
||||
recipe = {{"animalmaterials:bone"}}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
if minetest.get_modpath("default") then
|
||||
|
||||
-- saplings
|
||||
|
||||
local function pine_grow(pos)
|
||||
|
||||
if minetest.find_node_near(pos, 1,
|
||||
{"default:snow", "default:snowblock", "default:dirt_with_snow"}) then
|
||||
|
||||
default.grow_new_snowy_pine_tree(pos)
|
||||
else
|
||||
default.grow_new_pine_tree(pos)
|
||||
end
|
||||
end
|
||||
|
||||
local function cactus_grow(pos)
|
||||
default.grow_cactus(pos, minetest.get_node(pos))
|
||||
end
|
||||
|
||||
local function papyrus_grow(pos)
|
||||
default.grow_papyrus(pos, minetest.get_node(pos))
|
||||
end
|
||||
|
||||
bonemeal:add_sapling({
|
||||
{"default:sapling", default.grow_new_apple_tree, "soil"},
|
||||
{"default:junglesapling", default.grow_new_jungle_tree, "soil"},
|
||||
{"default:emergent_jungle_sapling", default.grow_new_emergent_jungle_tree, "soil"},
|
||||
{"default:acacia_sapling", default.grow_new_acacia_tree, "soil"},
|
||||
{"default:aspen_sapling", default.grow_new_aspen_tree, "soil"},
|
||||
{"default:pine_sapling", pine_grow, "soil"},
|
||||
{"default:bush_sapling", default.grow_bush, "soil"},
|
||||
{"default:acacia_bush_sapling", default.grow_acacia_bush, "soil"},
|
||||
{"default:large_cactus_seedling", default.grow_large_cactus, "sand"},
|
||||
{"default:blueberry_bush_sapling", default.grow_blueberry_bush, "soil"},
|
||||
{"default:pine_bush_sapling", default.grow_pine_bush, "soil"},
|
||||
{"default:cactus", cactus_grow, "sand"},
|
||||
{"default:papyrus", papyrus_grow, "soil"}
|
||||
})
|
||||
|
||||
-- decoration
|
||||
|
||||
local green_grass = {
|
||||
"default:grass_2", "default:grass_3", "default:grass_4",
|
||||
"default:grass_5", "", ""
|
||||
}
|
||||
|
||||
local dry_grass = {
|
||||
"default:dry_grass_2", "default:dry_grass_3", "default:dry_grass_4",
|
||||
"default:dry_grass_5", "", ""
|
||||
}
|
||||
|
||||
local flowers = {}
|
||||
|
||||
minetest.after(0.1, function()
|
||||
|
||||
for node, def in pairs(minetest.registered_nodes) do
|
||||
|
||||
if def.groups
|
||||
and def.groups.flower
|
||||
and not node:find("waterlily")
|
||||
and not node:find("seaweed")
|
||||
and not node:find("xdecor:potted_")
|
||||
and not node:find("df_farming:") then
|
||||
flowers[#flowers + 1] = node
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
bonemeal:add_deco({
|
||||
{"default:dirt", bonemeal.green_grass, flowers},
|
||||
{"default:dirt_with_grass", green_grass, flowers},
|
||||
{"default:dry_dirt", dry_grass, {}},
|
||||
{"default:dry_dirt_with_dry_grass", dry_grass, {}},
|
||||
{"default:dirt_with_dry_grass", dry_grass, flowers},
|
||||
{"default:sand", {}, {"default:dry_shrub", "", "", ""} },
|
||||
{"default:desert_sand", {}, {"default:dry_shrub", "", "", ""} },
|
||||
{"default:silver_sand", {}, {"default:dry_shrub", "", "", ""} },
|
||||
{"default:dirt_with_rainforest_litter", {}, {"default:junglegrass", "", "", ""} },
|
||||
{"default:dirt_with_coniferous_litter", {}, {"default:fern_1", "default:fern_2",
|
||||
"default:fern_3", "", "", ""}}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
if farming then
|
||||
|
||||
bonemeal:add_crop({
|
||||
{"farming:cotton_", 8, "farming:seed_cotton"},
|
||||
{"farming:wheat_", 8, "farming:seed_wheat"}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
if farming and farming.mod and farming.mod == "redo" then
|
||||
|
||||
bonemeal:add_crop({
|
||||
{"farming:tomato_", 8},
|
||||
{"farming:corn_", 8},
|
||||
{"farming:melon_", 8},
|
||||
{"farming:pumpkin_", 8},
|
||||
{"farming:beanpole_", 5},
|
||||
{"farming:blueberry_", 4},
|
||||
{"farming:raspberry_", 4},
|
||||
{"farming:carrot_", 8},
|
||||
{"farming:cocoa_", 4},
|
||||
{"farming:coffee_", 5},
|
||||
{"farming:cucumber_", 4},
|
||||
{"farming:potato_", 4},
|
||||
{"farming:grapes_", 8},
|
||||
{"farming:rhubarb_", 4},
|
||||
{"farming:barley_", 8, "farming:seed_barley"},
|
||||
{"farming:hemp_", 8, "farming:seed_hemp"},
|
||||
{"farming:chili_", 8},
|
||||
{"farming:garlic_", 5},
|
||||
{"farming:onion_", 5},
|
||||
{"farming:pepper_", 7},
|
||||
{"farming:pineapple_", 8},
|
||||
{"farming:pea_", 5},
|
||||
{"farming:beetroot_", 5},
|
||||
{"farming:rye_", 8, "farming:seed_rye"},
|
||||
{"farming:oat_", 8, "farming:seed_oat"},
|
||||
{"farming:rice_", 8, "farming:seed_rice"},
|
||||
{"farming:mint_", 4, "farming:seed_mint"},
|
||||
{"farming:cabbage_", 6},
|
||||
{"farming:lettuce_", 5},
|
||||
{"farming:blackberry_", 4},
|
||||
{"farming:vanilla_", 8},
|
||||
{"farming:soy_", 7},
|
||||
{"farming:artichoke_", 5},
|
||||
{"farming:parsley_", 3},
|
||||
{"farming:sunflower_", 8, "farming:seed_sunflower"},
|
||||
{"farming:asparagus_", 5},
|
||||
{"farming:eggplant_", 4},
|
||||
{"farming:spinach_", 4},
|
||||
{"farming:ginger_", 4},
|
||||
{"ethereal:strawberry_", 8}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
if minetest.get_modpath("ethereal") then
|
||||
|
||||
bonemeal:add_crop({
|
||||
{"ethereal:strawberry_", 8},
|
||||
{"ethereal:onion_", 5}
|
||||
})
|
||||
|
||||
bonemeal:add_sapling({
|
||||
{"ethereal:palm_sapling", ethereal.grow_palm_tree, "soil"},
|
||||
{"ethereal:palm_sapling", ethereal.grow_palm_tree, "sand"},
|
||||
{"ethereal:yellow_tree_sapling", ethereal.grow_yellow_tree, "soil"},
|
||||
{"ethereal:big_tree_sapling", ethereal.grow_big_tree, "soil"},
|
||||
{"ethereal:banana_tree_sapling", ethereal.grow_banana_tree, "soil"},
|
||||
{"ethereal:frost_tree_sapling", ethereal.grow_frost_tree, "soil"},
|
||||
{"ethereal:mushroom_sapling", ethereal.grow_mushroom_tree, "soil"},
|
||||
{"ethereal:mushroom_brown_sapling", ethereal.grow_mushroom_brown_tree, "soil"},
|
||||
{"ethereal:willow_sapling", ethereal.grow_willow_tree, "soil"},
|
||||
{"ethereal:redwood_sapling", ethereal.grow_redwood_tree, "soil"},
|
||||
{"ethereal:giant_redwood_sapling", ethereal.grow_giant_redwood_tree, "soil"},
|
||||
{"ethereal:orange_tree_sapling", ethereal.grow_orange_tree, "soil"},
|
||||
{"ethereal:bamboo_sprout", ethereal.grow_bamboo_tree, "soil"},
|
||||
{"ethereal:birch_sapling", ethereal.grow_birch_tree, "soil"},
|
||||
{"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"}
|
||||
})
|
||||
|
||||
local grass = {"default:grass_3", "default:grass_4", "default:grass_5", ""}
|
||||
|
||||
bonemeal:add_deco({
|
||||
{"ethereal:crystal_dirt", {"ethereal:crystalgrass", "", "", "", ""}, {}},
|
||||
{"ethereal:fiery_dirt", {"ethereal:dry_shrub", "", "", "", ""}, {}},
|
||||
{"ethereal:prairie_dirt", grass, {"flowers:dandelion_white",
|
||||
"flowers:dandelion_yellow", "flowers:geranium", "flowers:rose",
|
||||
"flowers:tulip", "flowers:viola", "ethereal:strawberry_7"}},
|
||||
{"ethereal:gray_dirt", {}, {"ethereal:snowygrass", "", ""}},
|
||||
{"ethereal:cold_dirt", {}, {"ethereal:snowygrass", "", ""}},
|
||||
{"ethereal:mushroom_dirt", {}, {"flowers:mushroom_red", "flowers:mushroom_brown",
|
||||
"ethereal:spore_grass", "ethereal:spore_grass", "", "", ""}},
|
||||
{"ethereal:jungle_dirt", grass, {"default:junglegrass", "", "", ""}},
|
||||
{"ethereal:grove_dirt", grass, {"ethereal:fern", "", "", ""}},
|
||||
{"ethereal:bamboo_dirt", grass, {}}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
if minetest.get_modpath("moretrees") then
|
||||
|
||||
-- special fir check for snow
|
||||
local function fir_grow(pos)
|
||||
|
||||
if minetest.find_node_near(pos, 1,
|
||||
{"default:snow", "default:snowblock", "default:dirt_with_snow"}) then
|
||||
|
||||
moretrees.grow_fir_snow(pos)
|
||||
else
|
||||
moretrees.grow_fir(pos)
|
||||
end
|
||||
end
|
||||
|
||||
bonemeal:add_sapling({
|
||||
{"moretrees:beech_sapling", moretrees.spawn_beech_object, "soil"},
|
||||
{"moretrees:apple_tree_sapling", moretrees.spawn_apple_tree_object, "soil"},
|
||||
{"moretrees:oak_sapling", moretrees.spawn_oak_object, "soil"},
|
||||
{"moretrees:sequoia_sapling", moretrees.spawn_sequoia_object, "soil"},
|
||||
{"moretrees:birch_sapling", moretrees.grow_birch, "soil"},
|
||||
{"moretrees:palm_sapling", moretrees.spawn_palm_object, "soil"},
|
||||
{"moretrees:palm_sapling", moretrees.spawn_palm_object, "sand"},
|
||||
{"moretrees:date_palm_sapling", moretrees.spawn_date_palm_object, "soil"},
|
||||
{"moretrees:date_palm_sapling", moretrees.spawn_date_palm_object, "sand"},
|
||||
{"moretrees:spruce_sapling", moretrees.grow_spruce, "soil"},
|
||||
{"moretrees:cedar_sapling", moretrees.spawn_cedar_object, "soil"},
|
||||
{"moretrees:poplar_sapling", moretrees.spawn_poplar_object, "soil"},
|
||||
{"moretrees:poplar_small_sapling", moretrees.spawn_poplar_small_object, "soil"},
|
||||
{"moretrees:willow_sapling", moretrees.spawn_willow_object, "soil"},
|
||||
{"moretrees:rubber_tree_sapling", moretrees.spawn_rubber_tree_object, "soil"},
|
||||
{"moretrees:fir_sapling", fir_grow, "soil"}
|
||||
})
|
||||
|
||||
elseif minetest.get_modpath("technic_worldgen") then
|
||||
|
||||
bonemeal:add_sapling({
|
||||
{"moretrees:rubber_tree_sapling", technic.rubber_tree_model, "soil"}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
if minetest.get_modpath("caverealms") then
|
||||
|
||||
local fil = minetest.get_modpath("caverealms") .. "/schematics/shroom.mts"
|
||||
local add_shroom = function(pos)
|
||||
|
||||
minetest.swap_node(pos, {name = "air"})
|
||||
|
||||
minetest.place_schematic(
|
||||
{x = pos.x - 5, y = pos.y, z = pos.z - 5}, fil, 0, nil, false)
|
||||
end
|
||||
|
||||
bonemeal:add_sapling({
|
||||
{"caverealms:mushroom_sapling", add_shroom, "soil"}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
local function y_func(grow_func)
|
||||
return function(pos)
|
||||
grow_func({x = pos.x, y = pos.y - 1, z = pos.z})
|
||||
end
|
||||
end
|
||||
|
||||
if minetest.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"}
|
||||
})
|
||||
end
|
||||
|
||||
if minetest.get_modpath("dryplants") then
|
||||
|
||||
bonemeal:add_sapling({
|
||||
{"dryplants:reedmace_sapling", y_func(abstract_dryplants.grow_reedmace), "soil"}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
if minetest.get_modpath("dye") then
|
||||
|
||||
local bonemeal_dyes = {bonemeal = "white", fertiliser = "green", mulch = "brown"}
|
||||
|
||||
for mat, dye in pairs(bonemeal_dyes) do
|
||||
|
||||
minetest.register_craft({
|
||||
output = "dye:" .. dye .. " 4",
|
||||
recipe = {
|
||||
{"bonemeal:" .. mat}
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if minetest.get_modpath("df_trees") then
|
||||
|
||||
local function spore_tree_fix(pos)
|
||||
minetest.remove_node(pos) ; df_trees.spawn_spore_tree(pos)
|
||||
end
|
||||
|
||||
local function fungiwood_fix(pos)
|
||||
minetest.remove_node(pos) ; df_trees.spawn_fungiwood(pos)
|
||||
end
|
||||
|
||||
local function tunnel_fix(pos)
|
||||
minetest.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)
|
||||
end
|
||||
|
||||
local function goblin_cap_fix(pos)
|
||||
minetest.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)
|
||||
end
|
||||
|
||||
local function nether_cap_fix(pos)
|
||||
minetest.remove_node(pos) ; df_trees.spawn_nether_cap(pos)
|
||||
end
|
||||
|
||||
bonemeal:add_sapling({
|
||||
{"df_trees:black_cap_sapling", black_cap_fix, "soil", true},
|
||||
{"df_trees:fungiwood_sapling", fungiwood_fix, "soil", true},
|
||||
{"df_trees:goblin_cap_sapling", goblin_cap_fix, "soil", true},
|
||||
{"df_trees:spore_tree_sapling", spore_tree_fix, "soil", true},
|
||||
{"df_trees:tower_cap_sapling", tower_cap_fix, "soil", true},
|
||||
{"df_trees:tunnel_tube_sapling", tunnel_fix, "soil", true},
|
||||
{"df_trees:nether_cap_sapling", nether_cap_fix, "group:nether_cap", true},
|
||||
{"df_trees:nether_cap_sapling", nether_cap_fix, "group:cools_lava", true}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
if minetest.get_modpath("df_farming") then
|
||||
|
||||
bonemeal:add_crop({
|
||||
{"df_farming:cave_wheat_", 8, "df_farming:cave_wheat_seed", true},
|
||||
{"df_farming:dimple_cup_", 4, "df_farming:dimple_cup_seed", true},
|
||||
{"df_farming:pig_tail_", 8, "df_farming:pig_tail_seed", true},
|
||||
{"df_farming:plump_helmet_", 4, "df_farming:plump_helmet_spawn", true},
|
||||
{"df_farming:quarry_bush_", 5, "df_farming:quarry_bush_seed", true},
|
||||
{"df_farming:sweet_pod_", 6, "df_farming:sweet_pod_seed", true}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
if minetest.get_modpath("df_primordial_items") then
|
||||
|
||||
local function mush_fix(pos)
|
||||
minetest.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"})
|
||||
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))
|
||||
end
|
||||
|
||||
bonemeal:add_sapling({
|
||||
{"df_primordial_items:jungle_mushroom_sapling",
|
||||
df_primordial_items.spawn_jungle_mushroom, "soil", true},
|
||||
{"df_primordial_items:jungletree_sapling",
|
||||
df_primordial_items.spawn_jungle_tree, "soil", true},
|
||||
{"df_primordial_items:mush_sapling", mush_fix, "soil", true},
|
||||
{"df_primordial_items:fern_sapling", fern_fix, "soil", true},
|
||||
{"df_trees:blood_thorn", blood_fix, "sand", true}
|
||||
})
|
||||
|
||||
local jgrass = {
|
||||
"df_primordial_items:jungle_grass_1",
|
||||
"df_primordial_items:jungle_grass_2",
|
||||
"df_primordial_items:jungle_grass_3",
|
||||
"df_primordial_items:fern_1",
|
||||
"df_primordial_items:fern_2",
|
||||
"", "", "", ""
|
||||
}
|
||||
|
||||
local jdeco = {
|
||||
"df_primordial_items:jungle_mushroom_1",
|
||||
"df_primordial_items:jungle_mushroom_2",
|
||||
"df_primordial_items:glow_plant_1",
|
||||
"df_primordial_items:glow_plant_2",
|
||||
"df_primordial_items:glow_plant_3",
|
||||
"", "", ""
|
||||
}
|
||||
|
||||
bonemeal:add_deco({
|
||||
{"df_primordial_items:dirt_with_jungle_grass", jgrass, jdeco}
|
||||
})
|
||||
|
||||
local fgrass = {
|
||||
"df_primordial_items:fungal_grass_1",
|
||||
"df_primordial_items:fungal_grass_2",
|
||||
"", "", "", ""
|
||||
}
|
||||
|
||||
local fdeco = {
|
||||
"df_primordial_items:glow_orb_stalks",
|
||||
"df_primordial_items:glow_pods",
|
||||
"", "", ""
|
||||
}
|
||||
|
||||
bonemeal:add_deco({
|
||||
{"df_primordial_items:dirt_with_mycelium", fgrass, fdeco}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
if minetest.get_modpath("everness") then
|
||||
|
||||
bonemeal:add_sapling({
|
||||
{"everness:baobab_sapling", Everness.grow_baobab_tree, "soil"},
|
||||
{"everness:coral_tree_bioluminescent_sapling",
|
||||
Everness.coral_tree_bioluminescent, "soil"},
|
||||
{"everness:coral_tree_sapling", Everness.grow_coral_tree, "soil"},
|
||||
{"everness:crystal_bush_sapling", Everness.grow_crystal_bush, "soil"},
|
||||
{"everness:crystal_tree_large_sapling", Everness.grow_crystal_large_tree, "soil"},
|
||||
{"everness:crystal_tree_sapling", Everness.grow_crystal_tree, "soil"},
|
||||
{"everness:cursed_bush_sapling", Everness.grow_cursed_bush, "soil"},
|
||||
{"everness:cursed_dream_tree_sapling", Everness.grow_cursed_dream_tree, "soil"},
|
||||
{"everness:dry_tree_sapling", Everness.grow_dry_tree, "soil"},
|
||||
{"everness:sequoia_tree_sapling", Everness.grow_sequoia_tree, "soil"},
|
||||
{"everness:willow_tree_sapling", Everness.grow_willow_tree, "soil"}
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
if minetest.get_modpath("bushes_classic") then
|
||||
|
||||
local function grow_bush(pos)
|
||||
|
||||
local meta = minetest.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"})
|
||||
end
|
||||
end
|
||||
|
||||
bonemeal:add_sapling({
|
||||
{"bushes:fruitless_bush", grow_bush, "soil"},
|
||||
})
|
||||
end
|
||||
|
||||
if minetest.get_modpath("x_farming") then
|
||||
-- Register crops
|
||||
bonemeal:add_crop({
|
||||
{"x_farming:barley_", 8, "x_farming:seed_barley"},
|
||||
{"x_farming:beetroot_", 8, "x_farming:seed_beetroot"},
|
||||
{"x_farming:carrot_", 8, "x_farming:seed_carrot"},
|
||||
{"x_farming:cocoa_", 3},
|
||||
{"x_farming:coffee_", 5, "x_farming:seed_coffee"},
|
||||
{"x_farming:corn_", 10, "x_farming:seed_corn"},
|
||||
{"x_farming:melon_", 8, "x_farming:seed_melon"},
|
||||
{"x_farming:potato_", 8, "x_farming:seed_potato"},
|
||||
{"x_farming:pumpkin_", 8, "x_farming:seed_pumpkin"},
|
||||
{"x_farming:rice_", 8, "x_farming:seed_rice"},
|
||||
{"x_farming:soybean_", 7, "x_farming:seed_soybean"},
|
||||
{"x_farming:stevia_", 8, "x_farming:seed_stevia"},
|
||||
{"x_farming:strawberry_", 4, "x_farming:seed_strawberry"},
|
||||
})
|
||||
|
||||
-- Register trees
|
||||
bonemeal:add_sapling({
|
||||
{"x_farming:kiwi_sapling", x_farming.grow_sapling, "soil"},
|
||||
})
|
||||
end
|
BIN
mods/bonemeal/screenshot.jpg
Normal file
After Width: | Height: | Size: 114 KiB |
2
mods/bonemeal/settingtypes.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Disable recipe for bones:bones to craft into bonemeal
|
||||
bonemeal.disable_deathbones_recipe (Disable recipe for death bones into bonemeal) bool true
|
BIN
mods/bonemeal/textures/bonemeal_bone.png
Normal file
After Width: | Height: | Size: 148 B |
BIN
mods/bonemeal/textures/bonemeal_fertiliser.png
Normal file
After Width: | Height: | Size: 182 B |
BIN
mods/bonemeal/textures/bonemeal_gelatin_powder.png
Normal file
After Width: | Height: | Size: 148 B |
BIN
mods/bonemeal/textures/bonemeal_item.png
Normal file
After Width: | Height: | Size: 182 B |
BIN
mods/bonemeal/textures/bonemeal_mulch.png
Normal file
After Width: | Height: | Size: 182 B |
BIN
mods/bonemeal/textures/bonemeal_particle.png
Normal file
After Width: | Height: | Size: 116 B |