mirror of
https://github.com/mt-mods/plantlife_modpack.git
synced 2025-07-17 23:30:35 +02:00
Add spawning Sunflowers
This commit is contained in:
@ -12,6 +12,8 @@ local lilies_max_count = 320
|
||||
local lilies_rarity = 33
|
||||
local seaweed_max_count = 320
|
||||
local seaweed_rarity = 33
|
||||
local sunflowers_max_count = 2
|
||||
local sunflowers_rarity = 66
|
||||
|
||||
-- register the various rotations of waterlilies
|
||||
|
||||
@ -266,6 +268,36 @@ for i in ipairs(flowers_list) do
|
||||
minetest.register_alias("flowers:flower_"..flower.."_pot", "flowers:potted_"..flower)
|
||||
end
|
||||
|
||||
local box = {
|
||||
type="fixed",
|
||||
fixed = { { -0.2, -0.5, -0.2, 0.2, 0.5, 0.2 } },
|
||||
}
|
||||
|
||||
minetest.register_node(":flowers:sunflower", {
|
||||
description = "Sunflower",
|
||||
drawtype = "mesh",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
inventory_image = "flowers_sunflower_inv.png",
|
||||
mesh = "flowers_sunflower.obj",
|
||||
tiles = { "flowers_sunflower.png" },
|
||||
walkable = false,
|
||||
buildable_to = true,
|
||||
is_ground_content = true,
|
||||
groups = { dig_immediate=3, flora=1, flammable=3 },
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
selection_box = box,
|
||||
collision_box = box,
|
||||
})
|
||||
|
||||
minetest.override_item("flowers:sunflower", {drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {"farming:seed_wheat"}, rarity = 8},
|
||||
{items = {"flowers:sunflower"}},
|
||||
}
|
||||
}})
|
||||
|
||||
local extra_aliases = {
|
||||
"waterlily",
|
||||
"waterlily_225",
|
||||
@ -380,6 +412,25 @@ plantslib:register_generate_plant({
|
||||
},
|
||||
flowers_plus.grow_seaweed
|
||||
)
|
||||
|
||||
flowers_plus.grow_sunflowers = function(pos)
|
||||
local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
minetest.set_node(right_here, {name="flowers:sunflower", param2=math.random(1,3)})
|
||||
end
|
||||
|
||||
plantslib:register_generate_plant({
|
||||
surface = {"default:dirt_with_grass"},
|
||||
max_count = sunflowers_max_count,
|
||||
rarity = sunflowers_rarity,
|
||||
min_elevation = 10,
|
||||
max_elevation = 40,
|
||||
plantlife_limit = -0.9,
|
||||
temp_max = -0.22,
|
||||
temp_min = 0.22,
|
||||
},
|
||||
flowers_plus.grow_sunflowers
|
||||
)
|
||||
|
||||
-- spawn ABM registrations
|
||||
|
||||
plantslib:spawn_on_surfaces({
|
||||
@ -445,6 +496,18 @@ plantslib:spawn_on_surfaces({
|
||||
facedir = 1
|
||||
})
|
||||
|
||||
plantslib:spawn_on_surfaces({
|
||||
spawn_delay = SPAWN_DELAY*2,
|
||||
spawn_plants = {"flowers:sunflower"},
|
||||
spawn_chance = SPAWN_CHANCE*2,
|
||||
spawn_surfaces = {"default:dirt_with_grass"},
|
||||
avoid_nodes = {"group:flower", "group:flora"},
|
||||
seed_diff = flowers_seed_diff,
|
||||
light_min = 4,
|
||||
light_max = 14,
|
||||
random_facedir = {0,3}
|
||||
})
|
||||
|
||||
-- crafting recipes!
|
||||
|
||||
minetest.register_craftitem(":flowers:flower_pot", {
|
||||
@ -471,5 +534,6 @@ minetest.register_alias("flowers:flower_cotton_pot", "flowers:potted_dandelion_w
|
||||
minetest.register_alias("flowers:potted_cotton_plant", "flowers:potted_dandelion_white")
|
||||
minetest.register_alias("flowers:cotton", "farming:string")
|
||||
minetest.register_alias("flowers:cotton_wad", "farming:string")
|
||||
minetest.register_alias("sunflower:sunflower", "flowers:sunflower")
|
||||
|
||||
print(S("[Flowers] Loaded."))
|
||||
|
Reference in New Issue
Block a user