1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-15 23:10:31 +01:00

[mobs/api] Put back calc_velocity

This commit is contained in:
LeMagnesium 2015-12-12 17:51:48 +01:00
parent a26c4e4f0c
commit 1d634aaa99

View File

@ -357,6 +357,17 @@ do_jump = function(self)
end end
end end
function calc_velocity(pos1, pos2, old_vel, power)
local vel = vector.direction(pos1, pos2)
vel = vector.normalize(vel)
vel = vector.multiply(vel, power)
local dist = vector.distance(pos1, pos2)
dist = math.max(dist, 1)
vel = vector.divide(vel, dist)
vel = vector.add(vel, old_vel)
return vel
end
-- blast damage to entities nearby (modified from TNT mod) -- blast damage to entities nearby (modified from TNT mod)
function entity_physics(pos, radius, self) --/MFF (Crabman|06/23/2015)add self to use punch function function entity_physics(pos, radius, self) --/MFF (Crabman|06/23/2015)add self to use punch function