decorate fungal floor a bit

This commit is contained in:
FaceDeer 2019-08-10 01:16:23 -06:00
parent 19a6da4f78
commit e6ce07a013
2 changed files with 65 additions and 10 deletions

View File

@ -2,6 +2,10 @@ 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 perlin_cave_primordial = { local perlin_cave_primordial = {
@ -23,12 +27,31 @@ local perlin_wave_primordial = {
} }
local plants = {
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:glow_orb"),
minetest.get_content_id("df_primordial_items:glow_orb_stalks"),
minetest.get_content_id("df_primordial_items:glow_pods"),
}
local mushroom_cavern_floor = function(abs_cracks, vi, area, data, data_param2) local mushroom_cavern_floor = function(abs_cracks, vi, area, data, data_param2)
local ystride = area.ystride local ystride = area.ystride
if abs_cracks < 0.7 then
data[vi] = c_mycelial_dirt
elseif abs_cracks < 1 then
data[vi] = c_dirt
end
local rand = math.random() * math.min(abs_cracks, 1)
if rand < 0.01 then
local schematic = df_primordial_items.get_primordial_mushroom()
local rotation = (math.random(1,4)-1)*90
mapgen_helper.place_schematic_on_data(data, data_param2, area, area:position(vi+ystride), schematic, rotation)
elseif rand < 0.05 then
data[vi+ystride] = plants[math.random(1,5)]
end
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 mushroom_cavern_ceiling = function(abs_cracks, vi, area, data, data_param2) local mushroom_cavern_ceiling = function(abs_cracks, vi, area, data, data_param2)
local ystride = area.ystride local ystride = area.ystride
if abs_cracks < 0.4 then if abs_cracks < 0.4 then
@ -54,6 +77,19 @@ local mushroom_warren_ceiling = function(abs_cracks, vi, area, data, data_param2
end end
end end
local mushroom_warren_floor = function(abs_cracks, vi, area, data, data_param2)
local ystride = area.ystride
if abs_cracks < 0.7 then
data[vi] = c_mycelial_dirt
elseif abs_cracks < 1 then
data[vi] = c_dirt
end
local rand = math.random() * math.min(abs_cracks, 1)
if rand < 0.03 then
data[vi+ystride] = plants[math.random(1,5)]
end
end
local jungle_cavern_floor = function(abs_cracks, vi, area, data, data_param2) local jungle_cavern_floor = function(abs_cracks, vi, area, data, data_param2)
local ystride = area.ystride local ystride = area.ystride
end end
@ -81,11 +117,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
if jungle then -- if jungle then
jungle_cavern_floor(abs_cracks, vi, area, data, data_param2) -- jungle_cavern_floor(abs_cracks, vi, area, data, data_param2)
else -- else
mushroom_cavern_floor(abs_cracks, vi, area, data, data_param2) mushroom_cavern_floor(abs_cracks, vi, area, data, data_param2)
end -- end
end end
-------------------------------------- --------------------------------------
@ -139,6 +175,16 @@ local decorate_primordial = function(minp, maxp, seed, vm, node_arrays, area, da
-- Warren floors -- Warren floors
for _, vi in ipairs(node_arrays.warren_floor_nodes) do for _, vi in ipairs(node_arrays.warren_floor_nodes) do
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
local cracks = nvals_cracks[index2d]
local abs_cracks = math.abs(cracks)
local jungle = nvals_cave[cave_area:transform(area, vi)] < 0
-- if jungle then
-- jungle_warren_floor(abs_cracks, vi, area, data, data_param2)
-- else
mushroom_warren_floor(abs_cracks, vi, area, data, data_param2)
-- end
end end
-- columns -- columns

View File

@ -628,8 +628,17 @@ local bc_mushroom_21 = {
} }
} }
local mushrooms = {bc_mushroom_3, bc_mushroom_5, bc_mushroom_9, bc_mushroom_21} df_primordial_items.get_primordial_mushroom = function()
local rotations = {0, 90, 180, 270} local rand = math.random()
if rand < 0.3 then
return bc_mushroom_3
elseif rand < 0.7 then
return bc_mushroom_5
elseif rand < 0.975 then
return bc_mushroom_9
end
return bc_mushroom_21
end
minetest.register_node("df_primordial_items:mush_sapling", { minetest.register_node("df_primordial_items:mush_sapling", {
description = S("Primordial Mushroom Spawn"), description = S("Primordial Mushroom Spawn"),
@ -647,8 +656,8 @@ minetest.register_node("df_primordial_items:mush_sapling", {
use_texture_alpha = true, use_texture_alpha = true,
sunlight_propagates = true, sunlight_propagates = true,
on_construct = function(pos) on_construct = function(pos)
local mushroom = mushrooms[math.random(1,#mushrooms)] local mushroom = df_primordial.get_primordial_mushroom
local rotation = rotations[math.random(1,#rotations)] local rotation = (math.random(1,4)-1)*90
minetest.set_node(pos, {name="air"}) -- clear sapling so mushroom can replace it minetest.set_node(pos, {name="air"}) -- clear sapling so mushroom can replace it
mapgen_helper.place_schematic(pos, mushroom, rotation) mapgen_helper.place_schematic(pos, mushroom, rotation)
end, end,