[nalc_riesenpilz] Ajoute support bonemeal
This commit is contained in:
parent
61176e5bf0
commit
6ac7a6f608
@ -1530,7 +1530,7 @@ end
|
|||||||
for _,mushname in pairs({
|
for _,mushname in pairs({
|
||||||
"brown", "red", "fly_agaric",
|
"brown", "red", "fly_agaric",
|
||||||
"lavashroom", "glowshroom",
|
"lavashroom", "glowshroom",
|
||||||
"parasol"
|
"parasol", "red45"
|
||||||
}) do
|
}) do
|
||||||
minetest.register_decoration(
|
minetest.register_decoration(
|
||||||
{
|
{
|
||||||
@ -1545,3 +1545,117 @@ for _,mushname in pairs({
|
|||||||
decoration = "riesenpilz:"..mushname,
|
decoration = "riesenpilz:"..mushname,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Bonemeal support
|
||||||
|
if minetest.get_modpath("bonemeal") then
|
||||||
|
|
||||||
|
local grow_params = {
|
||||||
|
["riesenpilz:red"] = {
|
||||||
|
[1] = {
|
||||||
|
schem = gmr_tiny_schem,
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
schem = gmr_mid_schem,
|
||||||
|
},
|
||||||
|
[3] = {
|
||||||
|
schem = gmr_big_schem,
|
||||||
|
}},
|
||||||
|
["riesenpilz:fly_agaric"] = {
|
||||||
|
[1] = {
|
||||||
|
schem = gymr_schem,
|
||||||
|
}},
|
||||||
|
["riesenpilz:brown"] = {
|
||||||
|
[1] = {
|
||||||
|
schem = gmb_tiny_schem,
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
schem = gmb_mid_schem,
|
||||||
|
},
|
||||||
|
[3] = {
|
||||||
|
schem = gmb_big_schem,
|
||||||
|
}},
|
||||||
|
["riesenpilz:lavashroom"] = {
|
||||||
|
[1] = {
|
||||||
|
schem = gml_schem,
|
||||||
|
}},
|
||||||
|
["riesenpilz:glowshroom"] = {
|
||||||
|
[1] = {
|
||||||
|
schem = gmg_schem,
|
||||||
|
}},
|
||||||
|
["riesenpilz:parasol"] = {
|
||||||
|
[1] = {
|
||||||
|
schem = gmw_mid_schem,
|
||||||
|
},
|
||||||
|
[2] = {
|
||||||
|
schem = gmw_big_schem,
|
||||||
|
}},
|
||||||
|
["riesenpilz:red45"] = {
|
||||||
|
[1] = {
|
||||||
|
schem = gmr45_schem,
|
||||||
|
}},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Override mushrooms
|
||||||
|
for _,mushname in pairs({
|
||||||
|
"brown", "red", "fly_agaric",
|
||||||
|
"lavashroom", "glowshroom",
|
||||||
|
"parasol", "red45"
|
||||||
|
}) do
|
||||||
|
|
||||||
|
local groups = table.copy(minetest.registered_nodes["riesenpilz:"..mushname].groups)
|
||||||
|
groups.sapling = 1
|
||||||
|
local minp = table.copy( grow_params["riesenpilz:"..mushname][#grow_params["riesenpilz:"..mushname]].schem.size)
|
||||||
|
local maxp = table.copy(minp)
|
||||||
|
minp.x = 0 - math.floor(minp.x/2)
|
||||||
|
minp.y = 1
|
||||||
|
minp.z = minp.x
|
||||||
|
maxp.x = math.abs(minp.x)
|
||||||
|
maxp.z = maxp.x
|
||||||
|
|
||||||
|
minetest.override_item(
|
||||||
|
"riesenpilz:"..mushname, {
|
||||||
|
groups = groups,
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
itemstack = default.sapling_on_place(
|
||||||
|
itemstack, placer, pointed_thing,
|
||||||
|
"riesenpilz:"..mushname,
|
||||||
|
minp,
|
||||||
|
maxp,
|
||||||
|
4)
|
||||||
|
return itemstack
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
local function grow_mushroom(pos)
|
||||||
|
if not default.can_grow(pos) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local grow_param = grow_params[node.name]
|
||||||
|
|
||||||
|
if grow_param then
|
||||||
|
minetest.log("action", "A mushroom grows into a giant mushroom at "..
|
||||||
|
minetest.pos_to_string(pos))
|
||||||
|
local i = math.random(1, #grow_param)
|
||||||
|
local center = table.copy(grow_param[i].schem.size)
|
||||||
|
center.x = pos.x - (math.floor(center.x/2))
|
||||||
|
center.y = pos.y - 1
|
||||||
|
center.z = pos.z - (math.floor(center.z/2))
|
||||||
|
minetest.place_schematic(center, grow_param[i].schem, nil, nil, true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
bonemeal:add_sapling({
|
||||||
|
{"riesenpilz:red", grow_mushroom, "soil"},
|
||||||
|
{"riesenpilz:fly_agaric", grow_mushroom, "soil"},
|
||||||
|
{"riesenpilz:brown", grow_mushroom, "soil"},
|
||||||
|
{"riesenpilz:lavashroom", grow_mushroom, "soil"},
|
||||||
|
{"riesenpilz:glowshroom", grow_mushroom, "soil"},
|
||||||
|
{"riesenpilz:parasol", grow_mushroom, "soil"},
|
||||||
|
{"riesenpilz:red45", grow_mushroom, "soil"}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.log("action", "[nalc_riesenpilz] loaded.")
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
name = nalc_riesenpilz
|
name = nalc_riesenpilz
|
||||||
description = Generate mushroom biomes with schematics in Minetest.
|
description = Generate mushroom biomes with schematics in Minetest.
|
||||||
depends = default,riesenpilz,stairs
|
depends = default,riesenpilz,stairs
|
||||||
|
optional_depends = bonemeal
|
||||||
|
Loading…
Reference in New Issue
Block a user