forked from VoxeLibre/VoxeLibre
master #5
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue