0
0
Fork 0

Make food particles follow player speed

This commit is contained in:
Wuzzy 2017-02-16 18:01:42 +01:00
parent 96521433f5
commit 9816c91b6e
1 changed files with 6 additions and 2 deletions

View File

@ -101,13 +101,17 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisen, heal, sou
-- Special item definition field: _food_particles -- Special item definition field: _food_particles
-- 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_player_velocity()
local minvel = vector.add(v, {x=-1, y=1, z=-1})
local maxvel = vector.add(v, {x=1, y=2, z=1})
minetest.add_particlespawner({ minetest.add_particlespawner({
amount = 20, amount = 20,
time = 0.1, time = 0.1,
minpos = {x=pos.x, y=pos.y, z=pos.z}, minpos = {x=pos.x, y=pos.y, z=pos.z},
maxpos = {x=pos.x, y=pos.y, z=pos.z}, maxpos = {x=pos.x, y=pos.y, z=pos.z},
minvel = {x=-1, y=1, z=-1}, minvel = minvel,
maxvel = {x=1, y=2, z=1}, maxvel = maxvel,
minacc = {x=0, y=-5, z=0}, minacc = {x=0, y=-5, z=0},
maxacc = {x=0, y=-9, z=0}, maxacc = {x=0, y=-9, z=0},
minexptime = 1, minexptime = 1,