diff --git a/mods/default/player.lua b/mods/default/player.lua index 068cfd5..e6fe802 100644 --- a/mods/default/player.lua +++ b/mods/default/player.lua @@ -3,6 +3,8 @@ local player_lastsound = {} local player_health = {} local player_lastpos = {} +local particlespawners = {} + local enable_flowing_water_sound = minetest.setting_getbool("enable_flowing_water_sound") if enable_flowing_water_sound == nil then enable_flowing_water_sound = true end @@ -57,9 +59,28 @@ local function step(dtime) }) player_lastsound[name] = 0 end + + particlespawners[name] = minetest.add_particlespawner( + { + amount = 5, + time = 0.1, + minpos = {x = player_pos.x - 0.2, y = player_pos.y - 0.3, z = player_pos.z - 0.3}, + maxpos = {x = player_pos.x + 0.3, y = player_pos.y + 0.3, z = player_pos.z + 0.3}, + minvel = {x = -0.5, y = 0, z = -0.5}, + maxvel = {x = 0.5, y = 0, z = 0.5}, + minacc = {x = -0.5, y = 4, z = -0.5}, + maxacc = {x = 0.5, y = 1, z = 0.5}, + minexptime = 0.3, + maxexptime = 0.8, + minsize = 0.7, + maxsize = 2.4, + texture = "bubble.png" + }) + + minetest.after(0.15, function() minetest.delete_particlespawner(particlespawners[name]) end) elseif flowing_water_pos then if player_lastsound[name] > 3.3 then - + local c = true for _, p in pairs(player_positions) do if (p.x * player_pos.x) + (p.y * player_pos.y) + (p.z * player_pos.z) < 256 then diff --git a/mods/default/textures/magicpuff.png b/mods/default/textures/magicpuff.png new file mode 100644 index 0000000..4183446 Binary files /dev/null and b/mods/default/textures/magicpuff.png differ diff --git a/mods/default/textures/magicpuff.xcf b/mods/default/textures/magicpuff.xcf new file mode 100644 index 0000000..4ca417e Binary files /dev/null and b/mods/default/textures/magicpuff.xcf differ diff --git a/mods/hunger/init.lua b/mods/hunger/init.lua index 740c2ce..fba7879 100644 --- a/mods/hunger/init.lua +++ b/mods/hunger/init.lua @@ -11,6 +11,7 @@ hunger.active = {} -- how a player has been active recently hunger.moving = {} -- how much the player is moving hunger.saturation = {} -- how saturated with food the player is +local particlespawners = {} local player_step = {} local player_health_step = {} local player_bar = {} @@ -162,6 +163,25 @@ if minetest.setting_getbool("enable_damage") and minetest.setting_getbool("hunge headpos.y = headpos.y + 1 minetest.sound_play("hunger_eat", {pos = headpos, max_hear_distance = 8}) + particlespawners[name] = minetest.add_particlespawner( + { + amount = 10, + time = 0.1, + minpos = {x = headpos.x - 0.3, y = headpos.y - 0.3, z = headpos.z - 0.3}, + maxpos = {x = headpos.x + 0.3, y = headpos.y + 0.3, z = headpos.z + 0.3}, + minvel = {x = -1, y = -1, z = -1}, + maxvel = {x = 1, y = 0, z = 1}, + minacc = {x = 0, y = 6, z = 0}, + maxacc = {x = 0, y = 1, z = 0}, + minexptime = 0.5, + maxexptime = 1, + minsize = 0.5, + maxsize = 2, + texture = "magicpuff.png" + }) + + minetest.after(0.15, function() minetest.delete_particlespawner(particlespawners[name]) end) + player_effects.apply_effect(player, "hunger_eating") hunger.update_bar(player)