mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2025-01-12 11:10:28 +01:00
add spawn functions to some trees that didn't have them
This commit is contained in:
parent
c3e3ea0d5d
commit
4884f1e51a
@ -301,12 +301,16 @@ minetest.register_node("df_primordial_items:fern_sapling", {
|
||||
end
|
||||
|
||||
if minetest.get_node_light(pos) > 6 then
|
||||
local fern = df_primordial_items.get_fern_schematic()
|
||||
local rotation = rotations[math.random(1,#rotations)]
|
||||
minetest.set_node(pos, {name="air"}) -- clear sapling so fern can replace it
|
||||
mapgen_helper.place_schematic(pos, fern, rotation)
|
||||
df_primordial_items.spawn_giant_fern(pos)
|
||||
else
|
||||
minetest.get_node_timer(pos):start(df_trees.config.tree_min_growth_delay)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
df_primordial_items.spawn_giant_fern = function(pos)
|
||||
local fern = df_primordial_items.get_fern_schematic()
|
||||
local rotation = rotations[math.random(1,#rotations)]
|
||||
minetest.set_node(pos, {name="air"}) -- clear sapling so fern can replace it
|
||||
mapgen_helper.place_schematic(pos, fern, rotation)
|
||||
end
|
@ -124,7 +124,6 @@ minetest.register_node("df_primordial_items:jungle_mushroom_sapling", {
|
||||
if df_farming and df_farming.kill_if_sunlit(pos) then
|
||||
return
|
||||
end
|
||||
minetest.set_node(pos, {name="air"})
|
||||
df_primordial_items.spawn_jungle_mushroom(pos)
|
||||
end,
|
||||
})
|
||||
@ -135,6 +134,7 @@ local c_cap_2 = minetest.get_content_id("df_primordial_items:jungle_mushroom_cap
|
||||
local c_air = minetest.get_content_id("air")
|
||||
|
||||
df_primordial_items.spawn_jungle_mushroom = function(pos)
|
||||
minetest.set_node(pos, {name="air"})
|
||||
local x, y, z = pos.x, pos.y, pos.z
|
||||
local stem_height = math.random(1,3)
|
||||
local cap_radius = math.random(2,3)
|
||||
|
@ -725,10 +725,13 @@ minetest.register_node("df_primordial_items:mush_sapling", {
|
||||
if df_farming and df_farming.kill_if_sunlit(pos) then
|
||||
return
|
||||
end
|
||||
df_primordial_items.spawn_primordial_mushroom(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
df_primordial_items.spawn_primordial_mushroom = function(pos)
|
||||
local mushroom = df_primordial_items.get_primordial_mushroom()
|
||||
local rotation = (math.random(1,4)-1)*90
|
||||
minetest.set_node(pos, {name="air"}) -- clear sapling so mushroom can replace it
|
||||
mapgen_helper.place_schematic(pos, mushroom, rotation)
|
||||
end,
|
||||
})
|
||||
|
||||
end
|
@ -287,11 +287,14 @@ minetest.register_node("df_trees:spindlestem_seedling", {
|
||||
if df_farming and df_farming.kill_if_sunlit(pos) then
|
||||
return
|
||||
end
|
||||
df_trees.spawn_spindlestem(pos)
|
||||
end,
|
||||
})
|
||||
|
||||
df_trees.spawn_spindlestem = function(pos)
|
||||
local cap_item = minetest.get_name_from_content_id(get_spindlestem_cap_type(pos))
|
||||
local node = minetest.get_node(pos)
|
||||
minetest.set_node(pos, {name=cap_item, param2 = node.param2})
|
||||
local meta = minetest.get_meta(pos)
|
||||
local disp = {x=3, y=3, z=3}
|
||||
local nearby = minetest.find_nodes_in_area(vector.add(pos, disp), vector.subtract(pos, disp), {"group:spindlestem"})
|
||||
local count = #nearby
|
||||
@ -299,12 +302,12 @@ minetest.register_node("df_trees:spindlestem_seedling", {
|
||||
if count > 10 then height = height + 2 end -- if there are a lot of nearby spindlestems, grow taller
|
||||
if height > 0 then
|
||||
local delay = growth_delay()
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("spindlestem_to_grow", height)
|
||||
meta:set_int("spindlestem_delay", delay)
|
||||
minetest.get_node_timer(pos):start(delay)
|
||||
end
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
register_spindlestem_type("white", S("White"), "FFFFFF", 0)
|
||||
register_spindlestem_type("red", S("Red"), "FFC3C3", 3, "color_red")
|
||||
|
Loading…
Reference in New Issue
Block a user