mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2025-01-26 18:10:22 +01:00
rough out the jungle biome
This commit is contained in:
parent
c64f0a6f63
commit
9db3e47342
@ -2,13 +2,6 @@ if not df_caverns.config.enable_primordial or not minetest.get_modpath("df_primo
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local c_orb = minetest.get_content_id("df_primordial_items:glow_orb_hanging")
|
|
||||||
local c_mycelial_dirt = minetest.get_content_id("df_primordial_items:dirt_with_mycelium")
|
|
||||||
local c_dirt = minetest.get_content_id("default:dirt")
|
|
||||||
local c_giant_mycelium = minetest.get_content_id("df_primordial_items:giant_hypha_apical_mapgen")
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
local perlin_cave_primordial = {
|
local perlin_cave_primordial = {
|
||||||
offset = 0,
|
offset = 0,
|
||||||
scale = 1,
|
scale = 1,
|
||||||
@ -27,8 +20,15 @@ local perlin_wave_primordial = {
|
|||||||
persist = 0.63
|
persist = 0.63
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------------------
|
||||||
|
-- Fungal biome
|
||||||
|
|
||||||
local plants = {
|
local c_orb = minetest.get_content_id("df_primordial_items:glow_orb_hanging")
|
||||||
|
local c_mycelial_dirt = minetest.get_content_id("df_primordial_items:dirt_with_mycelium")
|
||||||
|
local c_dirt = minetest.get_content_id("default:dirt")
|
||||||
|
local c_giant_mycelium = minetest.get_content_id("df_primordial_items:giant_hypha_apical_mapgen")
|
||||||
|
|
||||||
|
local fungal_plants = {
|
||||||
minetest.get_content_id("df_primordial_items:fungal_grass_1"),
|
minetest.get_content_id("df_primordial_items:fungal_grass_1"),
|
||||||
minetest.get_content_id("df_primordial_items:fungal_grass_2"),
|
minetest.get_content_id("df_primordial_items:fungal_grass_2"),
|
||||||
minetest.get_content_id("df_primordial_items:glow_orb"),
|
minetest.get_content_id("df_primordial_items:glow_orb"),
|
||||||
@ -55,7 +55,7 @@ local mushroom_cavern_floor = function(abs_cracks, humidity, vi, area, data, dat
|
|||||||
local rotation = (math.random(1,4)-1)*90
|
local rotation = (math.random(1,4)-1)*90
|
||||||
mapgen_helper.place_schematic_on_data_if_it_fits(data, data_param2, area, area:position(vi+ystride), schematic, rotation)
|
mapgen_helper.place_schematic_on_data_if_it_fits(data, data_param2, area, area:position(vi+ystride), schematic, rotation)
|
||||||
elseif rand < 0.05 then
|
elseif rand < 0.05 then
|
||||||
data[vi+ystride] = plants[math.random(1,5)]
|
data[vi+ystride] = fungal_plants[math.random(1,5)]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -108,19 +108,63 @@ local mushroom_warren_floor = function(abs_cracks, vi, area, data, data_param2)
|
|||||||
if rand < 0.001 then
|
if rand < 0.001 then
|
||||||
data[vi+ystride] = c_giant_mycelium
|
data[vi+ystride] = c_giant_mycelium
|
||||||
elseif rand < 0.03 then
|
elseif rand < 0.03 then
|
||||||
data[vi+ystride] = plants[math.random(1,5)]
|
data[vi+ystride] = fungal_plants[math.random(1,5)]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local jungle_cavern_floor = function(abs_cracks, vi, area, data, data_param2)
|
--------------------------------------------------------------------------------------------------
|
||||||
|
-- Jungle biome
|
||||||
|
|
||||||
|
|
||||||
|
local jungle_plants = {
|
||||||
|
minetest.get_content_id("df_primordial_items:fern_1"),
|
||||||
|
minetest.get_content_id("df_primordial_items:fern_2"),
|
||||||
|
minetest.get_content_id("df_primordial_items:glow_plant_1"),
|
||||||
|
minetest.get_content_id("df_primordial_items:glow_plant_2"),
|
||||||
|
minetest.get_content_id("df_primordial_items:glow_plant_3"),
|
||||||
|
minetest.get_content_id("df_primordial_items:jungle_grass_1"),
|
||||||
|
minetest.get_content_id("df_primordial_items:jungle_grass_2"),
|
||||||
|
minetest.get_content_id("df_primordial_items:jungle_grass_3"),
|
||||||
|
minetest.get_content_id("df_primordial_items:jungle_mushroom_1"),
|
||||||
|
minetest.get_content_id("df_primordial_items:jungle_mushroom_2"),
|
||||||
|
}
|
||||||
|
|
||||||
|
local c_jungle_dirt = minetest.get_content_id("df_primordial_items:dirt_with_jungle_grass")
|
||||||
|
local c_plant_matter = minetest.get_content_id("df_primordial_items:plant_matter")
|
||||||
|
local c_packed_roots = minetest.get_content_id("df_primordial_items:packed_roots")
|
||||||
|
local c_glowstone = minetest.get_content_id("df_underworld_items:glowstone")
|
||||||
|
|
||||||
|
local jungle_cavern_floor = function(abs_cracks, humidity, vi, area, data, data_param2)
|
||||||
local ystride = area.ystride
|
local ystride = area.ystride
|
||||||
|
local humidityfactor = humidity/100
|
||||||
|
|
||||||
|
data[vi] = c_jungle_dirt
|
||||||
|
|
||||||
|
local rand = math.random()
|
||||||
|
if rand < 0.05 then
|
||||||
|
local fern_schematic = df_primordial_items.get_fern_schematic()
|
||||||
|
local rotation = (math.random(1,4)-1)*90
|
||||||
|
mapgen_helper.place_schematic_on_data_if_it_fits(data, data_param2, area, area:position(vi+ystride), fern_schematic, rotation)
|
||||||
|
elseif rand < 0.075 then
|
||||||
|
df_primordial_items.spawn_jungle_mushroom_vm(vi+ystride, area, data)
|
||||||
|
elseif rand < 0.125 then
|
||||||
|
df_primordial_items.spawn_jungle_tree_vm(math.random(8,14), vi+ystride, area, data)
|
||||||
|
elseif rand < 0.3 then
|
||||||
|
data[vi+ystride] = jungle_plants[math.random(1,#jungle_plants)]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local jungle_cavern_ceiling = function(abs_cracks, vi, area, data, data_param2)
|
local jungle_cavern_ceiling = function(abs_cracks, vi, area, data, data_param2)
|
||||||
|
if abs_cracks < 0.25 then
|
||||||
|
data[vi] = c_glowstone
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local jungle_warren_ceiling = function(abs_cracks, vi, area, data, data_param2)
|
local jungle_warren_ceiling = function(abs_cracks, vi, area, data, data_param2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
local decorate_primordial = function(minp, maxp, seed, vm, node_arrays, area, data)
|
local decorate_primordial = function(minp, maxp, seed, vm, node_arrays, area, data)
|
||||||
math.randomseed(minp.x + minp.y*2^8 + minp.z*2^16 + seed) -- make decorations consistent between runs
|
math.randomseed(minp.x + minp.y*2^8 + minp.z*2^16 + seed) -- make decorations consistent between runs
|
||||||
|
|
||||||
@ -143,11 +187,11 @@ local decorate_primordial = function(minp, maxp, seed, vm, node_arrays, area, da
|
|||||||
local humidity = humiditymap[index2d]
|
local humidity = humiditymap[index2d]
|
||||||
local jungle = nvals_cave[cave_area:transform(area, vi)] < 0
|
local jungle = nvals_cave[cave_area:transform(area, vi)] < 0
|
||||||
|
|
||||||
-- if jungle then
|
if jungle then
|
||||||
-- jungle_cavern_floor(abs_cracks, vi, area, data, data_param2)
|
jungle_cavern_floor(abs_cracks, humidity, vi, area, data, data_param2)
|
||||||
-- else
|
else
|
||||||
mushroom_cavern_floor(abs_cracks, humidity, vi, area, data, data_param2)
|
mushroom_cavern_floor(abs_cracks, humidity, vi, area, data, data_param2)
|
||||||
-- end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------
|
--------------------------------------
|
||||||
@ -159,11 +203,11 @@ local decorate_primordial = function(minp, maxp, seed, vm, node_arrays, area, da
|
|||||||
local abs_cracks = math.abs(cracks)
|
local abs_cracks = math.abs(cracks)
|
||||||
local jungle = nvals_cave[cave_area:transform(area, vi)] < 0
|
local jungle = nvals_cave[cave_area:transform(area, vi)] < 0
|
||||||
local humidity = humiditymap[index2d]
|
local humidity = humiditymap[index2d]
|
||||||
-- if jungle then
|
if jungle then
|
||||||
-- jungle_cavern_ceiling(abs_cracks, vi, area, data, data_param2)
|
jungle_cavern_ceiling(abs_cracks, vi, area, data, data_param2)
|
||||||
-- else
|
else
|
||||||
mushroom_cavern_ceiling(abs_cracks, humidity, vi, area, data, data_param2)
|
mushroom_cavern_ceiling(abs_cracks, humidity, vi, area, data, data_param2)
|
||||||
-- end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
default
|
default
|
||||||
mapgen_helper
|
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 ferns = {fern_4_nodes_tall, fern_5_nodes_tall, fern_6_nodes_tall, fern_9_nodes_tall}
|
||||||
local rotations = {0, 90, 180, 270}
|
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", {
|
minetest.register_node("df_primordial_items:fern_sapling", {
|
||||||
description = S("Giant Fern Sapling"),
|
description = S("Giant Fern Sapling"),
|
||||||
_doc_items_longdesc = df_primordial_items.doc.giant_fern_desc,
|
_doc_items_longdesc = df_primordial_items.doc.giant_fern_desc,
|
||||||
@ -254,7 +258,8 @@ minetest.register_node("df_primordial_items:fern_sapling", {
|
|||||||
use_texture_alpha = true,
|
use_texture_alpha = true,
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
on_construct = function(pos)
|
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)]
|
local rotation = rotations[math.random(1,#rotations)]
|
||||||
minetest.set_node(pos, {name="air"}) -- clear sapling so fern can replace it
|
minetest.set_node(pos, {name="air"}) -- clear sapling so fern can replace it
|
||||||
mapgen_helper.place_schematic(pos, fern, rotation)
|
mapgen_helper.place_schematic(pos, fern, rotation)
|
||||||
|
@ -70,7 +70,7 @@ minetest.register_craftitem("df_primordial_items:diced_mushroom", {
|
|||||||
_doc_items_longdesc = df_primordial_items.doc.big_mushroom_desc,
|
_doc_items_longdesc = df_primordial_items.doc.big_mushroom_desc,
|
||||||
_doc_items_usagehelp = df_primordial_items.doc.big_mushroom_usage,
|
_doc_items_usagehelp = df_primordial_items.doc.big_mushroom_usage,
|
||||||
inventory_image = "dfcaverns_mush_diced_giant_mushroom.png",
|
inventory_image = "dfcaverns_mush_diced_giant_mushroom.png",
|
||||||
groups = {food = 1},
|
groups = {food = 1, dfcaverns_cookable = 1},
|
||||||
on_use = minetest.item_eat(1),
|
on_use = minetest.item_eat(1),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ minetest.register_node("df_primordial_items:jungle_leaves_glowing", {
|
|||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
buildable_to = true,
|
buildable_to = true,
|
||||||
light_source = 4,
|
light_source = 2,
|
||||||
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
|
groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1},
|
||||||
sounds = default.node_sound_leaves_defaults(),
|
sounds = default.node_sound_leaves_defaults(),
|
||||||
drop = {
|
drop = {
|
||||||
@ -140,6 +140,17 @@ df_primordial_items.spawn_jungle_tree = function(pos)
|
|||||||
vm:update_map()
|
vm:update_map()
|
||||||
end
|
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)
|
df_primordial_items.spawn_jungle_tree_vm = function(height, vi, area, data)
|
||||||
local ystride = area.ystride
|
local ystride = area.ystride
|
||||||
local zstride = area.zstride
|
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
|
for i = 1, 6 do
|
||||||
local root_column = vi + math.random(-1,1) + math.random(-1,1)*zstride
|
local root_column = vi + math.random(-1,1) + math.random(-1,1)*zstride
|
||||||
if not roots_done[root_column] then
|
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
|
for y = -2, math.random(0,1) do -- root height is 1 to 2 nodes above ground
|
||||||
local root_index = root_column + y * ystride
|
local root_index = root_column + y * ystride
|
||||||
if buildable_to(data[root_index]) then
|
if buildable_to(data[root_index]) then
|
||||||
data[root_index] = c_trunk
|
data[root_index] = trunknode
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -160,9 +172,11 @@ df_primordial_items.spawn_jungle_tree_vm = function(height, vi, area, data)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- puts a trunk node in the center and surrounds it with leaves
|
-- 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
|
if buildable_to(data[bi]) then
|
||||||
data[bi] = c_trunk
|
trunknode, leafnode = get_tree_nodes()
|
||||||
|
data[bi] = trunknode
|
||||||
else
|
else
|
||||||
return -- if a branch is placed in a non-viable place, don't add leaves
|
return -- if a branch is placed in a non-viable place, don't add leaves
|
||||||
end
|
end
|
||||||
@ -172,7 +186,7 @@ df_primordial_items.spawn_jungle_tree_vm = function(height, vi, area, data)
|
|||||||
if math.random() < 0.75 then
|
if math.random() < 0.75 then
|
||||||
local li = bi + x + z*zstride + y*ystride
|
local li = bi + x + z*zstride + y*ystride
|
||||||
if buildable_to(data[li]) then
|
if buildable_to(data[li]) then
|
||||||
data[li] = c_leaves
|
data[li] = leafnode
|
||||||
end
|
end
|
||||||
end
|
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
|
for i = 0, height-2 do
|
||||||
local y_index = vi + i * ystride
|
local y_index = vi + i * ystride
|
||||||
if buildable_to(data[y_index]) then
|
if buildable_to(data[y_index]) then
|
||||||
data[y_index] = c_trunk
|
data[y_index] = get_tree_nodes()
|
||||||
else
|
else
|
||||||
return -- if we hit something we can't grow through, stop.
|
return -- if we hit something we can't grow through, stop.
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user