added particles while underwater or eating
This commit is contained in:
parent
51e55a095d
commit
b6fb2c83e0
@ -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
|
||||
|
BIN
mods/default/textures/magicpuff.png
Normal file
BIN
mods/default/textures/magicpuff.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 252 B |
BIN
mods/default/textures/magicpuff.xcf
Normal file
BIN
mods/default/textures/magicpuff.xcf
Normal file
Binary file not shown.
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user