From 6f3691da5e312c29e845175f5ec9f260285c83cb Mon Sep 17 00:00:00 2001 From: cora Date: Mon, 7 Aug 2023 16:51:25 +0200 Subject: [PATCH] Add spore blossom particles --- mods/ITEMS/mcl_lush_caves/init.lua | 38 +++++++++++++++++++++++++++++ mods/ITEMS/mcl_lush_caves/nodes.lua | 2 +- mods/MAPGEN/mcl_biomes/init.lua | 2 +- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_lush_caves/init.lua b/mods/ITEMS/mcl_lush_caves/init.lua index ec821b3d6..243a8bbd5 100644 --- a/mods/ITEMS/mcl_lush_caves/init.lua +++ b/mods/ITEMS/mcl_lush_caves/init.lua @@ -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) diff --git a/mods/ITEMS/mcl_lush_caves/nodes.lua b/mods/ITEMS/mcl_lush_caves/nodes.lua index cbc4a99f2..981ab97f2 100644 --- a/mods/ITEMS/mcl_lush_caves/nodes.lua +++ b/mods/ITEMS/mcl_lush_caves/nodes.lua @@ -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, diff --git a/mods/MAPGEN/mcl_biomes/init.lua b/mods/MAPGEN/mcl_biomes/init.lua index 0a9cbc7f5..5eac79e1d 100644 --- a/mods/MAPGEN/mcl_biomes/init.lua +++ b/mods/MAPGEN/mcl_biomes/init.lua @@ -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,