mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-03-22 12:11:45 +01:00
[mobs] Avoid server crash with nan vector values
This commit is contained in:
parent
96dea33e89
commit
b8145c5471
@ -476,6 +476,15 @@ do_jump = function(self)
|
||||
end
|
||||
|
||||
function calc_velocity(pos1, pos2, old_vel, power) --MFF we use this function
|
||||
-- If the two positions are equal the vector will contain nan and crash the game
|
||||
if (pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z) then
|
||||
return {
|
||||
x = 0,
|
||||
y = 0,
|
||||
z = 0
|
||||
}
|
||||
end
|
||||
|
||||
local vel = vector.direction(pos1, pos2)
|
||||
vel = vector.normalize(vel)
|
||||
vel = vector.multiply(vel, power)
|
||||
|
Loading…
x
Reference in New Issue
Block a user