diff --git a/config.lua b/config.lua index 31d3483..b444f0e 100644 --- a/config.lua +++ b/config.lua @@ -42,6 +42,8 @@ local plants = { {name="sweet_pod", delay_multiplier=2}, } +--Trees + setting("int", "tree_min_growth_delay", 2400, "Minimum sapling growth delay") setting("int", "tree_max_growth_delay", 4800, "Maximum sapling growth delay") @@ -52,14 +54,19 @@ end setting("int", "blood_thorn_growth_interval", 12, "blood_thorn growth ABM interval") setting("int", "blood_thorn_growth_chance", 83, "blood_thorn growth ABM chance") +--Plants + setting("int", "plant_growth_time", 500, "Base plant growth time") for _, plant in pairs(plants) do setting("float", plant.name.."_delay_multiplier", plant.delay_multiplier, plant.name.." growth delay multiplier") end +setting("float", "glow_worm_delay_multiplier", 10.0, "glow worm growth delay multiplier") setting("bool", "light_kills_fungus", true, "Light kills fungus") +--Caverns + setting("float", "vertical_cavern_scale", 256, "Vertical cavern dimension scale") setting("float", "horizontal_cavern_scale", 256, "Horizontal cavern dimension scale") diff --git a/glow_worms.lua b/glow_worms.lua index 3440436..cef40b9 100644 --- a/glow_worms.lua +++ b/glow_worms.lua @@ -8,17 +8,32 @@ minetest.register_node("dfcaverns:glow_worm", { inventory_image = "dfcaverns_glow_worm.png", wield_image = "dfcaverns_glow_worm.png", is_ground_content = true, - groups = {oddly_breakable_by_hand=3}, + groups = {oddly_breakable_by_hand=3, light_sensitive_fungus = 12}, + _dfcaverns_dead_node = "air", light_source = 9, paramtype = "light", drawtype = "plantlike", walkable = false, buildable_to = true, visual_scale = 1.0, - selection_box = { - type = "fixed", - fixed = {-0.5, -0.5, -0.5, 0.5, -0.5, 0.5}, - }, + after_place_node = function(pos, placer) + if dfcaverns.config.glow_worm_delay_multiplier > 0 then + minetest.get_node_timer(pos):start(math.random( + dfcaverns.config.glow_worm_delay_multiplier * dfcaverns.config.plant_growth_time * 0.75, + dfcaverns.config.glow_worm_delay_multiplier * dfcaverns.config.plant_growth_time * 1.25)) + end + end, + on_timer = function(pos, elapsed) + local below = {x=pos.x, y=pos.y-1, z=pos.z} + if minetest.get_node(below).name == "air" then + minetest.set_node(below, {name="dfcaverns:glow_worm"}) + if math.random() > 0.5 then + minetest.get_node_timer(below):start(math.random( + dfcaverns.config.glow_worm_delay_multiplier * dfcaverns.config.plant_growth_time * 0.75, + dfcaverns.config.glow_worm_delay_multiplier * dfcaverns.config.plant_growth_time * 1.25)) + end + end + end, }) local c_air = minetest.get_content_id("air") @@ -55,4 +70,5 @@ minetest.register_abm({ action = function (pos) minetest.set_node(pos, {name="air"}) end, -}) \ No newline at end of file +}) + diff --git a/settingtypes.txt b/settingtypes.txt index 27b6893..2b985d3 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -12,13 +12,15 @@ dfcaverns_blood_thorn_growth_interval (blood_thorn growth ABM interval) int 12 dfcaverns_blood_thorn_growth_chance (blood_thorn growth ABM chance) int 83 [Plant growth] -dfcaverns_plant_growth_timer (Base plant growth timer interval) int 100 +dfcaverns_plant_growth_time (Base plant growth timer interval) int 100 dfcaverns_cave_wheat_delay_multiplier (cave_wheat growth delay multiplier) float 1 dfcaverns_dimple_cup_delay_multiplier (dimple_cup growth delay multiplier) float 3 dfcaverns_pig_tail_delay_multiplier (pig_tail growth delay multiplier) float 1 dfcaverns_plump_helmet_delay_multiplier (plump_helmet growth delay multiplier) float 3 dfcaverns_quarry_bush_delay_multiplier (quarry_bush growth delay multiplier) float 2 dfcaverns_sweet_pod_delay_multiplier (sweet_pod growth delay multiplier) float 2 +#To disable glow worm growth, set this to 0. +dfcaverns_glow_worm_delay_multiplier (glow worm growth delay multiplier) float 10 dfcaverns_light_kills_fungus (Light kills fungus) bool true [Cavern dimensions]