fixed broken cool_trees inclusion
added bonemeal mod to make its palms component happy :-P
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 564 B After Width: | Height: | Size: 564 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 908 B After Width: | Height: | Size: 908 B |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 649 B After Width: | Height: | Size: 649 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
36
bonemeal/README.md
Normal file
@ -0,0 +1,36 @@
|
||||
Bonemeal mod [bonemeal]
|
||||
|
||||
This mod adds four new items into the game, bones which can be dug from normal
|
||||
dirt which can be made 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 which 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.
|
||||
|
||||
The 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 file gives you
|
||||
many examples by using some of the popular mods available.
|
||||
|
||||
https://forum.minetest.net/viewtopic.php?f=9&t=16446
|
||||
|
||||
Changelog:
|
||||
|
||||
- 0.1 - Initial release
|
||||
- 0.2 - Added global on_use function for bonemeal growth
|
||||
- 0.3 - Added strength to on_use global for new items (mulch and fertiliser)
|
||||
- 0.4 - Added Intllib support and fr.txt file
|
||||
- 0.5 - Added support for default bush and acacia bush saplings
|
||||
- 0.6 - Using newer functions, Minetest 0.4.16 and above needed to run
|
||||
- 0.7 - Can be used on papyrus and cactus now, added coral recipe, api addition
|
||||
- 0.8 - Added support for farming redo's new garlic, pepper and onion crops
|
||||
- 0.9 - Added support for farming redo's pea and beetroot crops, checks for place_param
|
||||
- 1.0 - add_deco() now adds to existing item list while set_deco() replaces item list (thanks h-v-smacker)
|
||||
- 1.1 - Added {can_bonemeal=1} group for special nodes
|
||||
- 1.2 - Added support for minetest 5.0 cactus seedling, blueberry bush sapling and emergent jungle tree saplings, additional flowers and pine bush sapling.
|
||||
|
||||
Lucky Blocks: 6
|
96
bonemeal/api.txt
Normal file
@ -0,0 +1,96 @@
|
||||
|
||||
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 }
|
||||
})
|
||||
|
||||
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"},
|
||||
})
|
||||
|
||||
|
||||
Adding Saplings
|
||||
---------------
|
||||
|
||||
bonemeal:add_sapling({
|
||||
{ sapling_node, function, soil_type[sand, dirt, nodename] }
|
||||
})
|
||||
|
||||
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"},
|
||||
})
|
||||
|
||||
|
||||
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.
|
8
bonemeal/depends.txt
Normal file
@ -0,0 +1,8 @@
|
||||
default
|
||||
intllib?
|
||||
farming?
|
||||
ethereal?
|
||||
moretrees?
|
||||
technic_worldgen?
|
||||
lucky_block?
|
||||
flowers?
|
1
bonemeal/description.txt
Normal file
@ -0,0 +1 @@
|
||||
Adds bone and bonemeal giving the ability to quickly grow plants and saplings.
|
647
bonemeal/init.lua
Normal file
@ -0,0 +1,647 @@
|
||||
|
||||
bonemeal = {}
|
||||
|
||||
local path = minetest.get_modpath("bonemeal")
|
||||
local table_insert = table.insert
|
||||
local min, max, random = math.min, math.max, math.random
|
||||
|
||||
|
||||
-- Load support for intllib.
|
||||
local S, NS = dofile(path .. "/intllib.lua")
|
||||
|
||||
|
||||
-- creative check
|
||||
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
|
||||
function is_creative(name)
|
||||
return creative_mode_cache or minetest.check_player_privs(name, {creative = true})
|
||||
end
|
||||
|
||||
|
||||
-- default crops
|
||||
local crops = {
|
||||
{"farming:cotton_", 8, "farming:seed_cotton"},
|
||||
{"farming:wheat_", 8, "farming:seed_wheat"}
|
||||
}
|
||||
|
||||
|
||||
-- special pine check for nearby snow
|
||||
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
|
||||
|
||||
|
||||
-- default saplings
|
||||
local saplings = {
|
||||
{"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"}
|
||||
}
|
||||
|
||||
-- helper tables ( "" denotes a blank item )
|
||||
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", "", ""
|
||||
}
|
||||
|
||||
-- add all in-game flowers except waterlily
|
||||
local flowers = {}
|
||||
|
||||
for node, def in pairs(minetest.registered_nodes) do
|
||||
|
||||
if def.groups.flower and not node:find("waterlily") then
|
||||
flowers[#flowers + 1] = node
|
||||
end
|
||||
end
|
||||
|
||||
-- add additional bakedclay flowers if enabled
|
||||
if minetest.get_modpath("bakedclay") then
|
||||
flowers[#flowers + 1] = "bakedclay:delphinium"
|
||||
flowers[#flowers + 1] = "bakedclay:thistle"
|
||||
flowers[#flowers + 1] = "bakedclay:lazarus"
|
||||
flowers[#flowers + 1] = "bakedclay:mannagrass"
|
||||
flowers[#flowers + 1] = ""
|
||||
end
|
||||
|
||||
-- default biomes deco
|
||||
local deco = {
|
||||
{"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", "", "", ""} },
|
||||
}
|
||||
|
||||
|
||||
----- 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"
|
||||
})
|
||||
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, nodename)
|
||||
|
||||
-- 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] == nodename then
|
||||
|
||||
grow_on = saplings[n][3]
|
||||
|
||||
-- sapling grows on top of specific node
|
||||
if grow_on
|
||||
and grow_on ~= "soil"
|
||||
and grow_on ~= "sand"
|
||||
and grow_on == under.name then
|
||||
can_grow = true
|
||||
end
|
||||
|
||||
-- sapling grows on top of soil (default)
|
||||
if can_grow == nil
|
||||
and (grow_on == nil or grow_on == "soil")
|
||||
and minetest.get_item_group(under.name, "soil") > 0 then
|
||||
can_grow = true
|
||||
end
|
||||
|
||||
-- sapling grows on top of sand
|
||||
if can_grow == nil
|
||||
and grow_on == "sand"
|
||||
and minetest.get_item_group(under.name, "sand") > 0 then
|
||||
can_grow = true
|
||||
end
|
||||
|
||||
-- check if we can grow sapling
|
||||
if can_grow then
|
||||
particle_effect(pos)
|
||||
grow_tree(pos, saplings[n][2])
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- crops check
|
||||
local function check_crops(pos, nodename, strength)
|
||||
|
||||
local mod, crop, stage, nod, def
|
||||
|
||||
-- grow registered crops
|
||||
for n = 1, #crops do
|
||||
|
||||
if 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
|
||||
stage = tonumber( crop:split("_")[2] ) or 0
|
||||
stage = min(stage + strength, crops[n][2])
|
||||
|
||||
-- check for place_param setting
|
||||
nod = crops[n][1] .. stage
|
||||
def = minetest.registered_nodes[nod]
|
||||
def = def and def.place_param2 or 0
|
||||
|
||||
minetest.set_node(pos, {name = nod, param2 = def})
|
||||
|
||||
particle_effect(pos)
|
||||
|
||||
return
|
||||
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)
|
||||
local floor
|
||||
local groups = minetest.registered_items[nodename]
|
||||
and minetest.registered_items[nodename].groups or {}
|
||||
|
||||
-- only place decoration on one type of surface
|
||||
if groups.soil then
|
||||
floor = {"group:soil"}
|
||||
elseif groups.sand then
|
||||
floor = {"group:sand"}
|
||||
else
|
||||
floor = {nodename}
|
||||
end
|
||||
|
||||
-- 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}, floor)
|
||||
|
||||
-- set default grass and decoration
|
||||
local grass = green_grass
|
||||
local decor = flowers
|
||||
|
||||
-- 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
|
||||
|
||||
pos2 = n
|
||||
|
||||
pos2.y = pos2.y + 1
|
||||
|
||||
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
|
||||
|
||||
if nod and nod ~= "" then
|
||||
def = minetest.registered_nodes[nod]
|
||||
def = def and def.place_param2 or 0
|
||||
minetest.set_node(pos2, {name = nod, param2 = def})
|
||||
end
|
||||
|
||||
particle_effect(pos2)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- global functions
|
||||
|
||||
|
||||
-- add to sapling list
|
||||
-- {sapling node, schematic or function name, "soil"|"sand"|specific_node}
|
||||
--e.g. {"default:sapling", default.grow_new_apple_tree, "soil"}
|
||||
|
||||
function bonemeal:add_sapling(list)
|
||||
|
||||
for n = 1, #list do
|
||||
table_insert(saplings, 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
|
||||
table_insert(crops, 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
|
||||
table_insert(deco[n][2], 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
|
||||
table_insert(deco[n][3], extra)
|
||||
end
|
||||
end
|
||||
|
||||
list[l] = false
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
if list[l] then
|
||||
table_insert(deco, 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
|
||||
table_insert(deco, 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
|
||||
|
||||
elseif node.name == "default:cactus" then
|
||||
|
||||
default.grow_cactus(pos, node)
|
||||
particle_effect(pos)
|
||||
return
|
||||
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
|
||||
end
|
||||
|
||||
-- light check depending on strength (strength of 4 = no light needed)
|
||||
if (minetest.get_node_light(pos) or 0) < (12 - (strength * 3)) then
|
||||
return
|
||||
end
|
||||
|
||||
-- check for tree growth if pointing at sapling
|
||||
-- if minetest.get_item_group(node.name, "sapling") > 0
|
||||
if random(5 - strength) == 1 then
|
||||
check_sapling(pos, node.name)
|
||||
return
|
||||
end
|
||||
|
||||
-- check for crop growth
|
||||
check_crops(pos, node.name, strength)
|
||||
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)
|
||||
|
||||
-- did we point at a node?
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
-- is area protected?
|
||||
if minetest.is_protected(pointed_thing.under, user:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
-- take item if not in creative
|
||||
if not is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
||||
-- call global on_use function with strength of 1
|
||||
bonemeal:on_use(pointed_thing.under, 1)
|
||||
|
||||
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)
|
||||
|
||||
-- did we point at a node?
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
-- is area protected?
|
||||
if minetest.is_protected(pointed_thing.under, user:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
-- take item if not in creative
|
||||
if not is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
||||
-- call global on_use function with strength of 2
|
||||
bonemeal:on_use(pointed_thing.under, 2)
|
||||
|
||||
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)
|
||||
|
||||
-- did we point at a node?
|
||||
if pointed_thing.type ~= "node" then
|
||||
return
|
||||
end
|
||||
|
||||
-- is area protected?
|
||||
if minetest.is_protected(pointed_thing.under, user:get_player_name()) then
|
||||
return
|
||||
end
|
||||
|
||||
-- take item if not in creative
|
||||
if not is_creative(user:get_player_name()) then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
||||
-- call global on_use function with strength of 3
|
||||
bonemeal:on_use(pointed_thing.under, 3)
|
||||
|
||||
return itemstack
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
-- bone
|
||||
minetest.register_craftitem("bonemeal:bone", {
|
||||
description = S("Bone"),
|
||||
inventory_image = "bonemeal_bone.png"
|
||||
})
|
||||
|
||||
-- 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 = {
|
||||
{"bonemeal:bone", "bonemeal:bone", "bonemeal:bone"},
|
||||
{"bucket:bucket_water", "bucket:bucket_water", "bucket:bucket_water"},
|
||||
{"bucket:bucket_water", "default:torch", "bucket:bucket_water"},
|
||||
},
|
||||
replacements = {
|
||||
{"bucket:bucket_water", "bucket:bucket_empty 5"},
|
||||
}
|
||||
})
|
||||
|
||||
-- bonemeal (from bone)
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "bonemeal:bonemeal 2",
|
||||
recipe = {"bonemeal:bone"}
|
||||
})
|
||||
|
||||
-- bonemeal (from player bones)
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "bonemeal:bonemeal 4",
|
||||
recipe = {"bones:bones"}
|
||||
})
|
||||
|
||||
-- bonemeal (from coral skeleton)
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "bonemeal:bonemeal 2",
|
||||
recipe = {"default:coral_skeleton"}
|
||||
})
|
||||
|
||||
-- mulch
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "bonemeal:mulch 4",
|
||||
recipe = {
|
||||
"group:tree", "group:leaves", "group:leaves",
|
||||
"group:leaves", "group:leaves", "group:leaves",
|
||||
"group:leaves", "group:leaves", "group:leaves"
|
||||
}
|
||||
})
|
||||
|
||||
-- fertiliser
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "bonemeal:fertiliser 2",
|
||||
recipe = {"bonemeal:bonemeal", "bonemeal:mulch"}
|
||||
})
|
||||
|
||||
|
||||
-- add bones to dirt
|
||||
minetest.override_item("default:dirt", {
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{
|
||||
items = {"bonemeal:bone"},
|
||||
rarity = 30
|
||||
},
|
||||
{
|
||||
items = {"default:dirt"}
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
-- add support for other mods
|
||||
dofile(path .. "/mods.lua")
|
||||
dofile(path .. "/lucky_block.lua")
|
||||
|
||||
print (S("[MOD] bonemeal loaded"))
|
45
bonemeal/intllib.lua
Normal file
@ -0,0 +1,45 @@
|
||||
|
||||
-- Fallback functions for when `intllib` is not installed.
|
||||
-- Code released under Unlicense <http://unlicense.org>.
|
||||
|
||||
-- Get the latest version of this file at:
|
||||
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
|
||||
|
||||
local function format(str, ...)
|
||||
local args = { ... }
|
||||
local function repl(escape, open, num, close)
|
||||
if escape == "" then
|
||||
local replacement = tostring(args[tonumber(num)])
|
||||
if open == "" then
|
||||
replacement = replacement..close
|
||||
end
|
||||
return replacement
|
||||
else
|
||||
return "@"..open..num..close
|
||||
end
|
||||
end
|
||||
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
|
||||
end
|
||||
|
||||
local gettext, ngettext
|
||||
if minetest.get_modpath("intllib") then
|
||||
if intllib.make_gettext_pair then
|
||||
-- New method using gettext.
|
||||
gettext, ngettext = intllib.make_gettext_pair()
|
||||
else
|
||||
-- Old method using text files.
|
||||
gettext = intllib.Getter()
|
||||
end
|
||||
end
|
||||
|
||||
-- Fill in missing functions.
|
||||
|
||||
gettext = gettext or function(msgid, ...)
|
||||
return format(msgid, ...)
|
||||
end
|
||||
|
||||
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
|
||||
return format(n==1 and msgid or msgid_plural, ...)
|
||||
end
|
||||
|
||||
return gettext, ngettext
|
21
bonemeal/license.txt
Normal file
@ -0,0 +1,21 @@
|
||||
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.
|
7
bonemeal/locale/fr.txt
Normal file
@ -0,0 +1,7 @@
|
||||
# init.lua
|
||||
|
||||
Mulch = Paillis
|
||||
Bone Meal = Poudre d'os
|
||||
Fertiliser = Engrais
|
||||
Bone = Os
|
||||
[MOD] bonemeal loaded = [MOD] bonemeal chargé
|
7
bonemeal/locale/ru.txt
Normal file
@ -0,0 +1,7 @@
|
||||
# init.lua
|
||||
|
||||
Mulch = Мульча
|
||||
Bone Meal = Костная Мука
|
||||
Fertiliser = Удобрение
|
||||
Bone = Кость
|
||||
[MOD] bonemeal loaded = [MOD] костная мука загружена
|
7
bonemeal/locale/template.txt
Normal file
@ -0,0 +1,7 @@
|
||||
# init.lua
|
||||
|
||||
Mulch =
|
||||
Bone Meal =
|
||||
Fertiliser =
|
||||
Bone =
|
||||
[bonemeal] loaded =
|
29
bonemeal/lucky_block.lua
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
-- 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
|
||||
|
||||
|
||||
if minetest.get_modpath("lucky_block") then
|
||||
|
||||
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},
|
||||
}},
|
||||
})
|
||||
|
||||
end
|
1
bonemeal/mod.conf
Normal file
@ -0,0 +1 @@
|
||||
name = bonemeal
|
143
bonemeal/mods.lua
Normal file
@ -0,0 +1,143 @@
|
||||
|
||||
-- craft bones from animalmaterials into bonemeal
|
||||
if minetest.get_modpath("animalmaterials") then
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "bonemeal:bonemeal 2",
|
||||
recipe = {"animalmaterials:bone"}
|
||||
})
|
||||
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_", 3},
|
||||
{"farming:barley_", 7},
|
||||
{"farming:hemp_", 8},
|
||||
{"farming:chili_", 8},
|
||||
{"farming:garlic_", 5},
|
||||
{"farming:onion_", 5},
|
||||
{"farming:pepper_", 5},
|
||||
{"farming:pineapple_", 8},
|
||||
{"farming:pea_", 5},
|
||||
{"farming:beetroot_", 5},
|
||||
{"farming:rye_", 8},
|
||||
{"farming:oat_", 8},
|
||||
{"farming:rice_", 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:willow_sapling", ethereal.grow_willow_tree, "soil"},
|
||||
{"ethereal:redwood_sapling", ethereal.grow_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"}
|
||||
})
|
||||
|
||||
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: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.spawn_birch_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.spawn_spruce_object, "soil"},
|
||||
{"moretrees:spruce_sapling", moretrees.grow_spruce, "soil"},
|
||||
{"moretrees:cedar_sapling", moretrees.spawn_cedar_object, "soil"},
|
||||
{"moretrees:poplar_sapling", moretrees.spawn_poplar_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
|
BIN
bonemeal/screenshot.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
bonemeal/textures/bonemeal_bone.png
Normal file
After Width: | Height: | Size: 148 B |
BIN
bonemeal/textures/bonemeal_fertiliser.png
Normal file
After Width: | Height: | Size: 182 B |
BIN
bonemeal/textures/bonemeal_gelatin_powder.png
Normal file
After Width: | Height: | Size: 148 B |
BIN
bonemeal/textures/bonemeal_item.png
Normal file
After Width: | Height: | Size: 182 B |
BIN
bonemeal/textures/bonemeal_mulch.png
Normal file
After Width: | Height: | Size: 182 B |
BIN
bonemeal/textures/bonemeal_particle.png
Normal file
After Width: | Height: | Size: 116 B |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 865 B After Width: | Height: | Size: 865 B |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 886 B After Width: | Height: | Size: 886 B |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
@ -1,3 +0,0 @@
|
||||
Models, icons and textures by runs.
|
||||
License: GPLv3
|
||||
|
@ -1 +0,0 @@
|
||||
# cool_trees
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |