make glow worms slowly grow when placed by player, and die in bright light

This commit is contained in:
FaceDeer 2017-09-05 19:34:14 -06:00
parent 6afaaf6173
commit 225023298a
3 changed files with 32 additions and 7 deletions

View File

@ -42,6 +42,8 @@ local plants = {
{name="sweet_pod", delay_multiplier=2}, {name="sweet_pod", delay_multiplier=2},
} }
--Trees
setting("int", "tree_min_growth_delay", 2400, "Minimum sapling growth delay") setting("int", "tree_min_growth_delay", 2400, "Minimum sapling growth delay")
setting("int", "tree_max_growth_delay", 4800, "Maximum 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_interval", 12, "blood_thorn growth ABM interval")
setting("int", "blood_thorn_growth_chance", 83, "blood_thorn growth ABM chance") setting("int", "blood_thorn_growth_chance", 83, "blood_thorn growth ABM chance")
--Plants
setting("int", "plant_growth_time", 500, "Base plant growth time") setting("int", "plant_growth_time", 500, "Base plant growth time")
for _, plant in pairs(plants) do for _, plant in pairs(plants) do
setting("float", plant.name.."_delay_multiplier", plant.delay_multiplier, plant.name.." growth delay multiplier") setting("float", plant.name.."_delay_multiplier", plant.delay_multiplier, plant.name.." growth delay multiplier")
end end
setting("float", "glow_worm_delay_multiplier", 10.0, "glow worm growth delay multiplier")
setting("bool", "light_kills_fungus", true, "Light kills fungus") setting("bool", "light_kills_fungus", true, "Light kills fungus")
--Caverns
setting("float", "vertical_cavern_scale", 256, "Vertical cavern dimension scale") setting("float", "vertical_cavern_scale", 256, "Vertical cavern dimension scale")
setting("float", "horizontal_cavern_scale", 256, "Horizontal cavern dimension scale") setting("float", "horizontal_cavern_scale", 256, "Horizontal cavern dimension scale")

View File

@ -8,17 +8,32 @@ minetest.register_node("dfcaverns:glow_worm", {
inventory_image = "dfcaverns_glow_worm.png", inventory_image = "dfcaverns_glow_worm.png",
wield_image = "dfcaverns_glow_worm.png", wield_image = "dfcaverns_glow_worm.png",
is_ground_content = true, 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, light_source = 9,
paramtype = "light", paramtype = "light",
drawtype = "plantlike", drawtype = "plantlike",
walkable = false, walkable = false,
buildable_to = true, buildable_to = true,
visual_scale = 1.0, visual_scale = 1.0,
selection_box = { after_place_node = function(pos, placer)
type = "fixed", if dfcaverns.config.glow_worm_delay_multiplier > 0 then
fixed = {-0.5, -0.5, -0.5, 0.5, -0.5, 0.5}, 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") local c_air = minetest.get_content_id("air")
@ -56,3 +71,4 @@ minetest.register_abm({
minetest.set_node(pos, {name="air"}) minetest.set_node(pos, {name="air"})
end, end,
}) })

View File

@ -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 dfcaverns_blood_thorn_growth_chance (blood_thorn growth ABM chance) int 83
[Plant growth] [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_cave_wheat_delay_multiplier (cave_wheat growth delay multiplier) float 1
dfcaverns_dimple_cup_delay_multiplier (dimple_cup growth delay multiplier) float 3 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_pig_tail_delay_multiplier (pig_tail growth delay multiplier) float 1
dfcaverns_plump_helmet_delay_multiplier (plump_helmet growth delay multiplier) float 3 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_quarry_bush_delay_multiplier (quarry_bush growth delay multiplier) float 2
dfcaverns_sweet_pod_delay_multiplier (sweet_pod 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 dfcaverns_light_kills_fungus (Light kills fungus) bool true
[Cavern dimensions] [Cavern dimensions]