use underground decoration for illumishrooms

This commit is contained in:
tenplus1 2024-08-06 16:24:52 +01:00
parent 32affd255e
commit 9082c7181e
3 changed files with 22 additions and 44 deletions

View File

@ -97,6 +97,11 @@ several examples are at the documentation of [api.txt](api.txt) file.
A huge thanks to Chinchow who was the inspiration behind Ethereal and everyone
who helped make this mod bigger and better throughout it's release :)
### 1.32
- Add {eatable} groups to food items
- Use underground decoration placement for illumishrooms to improve performance
- Use worldalign textures for stairs
### 1.31
- Fix fishing biome checks
- Increase bamboo leaf decay radius

View File

@ -757,9 +757,21 @@ if minetest.registered_nodes["default:coral_green"] then
end
-- register async mapgen script
if minetest.register_mapgen_script then
minetest.register_mapgen_script(minetest.get_modpath("ethereal") .. "/decor_on_generated.lua")
else
dofile(minetest.get_modpath("ethereal") .. "/decor_on_generated.lua")
-- illumishrooms using underground decoration placement
local function add_illumishroom(low, high, nodename)
minetest.register_decoration({
deco_type = "simple",
place_on = {"default:stone_with_coal"},
sidelen = 16,
fill_ratio = 0.5,
y_max = high,
y_min = low,
flags = "force_placement, all_floors",
decoration = nodename
})
end
add_illumishroom(-1000, -30, "ethereal:illumishroom")
add_illumishroom(-2000, -1000, "ethereal:illumishroom2")
add_illumishroom(-3000, -2000, "ethereal:illumishroom3")

View File

@ -1,39 +0,0 @@
local random = math.random
-- Generate Illumishroom in caves on top of coal
local function generate(minp, maxp)
if minp.y > -30 or maxp.y < -3000 then
return
end
local coal = minetest.find_nodes_in_area_under_air(
minp, maxp, "default:stone_with_coal")
for n = 1, #coal do
if random(2) == 1 then
local bpos = {x = coal[n].x, y = coal[n].y + 1, z = coal[n].z}
if bpos.y > -3000 and bpos.y < -2000 then
minetest.set_node(bpos, {name = "ethereal:illumishroom3"})
elseif bpos.y > -2000 and bpos.y < -1000 then
minetest.set_node(bpos, {name = "ethereal:illumishroom2"})
elseif bpos.y > -1000 and bpos.y < -30 then
minetest.set_node(bpos, {name = "ethereal:illumishroom"})
end
end
end
end
if minetest.save_gen_notify then -- async env (5.9+)
minetest.register_on_generated(function(vmanip, minp, maxp, blockseed)
generate(minp, maxp)
end)
else -- main thread (5.8 and earlier)
minetest.register_on_generated(function(minp, maxp, blockseed)
generate(minp, maxp)
end)
end