Add spore blossom particles

This commit is contained in:
cora 2023-08-07 16:51:25 +02:00 committed by the-real-herowl
parent 5327bdfda9
commit 6f3691da5e
3 changed files with 40 additions and 2 deletions

View file

@ -2,6 +2,8 @@ mcl_lush_caves = {}
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
local PARTICLE_DISTANCE = 25
local adjacents = {
vector.new(1,0,0),
vector.new(-1,0,0),
@ -20,6 +22,42 @@ end
dofile(modpath.."/nodes.lua")
dofile(modpath.."/dripleaf.lua")
local spore_blossom_particlespawner = {
texture = "mcl_lush_caves_spore_blossom_particle.png",
amount = 32,
time = 25,
minvel = vector.zero(),
maxvel = vector.zero(),
minacc = vector.new(-0.2, -0.1, -0.2),
maxacc = vector.new(0.2, -0.3, 0.2),
minexptime = 1.5,
maxexptime = 8.5,
minsize = 0.1,
maxsize= 0.4,
glow = 4,
collisiondetection = true,
collision_removal = true,
}
minetest.register_abm({
label = "Spore Blossom Particles",
nodenames = {"mcl_lush_caves:spore_blossom"},
interval = 25,
chance = 10,
action = function(pos, node)
if minetest.get_node(vector.offset(pos, 0, -1, 0)).name ~= "air" then return end
for _,pl in pairs(minetest.get_connected_players()) do
if vector.distance(pos,pl:get_pos()) < PARTICLE_DISTANCE then
minetest.add_particlespawner(table.merge(spore_blossom_particlespawner, {
minpos = vector.offset(pos, -0.25, -0.5, -0.25),
maxpos = vector.offset(pos, 0.25, -0.5, 0.25),
playername = pl:get_player_name(),
}))
end
end
end
})
function mcl_lush_caves.makelake(pos,def,pr)
local p1 = vector.offset(pos,-8,-4,-8)
local p2 = vector.offset(pos,8,4,8)

View file

@ -241,7 +241,7 @@ minetest.register_node("mcl_lush_caves:spore_blossom", {
sounds = mcl_sounds.node_sound_dirt_defaults(),
selection_box = {
type = "fixed",
fixed = {{ -3/16, -8/16, -3/16, 3/16, 1/16, 3/16 }},
fixed = {{ -3/16, -2/16, -3/16, 3/16, 8/16, 3/16 }},
},
_mcl_blast_resistance = 0.5,
_mcl_hardness = 0.5,

View file

@ -3610,7 +3610,7 @@ local function register_decorations()
place_on = {"mcl_lush_caves:moss"},
spawn_by = {"air"},
num_spawn_by = 4,
fill_ratio = 0.1,
fill_ratio = 0.8,
param2 = 4,
flags = "all_ceilings",
biomes = lushcaves_underground,