mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add particle blend mode "clip" (#15444)
This lets modders avoid alpha blending rendering bugs as well as potential (future) performance issues. The appropriate blend modes are also used for node dig particles. --------- Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
parent
f493e73aeb
commit
138052adfc
11 changed files with 93 additions and 33 deletions
|
@ -1,14 +1,27 @@
|
|||
local function spawn_clip_test_particle(pos)
|
||||
core.add_particle({
|
||||
pos = pos,
|
||||
size = 5,
|
||||
expirationtime = 10,
|
||||
texture = {
|
||||
name = "testtools_particle_clip.png",
|
||||
blend = "clip",
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
core.register_tool("testtools:particle_spawner", {
|
||||
description = "Particle Spawner".."\n"..
|
||||
description = table.concat({
|
||||
"Particle Spawner",
|
||||
"Punch: Spawn random test particle",
|
||||
"Place: Spawn clip test particle",
|
||||
}, "\n"),
|
||||
inventory_image = "testtools_particle_spawner.png",
|
||||
groups = { testtool = 1, disable_repair = 1 },
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
local pos = core.get_pointed_thing_position(pointed_thing, true)
|
||||
if pos == nil then
|
||||
if user then
|
||||
pos = user:get_pos()
|
||||
end
|
||||
pos = assert(user):get_pos()
|
||||
end
|
||||
pos = vector.add(pos, {x=0, y=0.5, z=0})
|
||||
local tex, anim
|
||||
|
@ -32,5 +45,12 @@ core.register_tool("testtools:particle_spawner", {
|
|||
glow = math.random(0, 5),
|
||||
})
|
||||
end,
|
||||
on_place = function(itemstack, user, pointed_thing)
|
||||
local pos = assert(core.get_pointed_thing_position(pointed_thing, true))
|
||||
spawn_clip_test_particle(pos)
|
||||
end,
|
||||
on_secondary_use = function(_, user)
|
||||
spawn_clip_test_particle(assert(user):get_pos())
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 179 B |
Loading…
Add table
Add a link
Reference in a new issue