diff --git a/mods/CORE/mcl_particles/description.txt b/mods/CORE/mcl_particles/description.txt new file mode 100644 index 0000000000..62d5cd61a5 --- /dev/null +++ b/mods/CORE/mcl_particles/description.txt @@ -0,0 +1 @@ +Contains particle images of MineClone 2. No code. diff --git a/mods/CORE/mcl_particles/init.lua b/mods/CORE/mcl_particles/init.lua new file mode 100644 index 0000000000..e69de29bb2 diff --git a/mods/CORE/mcl_particles/mod.conf b/mods/CORE/mcl_particles/mod.conf new file mode 100644 index 0000000000..f7be803954 --- /dev/null +++ b/mods/CORE/mcl_particles/mod.conf @@ -0,0 +1 @@ +name = mcl_particles diff --git a/mods/CORE/mcl_particles/textures/mcl_particles_bubble.png b/mods/CORE/mcl_particles/textures/mcl_particles_bubble.png new file mode 100644 index 0000000000..063489d379 Binary files /dev/null and b/mods/CORE/mcl_particles/textures/mcl_particles_bubble.png differ diff --git a/mods/PLAYER/mcl_player/depends.txt b/mods/PLAYER/mcl_player/depends.txt new file mode 100644 index 0000000000..746a634e05 --- /dev/null +++ b/mods/PLAYER/mcl_player/depends.txt @@ -0,0 +1 @@ +mcl_particles diff --git a/mods/PLAYER/mcl_player/init.lua b/mods/PLAYER/mcl_player/init.lua index bef53c087e..567216cb70 100644 --- a/mods/PLAYER/mcl_player/init.lua +++ b/mods/PLAYER/mcl_player/init.lua @@ -201,6 +201,34 @@ minetest.register_globalstep(function(dtime) else player_set_animation(player, "stand", animation_speed_mod) end + + -- Spawn bubble particles when underwater + + local pos = player:getpos() + local head_pos = { + x = math.floor(pos.x+0.5), + y = math.ceil(pos.y+1.0), + z = math.floor(pos.z+0.5) + } + + if minetest.get_item_group(minetest.get_node(head_pos).name, "water") ~= 0 then + minetest.add_particlespawner({ + amount = 2, + time = 0.15, + minpos = { x = -0.25, y = 0.3, z = -0.25 }, + maxpos = { x = 0.25, y = 0.7, z = 0.75 }, + attached = player, + minvel = {x = -0.2, y = 0, z = -0.2}, + maxvel = {x = 0.5, y = 0, z = 0.5}, + minacc = {x = -0.4, y = 4, z = -0.4}, + maxacc = {x = 0.5, y = 1, z = 0.5}, + minexptime = 0.3, + maxexptime = 0.8, + minsize = 0.7, + maxsize = 2.4, + texture = "mcl_particles_bubble.png" + }) + end end end end)