forked from minetest/minetest_game
TNT: make tnt:boom visual a particle, and larger
We reuse the tnt:boom texture for a particle that is added by the on_construct() of tnt:boom, and has a short expiry time (0.2sec). It is 3 nodes larged, centered on the explosion. We then make tnt:boom airlike so it doesn't have a texture, and it's the thing that emits lots of light (we could even make it exist a bit longer). The nice thing about particles is that the client is less susceptible to lag and will always remove them as fast as possible, so this makes the visual more constant and responsive.
This commit is contained in:
parent
f62afa02b7
commit
5cd4b5a231
|
@ -309,14 +309,24 @@ function tnt.boom(pos, def)
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node("tnt:boom", {
|
minetest.register_node("tnt:boom", {
|
||||||
drawtype = "plantlike",
|
drawtype = "airlike",
|
||||||
tiles = {"tnt_boom.png"},
|
|
||||||
light_source = default.LIGHT_MAX,
|
light_source = default.LIGHT_MAX,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drop = "",
|
drop = "",
|
||||||
groups = {dig_immediate = 3},
|
groups = {dig_immediate = 3},
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
minetest.get_node_timer(pos):start(0.5)
|
minetest.add_particle({
|
||||||
|
pos = pos,
|
||||||
|
velocity = vector.new(),
|
||||||
|
acceleration = vector.new(),
|
||||||
|
expirationtime = 0.4,
|
||||||
|
size = 30,
|
||||||
|
collisiondetection = false,
|
||||||
|
vertical = false,
|
||||||
|
texture = "tnt_boom.png",
|
||||||
|
playername = nil,
|
||||||
|
})
|
||||||
|
minetest.get_node_timer(pos):start(0.4)
|
||||||
end,
|
end,
|
||||||
on_timer = function(pos, elapsed)
|
on_timer = function(pos, elapsed)
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user