mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-26 04:21:07 +01:00
make townaura more preformant
This commit is contained in:
parent
28f952309e
commit
c288b6ab93
1 changed files with 27 additions and 15 deletions
|
@ -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"))
|
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
|
--if minetest.settings:get("mcl_node_particles") == "full" then
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
label = "Townaura particles",
|
label = "Townaura particles",
|
||||||
nodenames = {"group:mycelium"},
|
nodenames = {"group:mycelium"},
|
||||||
interval = 0.1,
|
interval = 2,
|
||||||
chance = 30,
|
chance = 30,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
local apos = {x=pos.x, y=pos.y+0.51, z=pos.z}
|
local player_near = false
|
||||||
local vel = { x = math.random(-3, 3)/10, y = math.random(0, 10)/60, z = math.random(-3, 3)/10 }
|
for _,player in pairs(minetest.get_connected_players()) do
|
||||||
local acc = { x = 0, y = 0, z = 0 }
|
if vector.distance(player:get_pos(), pos) < PARTICLE_ABM_DISTANCE then
|
||||||
minetest.add_particle({
|
player_near = true
|
||||||
pos = apos,
|
end
|
||||||
velocity = vel,
|
end
|
||||||
acceleration = acc,
|
if player_near then
|
||||||
expirationtime = 4,
|
local apos = {x=pos.x-2, y=pos.y+0.51, z=pos.z-2}
|
||||||
collisiondetection = true,
|
local apos2 = {x=pos.x+2, y=pos.y+0.51, z=pos.z+2}
|
||||||
collision_removal = true,
|
local acc = { x = 0, y = 0, z = 0 }
|
||||||
size = 1,
|
minetest.add_particlespawner({
|
||||||
texture = "mcl_core_mycelium_particle.png",
|
time = 2,
|
||||||
glow = LIGHT_LAVA,
|
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,
|
||||||
})
|
})
|
||||||
--end
|
--end
|
||||||
|
|
Loading…
Reference in a new issue