mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2025-02-27 17:20:21 +01:00
fix up tunnel webs
This commit is contained in:
parent
0c5d49ffd5
commit
126efd8a67
@ -95,8 +95,9 @@ local web_line = function(pos, dir, distance)
|
||||
|
||||
if anchored then
|
||||
for _, web_pos in pairs(web_spine) do
|
||||
minetest.set_node(web_pos, {name="big_webs:webbing"})
|
||||
minetest.get_node_timer(web_pos):stop() -- no need to test, we know it's anchored
|
||||
if math.random() < 0.9 then
|
||||
minetest.set_node(web_pos, {name="big_webs:webbing"})
|
||||
end
|
||||
end
|
||||
return web_spine
|
||||
end
|
||||
@ -106,9 +107,7 @@ end
|
||||
local generate_web = function(pos)
|
||||
local dir_choice = math.random(1, 6)
|
||||
local dir = cardinal_directions[dir_choice]
|
||||
minetest.chat_send_all(minetest.pos_to_string(dir))
|
||||
local web_spine = web_line(pos, dir, 30)
|
||||
minetest.chat_send_all(dump(web_spine))
|
||||
if web_spine then
|
||||
local dir2 = cardinal_directions[cardinal_planes[dir_choice][math.random(1, 2)]]
|
||||
local dir2_opposite = vector.multiply(dir2, -1)
|
||||
@ -157,11 +156,6 @@ minetest.register_node("big_webs:webbing", {
|
||||
local anchors = {}
|
||||
get_web_nodes(pos, webs, anchors)
|
||||
local first_anchor = next(anchors)
|
||||
-- if first_anchor then
|
||||
-- minetest.chat_send_all("supported")
|
||||
-- else
|
||||
-- minetest.chat_send_all("unsupported")
|
||||
-- end
|
||||
for hash, _ in pairs(webs) do
|
||||
local web_pos = minetest.get_position_from_hash(hash)
|
||||
if first_anchor == nil then
|
||||
|
@ -358,6 +358,7 @@ local decorate_level_3 = function(minp, maxp, seed, vm, node_arrays, area, data)
|
||||
local index2d = mapgen_helper.index2di(minp, maxp, area, vi)
|
||||
local biome_name = get_biome(heatmap[index2d], humiditymap[index2d])
|
||||
local flooded_caverns = nvals_cave[vi] < 0 -- this indicates if we're in the "flooded" set of caves or not.
|
||||
local ystride = area.ystride
|
||||
|
||||
if not (flooded_caverns and minp.y < subsea_level and area:get_y(vi) < subsea_level) then
|
||||
if flooded_caverns or biome_name == "blackcap" then
|
||||
@ -366,21 +367,15 @@ local decorate_level_3 = function(minp, maxp, seed, vm, node_arrays, area, data)
|
||||
else
|
||||
df_caverns.tunnel_ceiling(minp, maxp, area, vi, nvals_cracks, data, data_param2, false)
|
||||
end
|
||||
|
||||
if c_webs_egg and not flooded_caverns and biome_name == "barren" and nvals_cracks[index2d] > 0.5 then
|
||||
if math.random() < 0.05 then
|
||||
local index = vi-ystride
|
||||
if data[index] == c_air then
|
||||
data[index] = c_webs_egg
|
||||
minetest.get_node_timer(area:position(index)):start(1)
|
||||
--minetest.debug("webs generated at " .. minetest.pos_to_string(area:position(index)))
|
||||
end
|
||||
if c_webs_egg and not flooded_caverns and biome_name == "barren" and nvals_cracks[index2d] > 0.5 and math.random() < 0.2 then
|
||||
local index = vi-ystride
|
||||
if data[index] == c_air then
|
||||
data[index] = c_webs_egg
|
||||
minetest.get_node_timer(area:position(index)):start(1)
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
-- air pockets
|
||||
local ystride = area.ystride
|
||||
local cracks = nvals_cracks[index2d]
|
||||
if cracks > 0.5 and data[vi-ystride] == c_water then
|
||||
data[vi-ystride] = c_air
|
||||
|
Loading…
x
Reference in New Issue
Block a user