From cd66dc28a4cd9836fe0d41ac8e9cb2aac0c312b0 Mon Sep 17 00:00:00 2001 From: Wbjitscool Date: Wed, 22 May 2024 05:18:27 +0000 Subject: [PATCH] Cherry blossom particles improvement (#4258) Co-authored-by: the-real-herowl Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4258 Reviewed-by: the-real-herowl Co-authored-by: Wbjitscool Co-committed-by: Wbjitscool --- mods/ITEMS/mcl_cherry_blossom/growth.lua | 30 +++++++++++++++++++- textures/mcl_cherry_blossom_particle.png | Bin 75 -> 0 bytes textures/mcl_cherry_blossom_particle_1.png | Bin 0 -> 140 bytes textures/mcl_cherry_blossom_particle_10.png | Bin 0 -> 140 bytes textures/mcl_cherry_blossom_particle_11.png | Bin 0 -> 140 bytes textures/mcl_cherry_blossom_particle_12.png | Bin 0 -> 132 bytes textures/mcl_cherry_blossom_particle_2.png | Bin 0 -> 140 bytes textures/mcl_cherry_blossom_particle_3.png | Bin 0 -> 140 bytes textures/mcl_cherry_blossom_particle_4.png | Bin 0 -> 140 bytes textures/mcl_cherry_blossom_particle_5.png | Bin 0 -> 140 bytes textures/mcl_cherry_blossom_particle_6.png | Bin 0 -> 140 bytes textures/mcl_cherry_blossom_particle_7.png | Bin 0 -> 140 bytes textures/mcl_cherry_blossom_particle_8.png | Bin 0 -> 140 bytes textures/mcl_cherry_blossom_particle_9.png | Bin 0 -> 140 bytes 14 files changed, 29 insertions(+), 1 deletion(-) delete mode 100644 textures/mcl_cherry_blossom_particle.png create mode 100644 textures/mcl_cherry_blossom_particle_1.png create mode 100644 textures/mcl_cherry_blossom_particle_10.png create mode 100644 textures/mcl_cherry_blossom_particle_11.png create mode 100644 textures/mcl_cherry_blossom_particle_12.png create mode 100644 textures/mcl_cherry_blossom_particle_2.png create mode 100644 textures/mcl_cherry_blossom_particle_3.png create mode 100644 textures/mcl_cherry_blossom_particle_4.png create mode 100644 textures/mcl_cherry_blossom_particle_5.png create mode 100644 textures/mcl_cherry_blossom_particle_6.png create mode 100644 textures/mcl_cherry_blossom_particle_7.png create mode 100644 textures/mcl_cherry_blossom_particle_8.png create mode 100644 textures/mcl_cherry_blossom_particle_9.png diff --git a/mods/ITEMS/mcl_cherry_blossom/growth.lua b/mods/ITEMS/mcl_cherry_blossom/growth.lua index 28cedea28..bca926539 100644 --- a/mods/ITEMS/mcl_cherry_blossom/growth.lua +++ b/mods/ITEMS/mcl_cherry_blossom/growth.lua @@ -31,11 +31,25 @@ local cherry_particle = { velocity = vector.zero(), acceleration = vector.new(0,-1,0), size = math.random(1.3,2.5), - texture = "mcl_cherry_blossom_particle.png", + texture = "mcl_cherry_blossom_particle_" .. math.random(1, 12) .. ".png", + animation = { + type = "vertical_frames", + aspect_w = 3, + aspect_h = 3, + length = 0.8, + }, collision_removal = false, collisiondetection = false, } +local wind_direction -- vector +local time_changed -- 0 - afternoon; 1 - evening; 2 - morning +local function change_wind_direction() + local east_west = math.random(-0.5,0.5) + local north_south = math.random(-0.5,0.5) + wind_direction = vector.new(east_west, 0, north_south) +end +change_wind_direction() minetest.register_abm({ label = "Cherry Blossom Particles", @@ -47,6 +61,20 @@ minetest.register_abm({ local pt = table.copy(cherry_particle) pt.pos = vector.offset(pos,math.random(-0.5,0.5),-0.51,math.random(-0.5,0.5)) pt.expirationtime = math.random(1.2,4.5) + pt.texture = "mcl_cherry_blossom_particle_" .. math.random(1, 12) .. ".png" + local time = minetest.get_timeofday() + if time_changed ~= 0 and time > 0.6 and time < 0.605 then + time_changed = 0 + change_wind_direction() + elseif (time_changed ~= 1 and time > 0.8 and time < 0.805) then + time_changed = 1 + change_wind_direction() + elseif (time_changed ~= 2 and time > 0.3 and time < 0.305) then + time_changed = 2 + change_wind_direction() + end + pt.acceleration = pt.acceleration + wind_direction + minetest.add_particle(pt) end) end diff --git a/textures/mcl_cherry_blossom_particle.png b/textures/mcl_cherry_blossom_particle.png deleted file mode 100644 index eabdb097c9bb031b7c38accb7f28e2c79141f1d1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 75 zcmeAS@N?(olHy`uVBq!ia0y~yU|?ooU|{56V_;yAeju`ifq_BD)5S4_LpJ%xi~Vo@ fpT1ycz{X&9lcPp{b%PZH0|SGntDnm{r-UW|NbD04 diff --git a/textures/mcl_cherry_blossom_particle_1.png b/textures/mcl_cherry_blossom_particle_1.png new file mode 100644 index 0000000000000000000000000000000000000000..0b789e0714d9b5a5f65486235536dcef03f913f4 GIT binary patch literal 140 zcmV;70CWF|P)}L;L}1uz-h0{>f1{YQ~uLY8I1YAoCkI0J49I$-?Ya_axhySK4O uVd%l_SeQ~K1_lNOm}yK{EyVB-im?EuiZ*pphJot<0000RW)rCILZ?M0000Nkl(4Cnr5U|?YQ%<`K76~JV03p_TR@gGHo30am2tFdrH;0(Aa=z#ID>5Tupe^{|d uVd%l_SeQ~K1_lNOm}yK{EyVB-im?F5-!X^5xz=(30000$U=TBIq uF!bPdEKDgA0|NsC%rqvf7Gn4Z#aIAXNH13p;_SZw00000000tLY8I1YAoCkI0J49I$*r$JmtUCxu001 uF!bPdEKDgA0|NsC%rqvf7Gn4Z#aIAtRWC(7pzaj_0000>G+O>MFfcG^@yjuw0+tLY8I1YAoCkI0J49I$-=zzUTkngHNzX uVd%l_SeQ~K1_lNOm}yK{EyVB-im?EAyEK1)w8)150000Y literal 0 HcmV?d00001