Skip to content

Commit 5cd4b5a

Browse files
sofarparamat
authored andcommittedApr 26, 2016
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.
1 parent f62afa0 commit 5cd4b5a

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed
 

Diff for: ‎mods/tnt/init.lua

+13-3
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,24 @@ function tnt.boom(pos, def)
309309
end
310310

311311
minetest.register_node("tnt:boom", {
312-
drawtype = "plantlike",
313-
tiles = {"tnt_boom.png"},
312+
drawtype = "airlike",
314313
light_source = default.LIGHT_MAX,
315314
walkable = false,
316315
drop = "",
317316
groups = {dig_immediate = 3},
318317
on_construct = function(pos)
319-
minetest.get_node_timer(pos):start(0.5)
318+
minetest.add_particle({
319+
pos = pos,
320+
velocity = vector.new(),
321+
acceleration = vector.new(),
322+
expirationtime = 0.4,
323+
size = 30,
324+
collisiondetection = false,
325+
vertical = false,
326+
texture = "tnt_boom.png",
327+
playername = nil,
328+
})
329+
minetest.get_node_timer(pos):start(0.4)
320330
end,
321331
on_timer = function(pos, elapsed)
322332
minetest.remove_node(pos)

0 commit comments

Comments
 (0)
Please sign in to comment.