mirror of
https://github.com/FaceDeer/dfcaverns.git
synced 2025-02-11 09:40:42 +01:00
add fireflies to primordial, spread out the post-mapgen node timer for plant matter a bit more.
This commit is contained in:
parent
64ab6ebd05
commit
ad319c50a3
@ -1,4 +1,4 @@
|
||||
name = df_caverns
|
||||
description = Adds vast underground caverns in the style of Dwarf Fortress, complete with underground flora in diverse biomes. Also adds stalactite/stalagmite decorations in the smaller tunnels.
|
||||
depends = default, subterrane, df_trees, df_mapitems
|
||||
optional_depends = df_farming, ice_sprites, oil, df_underworld_items, magma_conduits, bones_loot, named_waypoints, namegen
|
||||
optional_depends = df_farming, ice_sprites, oil, df_underworld_items, magma_conduits, bones_loot, named_waypoints, namegen, fireflies
|
@ -143,6 +143,11 @@ local c_ivy = minetest.get_content_id("df_primordial_items:jungle_ivy")
|
||||
local c_root_2 = minetest.get_content_id("df_primordial_items:jungle_roots_2")
|
||||
local c_root_1 = minetest.get_content_id("df_primordial_items:jungle_roots_1")
|
||||
|
||||
local c_fireflies
|
||||
if minetest.get_modpath("fireflies") then
|
||||
c_fireflies = minetest.get_content_id("fireflies:firefly")
|
||||
end
|
||||
|
||||
local jungle_cavern_floor = function(abs_cracks, humidity, vi, area, data, data_param2)
|
||||
local ystride = area.ystride
|
||||
local humidityfactor = humidity/100
|
||||
@ -161,6 +166,13 @@ local jungle_cavern_floor = function(abs_cracks, humidity, vi, area, data, data_
|
||||
elseif rand < 0.3 then
|
||||
data[vi+ystride] = jungle_plants[math.random(1,#jungle_plants)]
|
||||
end
|
||||
|
||||
if c_fireflies and math.random() < 0.01 then
|
||||
local firefly_vi = vi + ystride * math.random(1, 5)
|
||||
if data[firefly_vi] == c_air then
|
||||
data[firefly_vi] = c_fireflies
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local jungle_cavern_ceiling = function(abs_cracks, vi, area, data, data_param2)
|
||||
@ -222,6 +234,13 @@ local jungle_warren_floor = function(abs_cracks, vi, area, data, data_param2)
|
||||
elseif abs_cracks < 1 then
|
||||
data[vi] = c_dirt
|
||||
end
|
||||
|
||||
if c_fireflies and math.random() < 0.005 then
|
||||
local firefly_vi = vi + ystride * math.random(1, 5)
|
||||
if data[firefly_vi] == c_air then
|
||||
data[firefly_vi] = c_fireflies
|
||||
end
|
||||
end
|
||||
end
|
||||
---------------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -322,7 +341,7 @@ local decorate_primordial = function(minp, maxp, seed, vm, node_arrays, area, da
|
||||
local jungle = nvals_cave[vi] < 0
|
||||
if jungle then
|
||||
data[vi] = c_plant_matter
|
||||
minetest.get_node_timer(area:position(vi)):start(math.random(10, 60))
|
||||
minetest.get_node_timer(area:position(vi)):start(math.random(30, 120))
|
||||
else
|
||||
data[vi] = c_mycelial_dirt
|
||||
if math.random() < 0.025 then
|
||||
|
@ -235,6 +235,9 @@ df_caverns.is_ground_content = function(c_node)
|
||||
end
|
||||
dfcaverns_nodes[minetest.get_content_id("default:ice")] = true -- needed for nethercap cavern water covering
|
||||
dfcaverns_nodes[minetest.get_content_id("oil:oil_source")] = true -- needed for blackcap oil slicks
|
||||
if minetest.get_modpath("fireflies") then
|
||||
dfcaverns_nodes[minetest.get_content_id("fireflies:firefly")] = true -- used in the primordial caverns
|
||||
end
|
||||
dfcaverns_mods = nil
|
||||
return not dfcaverns_nodes[c_node]
|
||||
end
|
@ -283,7 +283,14 @@ minetest.register_node("df_primordial_items:plant_matter", {
|
||||
paramtype = "light",
|
||||
groups = {crumbly = 3, soil = 1},
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
on_timer = function(pos)
|
||||
on_timer = function(pos, elapsed)
|
||||
if elapsed > 130 then
|
||||
-- the timer triggered more than ten seconds after it was suppposed to,
|
||||
-- it may have been in an unloaded block. Rather than have all the timers
|
||||
-- go off at once now that the block's loaded, stagger them out again.
|
||||
minetest.get_node_timer(pos):start(math.random(10, 120))
|
||||
return
|
||||
end
|
||||
if minetest.find_node_near(pos, 1, {"air"}) == nil then
|
||||
minetest.set_node(pos, {name="df_primordial_items:packed_roots"})
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user