From dc5c7e96611ca4bf6255d6c3a3eea2e89b64a390 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 15 Aug 2022 21:40:12 +0200 Subject: [PATCH] Greatly improve explosion particles --- mods/rp_tnt/README.txt | 1 + mods/rp_tnt/init.lua | 114 ++++++++++++++---- mods/rp_tnt/textures/rp_tnt_smoke_anim_1.png | Bin 0 -> 167 bytes mods/rp_tnt/textures/rp_tnt_smoke_anim_2.png | Bin 0 -> 167 bytes .../rp_tnt/textures/rp_tnt_smoke_ball_big.png | Bin 0 -> 531 bytes .../textures/rp_tnt_smoke_ball_medium.png | Bin 0 -> 386 bytes .../textures/rp_tnt_smoke_ball_small.png | Bin 0 -> 288 bytes 7 files changed, 91 insertions(+), 24 deletions(-) create mode 100644 mods/rp_tnt/textures/rp_tnt_smoke_anim_1.png create mode 100644 mods/rp_tnt/textures/rp_tnt_smoke_anim_2.png create mode 100644 mods/rp_tnt/textures/rp_tnt_smoke_ball_big.png create mode 100644 mods/rp_tnt/textures/rp_tnt_smoke_ball_medium.png create mode 100644 mods/rp_tnt/textures/rp_tnt_smoke_ball_small.png diff --git a/mods/rp_tnt/README.txt b/mods/rp_tnt/README.txt index 3a97bf3..a80d086 100644 --- a/mods/rp_tnt/README.txt +++ b/mods/rp_tnt/README.txt @@ -12,6 +12,7 @@ You can also create arbitrary explosions. ## Credits Source code license: LGPLv2.1 +Texture license: CC BY-SA 4.0 Sound license: CC0 Sound credits: diff --git a/mods/rp_tnt/init.lua b/mods/rp_tnt/init.lua index 786c40d..537ea8b 100644 --- a/mods/rp_tnt/init.lua +++ b/mods/rp_tnt/init.lua @@ -137,23 +137,89 @@ local function entity_physics(pos, radius) end end +local function add_node_break_effects(pos, node, node_tile) + minetest.add_particlespawner( + { + amount = 40, + time = 0.1, + pos = { + min = vector.subtract(pos, 0.4), + max = vector.add(pos, 0.4), + }, + vel = { + min = vector.new(-5, -5, -5), + max = vector.new(5, 5, 5), + }, + acc = vector.new(0, -9.81, 0), + exptime = { min = 0.2, max = 0.6 }, + size = { min = 1.0, max = 1.5 }, + node = node, + node_tile = node_tile, + }) + +end + local function add_explosion_effects(pos, radius) minetest.add_particlespawner( { - amount = 128, - time = 1, - minpos = vector.subtract(pos, radius / 2), - maxpos = vector.add(pos, radius / 2), - minvel = {x = -20, y = -20, z = -20}, - maxvel = {x = 20, y = 20, z = 20}, - minacc = vector.new(), - maxacc = vector.new(), - minexptime = 0.2, - maxexptime = 1, - minsize = 16, - maxsize = 24, - texture = "tnt_smoke.png", + amount = 128, + time = 0.6, + pos = { + min = vector.subtract(pos, radius / 2), + max = vector.add(pos, radius / 2), + }, + vel = { + min = vector.new(-20, -20, -20), + max = vector.new(20, 20, 20), + }, + acc = vector.zero(), + exptime = { min = 0.2, max = 1.0 }, + size = { min = 16, max = 24 }, + drag = vector.new(1,1,1), + texture = { + name = "rp_tnt_smoke_anim_1.png", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 }, + name = "rp_tnt_smoke_anim_2.png", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 }, + name = "rp_tnt_smoke_anim_1.png^[transformFX", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 }, + name = "rp_tnt_smoke_anim_2.png^[transformFX", animation = { type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = -1 }, + }, }) + minetest.add_particlespawner({ + amount = 1, + time = 0.01, + pos = pos, + vel = vector.zero(), + acc = vector.zero(), + exptime = 1, + size = radius*10, + texture = "rp_tnt_smoke_ball_big.png", + animation = { type = "vertical_frames", aspect_w = 32, aspect_h = 32, length = -1, }, + }) + minetest.add_particlespawner({ + amount = 4, + time = 0.25, + pos = pos, + vel = vector.zero(), + acc = vector.zero(), + exptime = { min = 0.6, max = 0.9 }, + size = { min = 8, max = 12 }, + radius = { min = 0.5, max = math.max(0.6, radius*0.75) }, + texture = "rp_tnt_smoke_ball_medium.png", + animation = { type = "vertical_frames", aspect_w = 32, aspect_h = 32, length = -1, }, + }) + minetest.add_particlespawner({ + amount = 28, + time = 0.5, + pos = pos, + vel = vector.zero(), + acc = vector.zero(), + exptime = { min = 0.5, max = 0.8 }, + size = { min = 6, max = 8 }, + radius = { min = 1, max = math.max(1.1, radius+1) }, + texture = "rp_tnt_smoke_ball_small.png", + animation = { type = "vertical_frames", aspect_w = 32, aspect_h = 32, length = -1, }, + }) + + end local function emit_fuse_smoke(pos) @@ -165,18 +231,16 @@ local function emit_fuse_smoke(pos) return minetest.add_particlespawner({ time = TNT_TIMER, amount = 40, - minpos = minpos, - maxpos = maxpos, - minvel = minvel, - maxvel = maxvel, - minacc = acc, - maxacc = acc, - minexptime = 0.15 - 0.25, - maxexptime = 0.15 + 0.25, - minsize = 0.25, - maxsize = 2.0, + pos = { min = minpos, max = maxpos }, + vel = { min = minvel, max = maxvel }, + acc = acc, + exptime = { min = 0.05, max = 0.6 }, + size = { min = 0.25, max = 2.0 }, collisiondetection = false, - texture = "tnt_smoke_fuse.png" + texture = { + name = "tnt_smoke_fuse.png", + alpha_tween = { 1, 0, start = 0.75 }, + }, }) end @@ -249,7 +313,9 @@ end local function rawboom(pos, radius, sound, remove_nodes, is_tnt) if is_tnt then + local node = minetest.get_node(pos) minetest.remove_node(pos) + add_node_break_effects(pos, node, 0) if is_tnt and not tnt_enable then minetest.check_for_falling({x=pos.x, y=pos.y, z=pos.z}) return diff --git a/mods/rp_tnt/textures/rp_tnt_smoke_anim_1.png b/mods/rp_tnt/textures/rp_tnt_smoke_anim_1.png new file mode 100644 index 0000000000000000000000000000000000000000..c37074635b756560a21a98b0d9cbb23fe7c80794 GIT binary patch literal 167 zcmeAS@N?(olHy`uVBq!ia0vp^0zllr$P6ScqN@{u6kC8#h%1mjbLPwm{{u!q7Gp_} zUoeBivm0qZj=!giV@L(#+*2DlTMa}Q4k+6n)o-?Na675d_sLCs;&oMxxY~xUgekgj z>UT-CTq=>N3#yY?r@#M?bL9W3`uKgv-kiSwsrv8PeMi&3$(M4gD_3%JFn-!43pAR+ M)78&qol`;+0Hd2ZfdBvi literal 0 HcmV?d00001 diff --git a/mods/rp_tnt/textures/rp_tnt_smoke_anim_2.png b/mods/rp_tnt/textures/rp_tnt_smoke_anim_2.png new file mode 100644 index 0000000000000000000000000000000000000000..3fe7885f2639c41a476d7fc0f9ea82473412636b GIT binary patch literal 167 zcmeAS@N?(olHy`uVBq!ia0vp^0zllr$P6ScqN@{u6kC8#h%1mjbLPwm{{u!q7Gp_} zUoeBivm0qZj=!giV@L(#)Kgm-nHU8aHawWJoiWJp*wmh5*M96?&X-Uvo^IWjF1Ido zZdi2VY|+Ay?Pni7zVV&6em?)z_Z|y>UHMme(EQig|G)Na%>QwH4}%>m+s^rXUqMb{ N@O1TaS?83{1OQ+`J-7e> literal 0 HcmV?d00001 diff --git a/mods/rp_tnt/textures/rp_tnt_smoke_ball_big.png b/mods/rp_tnt/textures/rp_tnt_smoke_ball_big.png new file mode 100644 index 0000000000000000000000000000000000000000..b2d05fe776a2248f66fcf5943d18d96ab973ff7f GIT binary patch literal 531 zcmV+u0_^>XP)Pj9)^?Q zX&Am$>=n<3VHm#u4$&bU{J9VuR2=o60o(OKGau^q_n_0I2oN-L|E2!z*U$g%=lp8y z2fUxJur>UEw}vyUIz)$b$mI*%Xg~V=*82HW;r+na&w2GS`*~#R{k&u0{Q%a_BXHYe ze-Es#B08jlKNo_*`vFdXE%knCjF-^Q{bK9~w$@LAh4mwV^&_nxtdNF!TPa>{-fSOG(;h$22q6Ck0W)!&OAhij0oL7 z2Z#Nq1BwHhw>-qSZ z^nP2u9~KCtM|_q5;{7#SXiorY5ML!52udL~P*qISSRqj%D5C%(0mbK~D27NFs@V{I z=*-58xA(uy^ikeN(?_eseMF){R5rv0g0g98Vu*nLaXsy-lJ~02+rO6Fum>vYHv?eZ`Q8 zBZ{EBk4OYt^2$D%KEj_!JijI>022);UoIvLjq-}}7iVOs-$#K0$V33;D<+zKw0+kt zsZW&lQS`Nd@sS9200>+RqTNUNaxq~jS0?crvXVpR|DA!9!N(za#wshzww>^knEkTUSsx(8s7Q=Ea>_gFCBL%f z+Z*e(SU$^F6S;VL30w~N&?`hDw;>$m0yJ^1p9>H^56o1$5 m*k~GW@Y7KDM(FqOS_A-h*FsW+m@4T20000