forked from mtcontrib/bonemeal
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
a5421172d7
@ -191,6 +191,7 @@ https://forum.minetest.net/viewtopic.php?f=9&t=16446
|
||||
* Update readme (thanks mckaygerhard)
|
||||
* Recipe changes, player bones craft into 2x bones, bones must be cooked to
|
||||
give bonemeal
|
||||
* Added bushes_classic support
|
||||
|
||||
## LICENSE
|
||||
|
||||
|
14
depends.txt
14
depends.txt
@ -1,14 +0,0 @@
|
||||
default
|
||||
farming?
|
||||
ethereal?
|
||||
moretrees?
|
||||
technic_worldgen?
|
||||
lucky_block?
|
||||
flowers?
|
||||
dye?
|
||||
ferns?
|
||||
dryplants?
|
||||
df_trees?
|
||||
df_farming?
|
||||
df_primordial_items?
|
||||
everness?
|
@ -1 +0,0 @@
|
||||
Adds bone and bonemeal giving the ability to quickly grow plants and saplings.
|
146
init.lua
146
init.lua
@ -1,16 +1,31 @@
|
||||
|
||||
bonemeal = {}
|
||||
bonemeal = {
|
||||
item_list = {
|
||||
bucket_water = "buckets:bucket_water",
|
||||
bucket_empty = "buckets: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 = function(s) return s end -- default boilerplate function
|
||||
if minetest.get_translator ~= nil then
|
||||
S = minetest.get_translator("bonemeal") -- 5.x translation function
|
||||
end
|
||||
|
||||
local S = minetest.get_translator("bonemeal")
|
||||
|
||||
-- creative check
|
||||
local creative_mode_cache = minetest.settings:get_bool("creative_mode")
|
||||
@ -18,103 +33,14 @@ function bonemeal.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
|
||||
|
||||
|
||||
-- special function for cactus growth
|
||||
local function cactus_grow(pos)
|
||||
default.grow_cactus(pos, minetest.get_node(pos))
|
||||
end
|
||||
|
||||
-- special function for papyrus growth
|
||||
local function papyrus_grow(pos)
|
||||
default.grow_papyrus(pos, minetest.get_node(pos))
|
||||
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"},
|
||||
{"default:cactus", cactus_grow, "sand"},
|
||||
{"default:papyrus", papyrus_grow, "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", "", ""
|
||||
}
|
||||
|
||||
-- loads mods then add all in-game flowers except waterlily
|
||||
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("xdecor:potted_")
|
||||
and not node:find("df_farming:") then
|
||||
flowers[#flowers + 1] = node
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
-- default biomes deco
|
||||
local deco = {
|
||||
{"default:dirt", 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", "", "", ""}}
|
||||
}
|
||||
|
||||
local crops = {}
|
||||
local saplings = {}
|
||||
local deco = {}
|
||||
|
||||
--
|
||||
-- local functions
|
||||
--
|
||||
|
||||
|
||||
-- particles
|
||||
local function particle_effect(pos)
|
||||
|
||||
@ -519,6 +445,14 @@ function bonemeal:on_use(pos, strength, 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
|
||||
|
||||
@ -660,11 +594,11 @@ minetest.register_craft({
|
||||
output = "bonemeal:gelatin_powder 4",
|
||||
recipe = {
|
||||
{"group:bone", "group:bone", "group:bone"},
|
||||
{"bucket:bucket_water", "bucket:bucket_water", "bucket:bucket_water"},
|
||||
{"bucket:bucket_water", "default:torch", "bucket:bucket_water"}
|
||||
{a.bucket_water, a.bucket_water, a.bucket_water},
|
||||
{a.bucket_water, a.torch, a.bucket_water}
|
||||
},
|
||||
replacements = {
|
||||
{"bucket:bucket_water", "bucket:bucket_empty 5"}
|
||||
{a.bucket_water, a.bucket_empty .. " 5"}
|
||||
}
|
||||
})
|
||||
|
||||
@ -688,7 +622,7 @@ end
|
||||
-- bonemeal (from coral skeleton)
|
||||
minetest.register_craft({
|
||||
output = "bonemeal:bonemeal 2",
|
||||
recipe = {{"default:coral_skeleton"}}
|
||||
recipe = {{a.coral}}
|
||||
})
|
||||
|
||||
-- mulch
|
||||
@ -716,8 +650,8 @@ minetest.register_craft({
|
||||
recipe = {{"bonemeal:bonemeal", "bonemeal:mulch"}}
|
||||
})
|
||||
|
||||
|
||||
-- add bones to dirt
|
||||
-- NALC: add bones to dirt but without overriding a previous drop definition
|
||||
-- from other mods.
|
||||
local drop = minetest.registered_items["default:dirt"].drop
|
||||
if drop then
|
||||
table.insert(drop.items, 1, {items = {"bonemeal:bone"}, rarity = 30})
|
||||
@ -736,7 +670,7 @@ else
|
||||
}
|
||||
end
|
||||
|
||||
-- add support for other mods
|
||||
-- add support for mods
|
||||
dofile(path .. "/mods.lua")
|
||||
|
||||
-- lucky block support
|
||||
|
4
mod.conf
4
mod.conf
@ -1,4 +1,4 @@
|
||||
name = bonemeal
|
||||
depends = default
|
||||
optional_depends = lucky_block, farming, ethereal, moretrees, technic_worldgen, flowers, dye, ferns, dryplants, df_trees, df_farming, df_primordial_items, everness
|
||||
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
|
||||
min_minetest_version = 5.0
|
||||
|
110
mods.lua
110
mods.lua
@ -9,6 +9,97 @@ if minetest.get_modpath("animalmaterials") then
|
||||
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", "", "", ""}}
|
||||
})
|
||||
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({
|
||||
@ -327,3 +418,22 @@ if minetest.get_modpath("everness") then
|
||||
{"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
|
||||
|
Loading…
Reference in New Issue
Block a user