mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-25 18:20:36 +01:00
[mobs/api] Put back calc_velocity
This commit is contained in:
parent
a26c4e4f0c
commit
1d634aaa99
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user