mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-03-15 04:11:24 +00:00
Set blend = "clip" on spawned particles
This commit is contained in:
parent
692ac2d062
commit
5a4818a402
2 changed files with 39 additions and 21 deletions
|
@ -9,6 +9,28 @@ if not builtin_item or type(builtin_item.set_item) ~= "function" or type(builtin
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local smoke_particles = {
|
||||||
|
amount = 3,
|
||||||
|
time = 0.1,
|
||||||
|
minpos = vector.new(-0.1, -0.1, -0.1),
|
||||||
|
maxpos = vector.new(0.1, 0.1, 0.1),
|
||||||
|
minvel = vector.new(0, 2.5, 0),
|
||||||
|
maxvel = vector.new(0, 2.5, 0),
|
||||||
|
minacc = vector.new(-0.15, -0.02, -0.15),
|
||||||
|
maxacc = vector.new(0.15, -0.01, 0.15),
|
||||||
|
minexptime = 4,
|
||||||
|
maxexptime = 6,
|
||||||
|
minsize = 5,
|
||||||
|
maxsize = 5,
|
||||||
|
collisiondetection = true,
|
||||||
|
texture = {
|
||||||
|
name = "default_item_smoke.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if minetest.features.particle_blend_clip then
|
||||||
|
smoke_particles.texture.blend = "clip"
|
||||||
|
end
|
||||||
|
|
||||||
local item = {
|
local item = {
|
||||||
set_item = function(self, itemstring, ...)
|
set_item = function(self, itemstring, ...)
|
||||||
builtin_item.set_item(self, itemstring, ...)
|
builtin_item.set_item(self, itemstring, ...)
|
||||||
|
@ -29,22 +51,10 @@ local item = {
|
||||||
gain = 1.0,
|
gain = 1.0,
|
||||||
max_hear_distance = 8,
|
max_hear_distance = 8,
|
||||||
}, true)
|
}, true)
|
||||||
minetest.add_particlespawner({
|
local ps = table.copy(smoke_particles)
|
||||||
amount = 3,
|
ps.minpos = vector.add(ps.minpos, p)
|
||||||
time = 0.1,
|
ps.maxpos = vector.add(ps.maxpos, p)
|
||||||
minpos = {x = p.x - 0.1, y = p.y + 0.1, z = p.z - 0.1 },
|
minetest.add_particlespawner(ps)
|
||||||
maxpos = {x = p.x + 0.1, y = p.y + 0.2, z = p.z + 0.1 },
|
|
||||||
minvel = {x = 0, y = 2.5, z = 0},
|
|
||||||
maxvel = {x = 0, y = 2.5, z = 0},
|
|
||||||
minacc = {x = -0.15, y = -0.02, z = -0.15},
|
|
||||||
maxacc = {x = 0.15, y = -0.01, z = 0.15},
|
|
||||||
minexptime = 4,
|
|
||||||
maxexptime = 6,
|
|
||||||
minsize = 5,
|
|
||||||
maxsize = 5,
|
|
||||||
collisiondetection = true,
|
|
||||||
texture = "default_item_smoke.png"
|
|
||||||
})
|
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_step = function(self, dtime, ...)
|
on_step = function(self, dtime, ...)
|
||||||
|
|
|
@ -27,6 +27,14 @@ minetest.register_on_mods_loaded(function()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
local function particle_texture(name)
|
||||||
|
local ret = {name = name}
|
||||||
|
if minetest.features.particle_blend_clip then
|
||||||
|
ret.blend = "clip"
|
||||||
|
end
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
local function rand_pos(center, pos, radius)
|
local function rand_pos(center, pos, radius)
|
||||||
local def
|
local def
|
||||||
local reg_nodes = minetest.registered_nodes
|
local reg_nodes = minetest.registered_nodes
|
||||||
|
@ -211,7 +219,7 @@ local function add_effects(pos, radius, drops)
|
||||||
size = radius * 10,
|
size = radius * 10,
|
||||||
collisiondetection = false,
|
collisiondetection = false,
|
||||||
vertical = false,
|
vertical = false,
|
||||||
texture = "tnt_boom.png",
|
texture = particle_texture("tnt_boom.png"),
|
||||||
glow = 15,
|
glow = 15,
|
||||||
})
|
})
|
||||||
minetest.add_particlespawner({
|
minetest.add_particlespawner({
|
||||||
|
@ -227,12 +235,12 @@ local function add_effects(pos, radius, drops)
|
||||||
maxexptime = 2.5,
|
maxexptime = 2.5,
|
||||||
minsize = radius * 3,
|
minsize = radius * 3,
|
||||||
maxsize = radius * 5,
|
maxsize = radius * 5,
|
||||||
texture = "tnt_smoke.png",
|
texture = particle_texture("tnt_smoke.png"),
|
||||||
})
|
})
|
||||||
|
|
||||||
-- we just dropped some items. Look at the items entities and pick
|
-- we just dropped some items. Look at the items and pick
|
||||||
-- one of them to use as texture
|
-- one of them to use as texture.
|
||||||
local texture = "tnt_blast.png" --fallback texture
|
local texture = "tnt_blast.png" -- fallback
|
||||||
local node
|
local node
|
||||||
local most = 0
|
local most = 0
|
||||||
for name, stack in pairs(drops) do
|
for name, stack in pairs(drops) do
|
||||||
|
|
Loading…
Add table
Reference in a new issue