From 28f952309e7bf4dfe3d399e3c95986f3a8ff2145 Mon Sep 17 00:00:00 2001 From: epCode <64379263+epCode@users.noreply.github.com> Date: Sun, 13 Nov 2022 13:41:28 -0800 Subject: [PATCH 1/2] add mycelium townaura particles --- mods/ITEMS/mcl_core/nodes_base.lua | 28 +++++++++++++++++- .../textures/mcl_core_mycelium_particle.png | Bin 0 -> 1283 bytes 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 mods/ITEMS/mcl_core/textures/mcl_core_mycelium_particle.png diff --git a/mods/ITEMS/mcl_core/nodes_base.lua b/mods/ITEMS/mcl_core/nodes_base.lua index c99e306ad..27f879d5e 100644 --- a/mods/ITEMS/mcl_core/nodes_base.lua +++ b/mods/ITEMS/mcl_core/nodes_base.lua @@ -434,7 +434,7 @@ minetest.register_node("mcl_core:mycelium", { tiles = {"mcl_core_mycelium_top.png", "default_dirt.png", {name="mcl_core_mycelium_side.png", tileable_vertical=false}}, is_ground_content = true, stack_max = 64, - groups = { handy = 1, shovely = 1, dirt = 2, spreading_dirt_type = 1, enderman_takable = 1, building_block = 1, soil_sapling = 2, path_creation_possible=1}, + groups = { handy = 1, shovely = 1, dirt = 2, spreading_dirt_type = 1, enderman_takable = 1, building_block = 1, soil_sapling = 2, path_creation_possible=1, mycelium=1}, drop = "mcl_core:dirt", sounds = mcl_sounds.node_sound_dirt_defaults({ footstep = {name="default_grass_footstep", gain=0.1}, @@ -448,6 +448,32 @@ minetest.register_node("mcl_core:mycelium", { }) mcl_core.register_snowed_node("mcl_core:mycelium_snow", "mcl_core:mycelium", nil, nil, false, S("Mycelium with Snow")) + +--if minetest.settings:get("mcl_node_particles") == "full" then +minetest.register_abm({ + label = "Townaura particles", + nodenames = {"group:mycelium"}, + interval = 0.1, + chance = 30, + action = function(pos, node) + local apos = {x=pos.x, y=pos.y+0.51, z=pos.z} + local vel = { x = math.random(-3, 3)/10, y = math.random(0, 10)/60, z = math.random(-3, 3)/10 } + local acc = { x = 0, y = 0, z = 0 } + minetest.add_particle({ + pos = apos, + velocity = vel, + acceleration = acc, + expirationtime = 4, + collisiondetection = true, + collision_removal = true, + size = 1, + texture = "mcl_core_mycelium_particle.png", + glow = LIGHT_LAVA, + }) + end, +}) +--end + minetest.register_node("mcl_core:podzol", { description = S("Podzol"), _doc_items_longdesc = S("Podzol is a type of dirt found in taiga forests. Only a few plants are able to survive on it."), diff --git a/mods/ITEMS/mcl_core/textures/mcl_core_mycelium_particle.png b/mods/ITEMS/mcl_core/textures/mcl_core_mycelium_particle.png new file mode 100644 index 0000000000000000000000000000000000000000..abf43e33a69e25ec6fb8f3b4d30a3bbd490992b9 GIT binary patch literal 1283 zcmV+e1^oJnP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+U=KLw&NxY#@|^*mw+UM#Bwly&Y2x_`Tf9-?@jJZ zJ2UM=A7YMy2>eOb4@eTmpWkNq0~eLdA*p#TIY(Tnq{0;)kLOi(O)>5Iy!dMA*&glz zhDp%M`O)e%zrwB`4?KL(@oW!%jj&%rFP>$2Uj6<#NZ9$bQ@Vu8I6JwxeGc`wgxWQ6 zhjQKN4(n{z=kR1OWT`703G)z=xNAQnkae?ESZLRbc_amW6%S}w9%4wy)9XFj7(XZI zIr&#Fyk`IIy(FLOWtW#+<_ER>{Q=S!yWDR0vtzj<;^zUAht$_3&)I#>alTzm85zyj zirUGhhYThjNV)9CGK%3=^lg`d;<3gCQrgc*lnYR5EBnJw9JiV z+gywbH(8w0Dm2+ZtcwFy;}Jw)<~tVJe#`dP$l6 zxk6mL)-}Rdr?=%j=Mf*`OvzxmY zuZ4@?4Ahc~6)&aK%Avwhg;vG<3d_NV9O=*_A9narj@qz%T58&Iv*xX|+PO=|G0}6k z?!ELnC=8qwBMlvS*zi$ComgvAW|}(lwCS_VdQ-coeks2|jV@}uNv(NyQ-d{_JtSxy zC%Tw{7$*X8TLjh#wwOhylz5R_%wl0|3S|VTi%saXhyh_5#5(C__d)KbxCQl};>Q0( zE-ZBa1-SrpU%7pUT3_FDZ4*0p;mTEX>4Tx0C=2zkv&Mm zKpe$iQ$^7h2Rn#3WT;LSL`8JdDionYs1;guFuC*#nlvOSE{=k0!NHHks)LKOt`4q( zAou~|=;Wm6A|?JWDYS_3;J6>}?mh0_0YbgZG^=9_&~)2OCE{WxyDE0Qq8DKVF@uoI zEMrcRlJFg0_XzOyF2=L`&;2>VYR+OnKqQ`JhG`RT5KnE|2Iqa^2rJ4e@j3CRNf#u3 zC`-Ngjg)JvC_t@Xllfh#8Fk#DPPEVta9Gstd*;*c~AbrP)=W2 z<~q$GB(R7jND!f*iW17O5u;Tn#X^eq<39dD*DsMvAy)~E91EyGgY5dj|KNAGR(@jK zOA5t-&KJk|7zVm_fkw@7zKZ37qAElt@2E_Z-| zCqp)6R|?V;@_FF>jJ_!g^xpzKYhG{7eVjf3Y3eF@0~{OzBL&J{_jz}BdvE`qY4-O6 zUomo@1=YGG00009a7bBm000XU000XU0RWnu7ytkO2XskIMF-{!4FftA!$Chd0000M tNkl Date: Sun, 13 Nov 2022 14:22:00 -0800 Subject: [PATCH 2/2] make townaura more preformant --- mods/ITEMS/mcl_core/nodes_base.lua | 42 +++++++++++++++++++----------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/mods/ITEMS/mcl_core/nodes_base.lua b/mods/ITEMS/mcl_core/nodes_base.lua index 27f879d5e..5474142d3 100644 --- a/mods/ITEMS/mcl_core/nodes_base.lua +++ b/mods/ITEMS/mcl_core/nodes_base.lua @@ -448,28 +448,40 @@ minetest.register_node("mcl_core:mycelium", { }) mcl_core.register_snowed_node("mcl_core:mycelium_snow", "mcl_core:mycelium", nil, nil, false, S("Mycelium with Snow")) +local PARTICLE_ABM_DISTANCE = 16 --if minetest.settings:get("mcl_node_particles") == "full" then minetest.register_abm({ label = "Townaura particles", nodenames = {"group:mycelium"}, - interval = 0.1, + interval = 2, chance = 30, action = function(pos, node) - local apos = {x=pos.x, y=pos.y+0.51, z=pos.z} - local vel = { x = math.random(-3, 3)/10, y = math.random(0, 10)/60, z = math.random(-3, 3)/10 } - local acc = { x = 0, y = 0, z = 0 } - minetest.add_particle({ - pos = apos, - velocity = vel, - acceleration = acc, - expirationtime = 4, - collisiondetection = true, - collision_removal = true, - size = 1, - texture = "mcl_core_mycelium_particle.png", - glow = LIGHT_LAVA, - }) + local player_near = false + for _,player in pairs(minetest.get_connected_players()) do + if vector.distance(player:get_pos(), pos) < PARTICLE_ABM_DISTANCE then + player_near = true + end + end + if player_near then + local apos = {x=pos.x-2, y=pos.y+0.51, z=pos.z-2} + local apos2 = {x=pos.x+2, y=pos.y+0.51, z=pos.z+2} + local acc = { x = 0, y = 0, z = 0 } + minetest.add_particlespawner({ + time = 2, + amount = 5, + minpos = apos, + maxpos = apos2, + minvel = vector.new(-3/10, 0, -3/10), + maxvel = vector.new(3/10, 10/60, 3/10), + minacc = acc, + expirationtime = 4, + collisiondetection = true, + collision_removal = true, + size = 1, + texture = "mcl_core_mycelium_particle.png", + }) + end end, }) --end