mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2025-06-28 14:36:20 +02:00
rough out the jungle biome
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
default
|
||||
mapgen_helper
|
||||
subterrane
|
||||
subterrane
|
||||
df_underworld_items
|
@ -238,6 +238,10 @@ local fern_9_nodes_tall = {
|
||||
local ferns = {fern_4_nodes_tall, fern_5_nodes_tall, fern_6_nodes_tall, fern_9_nodes_tall}
|
||||
local rotations = {0, 90, 180, 270}
|
||||
|
||||
df_primordial_items.get_fern_schematic = function()
|
||||
return ferns[math.random(1,4)]
|
||||
end
|
||||
|
||||
minetest.register_node("df_primordial_items:fern_sapling", {
|
||||
description = S("Giant Fern Sapling"),
|
||||
_doc_items_longdesc = df_primordial_items.doc.giant_fern_desc,
|
||||
@ -254,9 +258,10 @@ minetest.register_node("df_primordial_items:fern_sapling", {
|
||||
use_texture_alpha = true,
|
||||
sunlight_propagates = true,
|
||||
on_construct = function(pos)
|
||||
local fern = ferns[math.random(1,#ferns)]
|
||||
--TODO timer
|
||||
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,
|
||||
})
|
||||
})
|
||||
|
@ -70,7 +70,7 @@ minetest.register_craftitem("df_primordial_items:diced_mushroom", {
|
||||
_doc_items_longdesc = df_primordial_items.doc.big_mushroom_desc,
|
||||
_doc_items_usagehelp = df_primordial_items.doc.big_mushroom_usage,
|
||||
inventory_image = "dfcaverns_mush_diced_giant_mushroom.png",
|
||||
groups = {food = 1},
|
||||
groups = {food = 1, dfcaverns_cookable = 1},
|
||||
on_use = minetest.item_eat(1),
|
||||
})
|
||||
|
||||
|
@ -46,7 +46,7 @@ minetest.register_node("df_primordial_items:jungle_leaves_glowing", {
|
||||
paramtype = "light",
|
||||
is_ground_content = false,
|
||||
buildable_to = true,
|
||||
light_source = 4,
|
||||
light_source = 2,
|
||||
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
drop = {
|
||||
@ -140,6 +140,17 @@ df_primordial_items.spawn_jungle_tree = function(pos)
|
||||
vm:update_map()
|
||||
end
|
||||
|
||||
local get_tree_nodes = function()
|
||||
local rand = math.random()
|
||||
if rand < 0.5 then
|
||||
return c_trunk_glow, c_leaves_glow
|
||||
end
|
||||
if rand < 0.75 then
|
||||
return c_trunk_mossy, c_leaves
|
||||
end
|
||||
return c_trunk, c_leaves
|
||||
end
|
||||
|
||||
df_primordial_items.spawn_jungle_tree_vm = function(height, vi, area, data)
|
||||
local ystride = area.ystride
|
||||
local zstride = area.zstride
|
||||
@ -149,10 +160,11 @@ df_primordial_items.spawn_jungle_tree_vm = function(height, vi, area, data)
|
||||
for i = 1, 6 do
|
||||
local root_column = vi + math.random(-1,1) + math.random(-1,1)*zstride
|
||||
if not roots_done[root_column] then
|
||||
local trunknode = get_tree_nodes()
|
||||
for y = -2, math.random(0,1) do -- root height is 1 to 2 nodes above ground
|
||||
local root_index = root_column + y * ystride
|
||||
if buildable_to(data[root_index]) then
|
||||
data[root_index] = c_trunk
|
||||
data[root_index] = trunknode
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -160,9 +172,11 @@ df_primordial_items.spawn_jungle_tree_vm = function(height, vi, area, data)
|
||||
end
|
||||
|
||||
-- puts a trunk node in the center and surrounds it with leaves
|
||||
local branch = function(bi)
|
||||
local branch = function(bi, glow)
|
||||
local trunknode, leafnode
|
||||
if buildable_to(data[bi]) then
|
||||
data[bi] = c_trunk
|
||||
trunknode, leafnode = get_tree_nodes()
|
||||
data[bi] = trunknode
|
||||
else
|
||||
return -- if a branch is placed in a non-viable place, don't add leaves
|
||||
end
|
||||
@ -172,7 +186,7 @@ df_primordial_items.spawn_jungle_tree_vm = function(height, vi, area, data)
|
||||
if math.random() < 0.75 then
|
||||
local li = bi + x + z*zstride + y*ystride
|
||||
if buildable_to(data[li]) then
|
||||
data[li] = c_leaves
|
||||
data[li] = leafnode
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -183,7 +197,7 @@ df_primordial_items.spawn_jungle_tree_vm = function(height, vi, area, data)
|
||||
for i = 0, height-2 do
|
||||
local y_index = vi + i * ystride
|
||||
if buildable_to(data[y_index]) then
|
||||
data[y_index] = c_trunk
|
||||
data[y_index] = get_tree_nodes()
|
||||
else
|
||||
return -- if we hit something we can't grow through, stop.
|
||||
end
|
||||
|
Reference in New Issue
Block a user