Update 'mods/ethereal/dirt.lua'
This commit is contained in:
parent
7d1e369bf6
commit
ad9ea5d1ee
|
@ -74,98 +74,8 @@ for n = 1, #dirts do
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- grow reeds up to 4 high and bamboo up to 8 high
|
||||||
-- flower spread, also crystal and fire flower regeneration
|
local grow_reeds = function(pos, node)
|
||||||
local flower_spread = function(pos, node)
|
|
||||||
|
|
||||||
if (minetest.get_node_light(pos) or 0) < 13 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local pos0 = {x = pos.x - 4, y = pos.y - 2, z = pos.z - 4}
|
|
||||||
local pos1 = {x = pos.x + 4, y = pos.y + 2, z = pos.z + 4}
|
|
||||||
|
|
||||||
local num = #minetest.find_nodes_in_area(pos0, pos1, "group:flora")
|
|
||||||
|
|
||||||
-- stop flowers spreading too much just below top of map block
|
|
||||||
if minetest.find_node_near(pos, 2, "ignore") then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if num > 3
|
|
||||||
and node.name == "ethereal:crystalgrass" then
|
|
||||||
|
|
||||||
local grass = minetest.find_nodes_in_area_under_air(
|
|
||||||
pos0, pos1, {"ethereal:crystalgrass"})
|
|
||||||
|
|
||||||
if #grass > 4
|
|
||||||
and not minetest.find_node_near(pos, 4, {"ethereal:crystal_spike"}) then
|
|
||||||
|
|
||||||
pos = grass[math.random(#grass)]
|
|
||||||
|
|
||||||
pos.y = pos.y - 1
|
|
||||||
|
|
||||||
if minetest.get_node(pos).name == "ethereal:crystal_dirt" then
|
|
||||||
|
|
||||||
pos.y = pos.y + 1
|
|
||||||
|
|
||||||
minetest.swap_node(pos, {name = "ethereal:crystal_spike"})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
elseif num > 3
|
|
||||||
and node.name == "ethereal:dry_shrub" then
|
|
||||||
|
|
||||||
local grass = minetest.find_nodes_in_area_under_air(
|
|
||||||
pos0, pos1, {"ethereal:dry_shrub"})
|
|
||||||
|
|
||||||
if #grass > 8
|
|
||||||
and not minetest.find_node_near(pos, 4, {"ethereal:fire_flower"}) then
|
|
||||||
|
|
||||||
pos = grass[math.random(#grass)]
|
|
||||||
|
|
||||||
pos.y = pos.y - 1
|
|
||||||
|
|
||||||
if minetest.get_node(pos).name == "ethereal:fiery_dirt" then
|
|
||||||
|
|
||||||
pos.y = pos.y + 1
|
|
||||||
|
|
||||||
minetest.swap_node(pos, {name = "ethereal:fire_flower"})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
elseif num > 3 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local seedling = minetest.find_nodes_in_area_under_air(
|
|
||||||
pos0, pos1, {"group:soil"})
|
|
||||||
|
|
||||||
if #seedling > 0 then
|
|
||||||
|
|
||||||
pos = seedling[math.random(#seedling)]
|
|
||||||
|
|
||||||
-- default farming has desert sand as soil, so dont spread on this
|
|
||||||
if minetest.get_node(pos).name == "default:desert_sand" then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
pos.y = pos.y + 1
|
|
||||||
|
|
||||||
if (minetest.get_node_light(pos) or 0) < 13 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.swap_node(pos, {name = node.name})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- grow papyrus up to 4 high and bamboo up to 8 high
|
|
||||||
local grow_papyrus = function(pos, node)
|
|
||||||
|
|
||||||
local oripos = pos.y
|
local oripos = pos.y
|
||||||
local high = 4
|
local high = 4
|
||||||
|
@ -228,15 +138,15 @@ for _, ab in pairs(minetest.registered_abms) do
|
||||||
ab.neighbors = {"group:soil"}
|
ab.neighbors = {"group:soil"}
|
||||||
ab.action = flower_spread
|
ab.action = flower_spread
|
||||||
|
|
||||||
-- find grow papyrus abm and change to grow_papyrus function
|
-- find grow reeds abm and change to grow_papyrus function
|
||||||
elseif label == "Grow papyrus"
|
elseif label == "Grow reeds"
|
||||||
or node1 == "default:papyrus" then
|
or node1 == "default:reeds" then
|
||||||
|
|
||||||
--ab.interval = 2
|
--ab.interval = 2
|
||||||
--ab.chance = 1
|
--ab.chance = 1
|
||||||
ab.nodenames = {"default:papyrus", "ethereal:bamboo"}
|
ab.nodenames = {"default:reeds", "ethereal:bamboo"}
|
||||||
ab.neighbors = {"group:soil"}
|
ab.neighbors = {"group:soil"}
|
||||||
ab.action = grow_papyrus
|
ab.action = grow_reeds
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -301,4 +211,4 @@ minetest.register_craft({
|
||||||
replacements = {
|
replacements = {
|
||||||
{"bucket:bucket_water", "bucket:bucket_empty"}
|
{"bucket:bucket_water", "bucket:bucket_empty"}
|
||||||
}
|
}
|
||||||
})
|
})
|
Loading…
Reference in New Issue