Do not need to create new vector each time

This commit is contained in:
ancientmarinerdev 2023-03-07 22:16:56 +00:00 committed by Gitea
parent 6097dacbab
commit 038d9ec014

View file

@ -1006,8 +1006,8 @@ function mob_class:check_suspend(player_in_active_range)
local acc = self.object:get_acceleration()
if acc then
if acc.y > 0 or node_under ~= "air" then
self.object:set_acceleration(vector.new(0,0,0))
self.object:set_velocity(vector.new(0,0,0))
self.object:set_acceleration(vector.zero())
self.object:set_velocity(vector.zero())
end
if acc.y == 0 and node_under == "air" then
self:falling(pos)