mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2024-11-14 22:50:27 +01:00
update primordial mushroom schematic placement to ensure it fits
This commit is contained in:
parent
78963d4b89
commit
62b33c126f
|
@ -35,38 +35,48 @@ local plants = {
|
||||||
minetest.get_content_id("df_primordial_items:glow_pods"),
|
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, humidity, vi, area, data, data_param2)
|
||||||
local ystride = area.ystride
|
local ystride = area.ystride
|
||||||
|
local humidityfactor = humidity/200 + 0.5
|
||||||
|
abs_cracks = abs_cracks * humidityfactor
|
||||||
|
|
||||||
if abs_cracks < 0.7 then
|
if abs_cracks < 0.7 then
|
||||||
data[vi] = c_mycelial_dirt
|
data[vi] = c_mycelial_dirt
|
||||||
elseif abs_cracks < 1 then
|
elseif abs_cracks < 1 then
|
||||||
data[vi] = c_dirt
|
data[vi] = c_dirt
|
||||||
end
|
end
|
||||||
local rand = math.random() * math.min(abs_cracks, 1)
|
|
||||||
|
local rand = math.random() * math.min(abs_cracks, 1) * humidityfactor
|
||||||
if rand < 0.01 then
|
if rand < 0.01 then
|
||||||
local schematic = df_primordial_items.get_primordial_mushroom()
|
local schematic = df_primordial_items.get_primordial_mushroom()
|
||||||
local rotation = (math.random(1,4)-1)*90
|
local rotation = (math.random(1,4)-1)*90
|
||||||
mapgen_helper.place_schematic_on_data(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] = plants[math.random(1,5)]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local mushroom_cavern_ceiling = function(abs_cracks, vi, area, data, data_param2)
|
local mushroom_cavern_ceiling = function(abs_cracks, humidity, vi, area, data, data_param2)
|
||||||
local ystride = area.ystride
|
local ystride = area.ystride
|
||||||
if abs_cracks < 0.4 then
|
local humidityfactor = humidity/200 + 0.5
|
||||||
|
abs_cracks = abs_cracks * humidityfactor
|
||||||
|
|
||||||
|
if abs_cracks < 0.5 then
|
||||||
data[vi] = c_mycelial_dirt
|
data[vi] = c_mycelial_dirt
|
||||||
if abs_cracks < 0.3 then
|
if abs_cracks < 0.3 then
|
||||||
if math.random() < 0.2 then
|
local rand = math.random() * humidityfactor
|
||||||
data[vi-ystride] = c_orb
|
if rand < 0.03 then
|
||||||
elseif math.random() < 0.03 then
|
|
||||||
df_primordial_items.spawn_ceiling_spire_vm(vi, area, data)
|
df_primordial_items.spawn_ceiling_spire_vm(vi, area, data)
|
||||||
|
elseif rand < 0.2 then
|
||||||
|
data[vi-ystride] = c_orb
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local mushroom_warren_ceiling = function(abs_cracks, vi, area, data, data_param2)
|
local mushroom_warren_ceiling = function(abs_cracks, vi, area, data, data_param2)
|
||||||
local ystride = area.ystride
|
local ystride = area.ystride
|
||||||
|
|
||||||
if abs_cracks < 0.3 then
|
if abs_cracks < 0.3 then
|
||||||
data[vi] = c_mycelial_dirt
|
data[vi] = c_mycelial_dirt
|
||||||
if abs_cracks < 0.2 then
|
if abs_cracks < 0.2 then
|
||||||
|
@ -108,6 +118,9 @@ local decorate_primordial = function(minp, maxp, seed, vm, node_arrays, area, da
|
||||||
local cave_area = node_arrays.cave_area
|
local cave_area = node_arrays.cave_area
|
||||||
local nvals_cave = node_arrays.nvals_cave
|
local nvals_cave = node_arrays.nvals_cave
|
||||||
|
|
||||||
|
local humiditymap = minetest.get_mapgen_object("humiditymap")
|
||||||
|
|
||||||
|
|
||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
-- Cavern floors
|
-- Cavern floors
|
||||||
|
|
||||||
|
@ -115,12 +128,13 @@ local decorate_primordial = function(minp, maxp, seed, vm, node_arrays, area, da
|
||||||
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
|
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
|
||||||
local cracks = nvals_cracks[index2d]
|
local cracks = nvals_cracks[index2d]
|
||||||
local abs_cracks = math.abs(cracks)
|
local abs_cracks = math.abs(cracks)
|
||||||
|
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, vi, area, data, data_param2)
|
||||||
-- else
|
-- else
|
||||||
mushroom_cavern_floor(abs_cracks, vi, area, data, data_param2)
|
mushroom_cavern_floor(abs_cracks, humidity, vi, area, data, data_param2)
|
||||||
-- end
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -132,11 +146,11 @@ local decorate_primordial = function(minp, maxp, seed, vm, node_arrays, area, da
|
||||||
local cracks = nvals_cracks[index2d]
|
local cracks = nvals_cracks[index2d]
|
||||||
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]
|
||||||
-- 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, vi, area, data, data_param2)
|
mushroom_cavern_ceiling(abs_cracks, humidity, vi, area, data, data_param2)
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user