1
0
Fork 0

Make eating particles much more MC like!

This commit is contained in:
NO11 2021-08-02 12:24:34 +00:00
parent 4aabd7d9e7
commit 5c563d6ffd
1 changed files with 12 additions and 20 deletions

View File

@ -152,26 +152,18 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisontime, poiso
-- If false, force item to not spawn any food partiles when eaten -- If false, force item to not spawn any food partiles when eaten
if def._food_particles ~= false and texture and texture ~= "" then if def._food_particles ~= false and texture and texture ~= "" then
local v = user:get_velocity() or user:get_player_velocity() local v = user:get_velocity() or user:get_player_velocity()
local minvel = vector.add(v, {x=-1, y=1, z=-1}) for i = 0, math.min(math.max(8, hunger_change*2), 25) do
local maxvel = vector.add(v, {x=1, y=2, z=1}) minetest.add_particle({
pos = { x = pos.x, y = pos.y, z = pos.z },
minetest.add_particlespawner({ velocity = vector.add(v, { x = math.random(-1, 1), y = math.random(1, 2), z = math.random(-1, 1) }),
amount = math.min(math.max(8, hunger_change*2), 25), acceleration = { x = 0, y = math.random(-9, -5), z = 0 },
time = 0.1, expirationtime = 1,
minpos = {x=pos.x, y=pos.y, z=pos.z}, size = math.random(1, 2),
maxpos = {x=pos.x, y=pos.y, z=pos.z}, collisiondetection = true,
minvel = minvel, vertical = false,
maxvel = maxvel, texture = "[combine:3x3:" .. -i .. "," .. -i .. "=" .. texture,
minacc = {x=0, y=-5, z=0}, })
maxacc = {x=0, y=-9, z=0}, end
minexptime = 1,
maxexptime = 1,
minsize = 1,
maxsize = 2,
collisiondetection = true,
vertical = false,
texture = texture,
})
end end
minetest.sound_play("mcl_hunger_bite", { minetest.sound_play("mcl_hunger_bite", {
max_hear_distance = 12, max_hear_distance = 12,