修复物理hold可能会卡死和踢墙测试位置不正确

This commit is contained in:
MrZ626
2021-03-16 12:19:47 +08:00
parent 68d8ed9df0
commit 9265026e1e

View File

@@ -636,20 +636,22 @@ function Player.hold(P,ifpre)
x=x+(#C.bk[1]-#H.bk[1])*.5 x=x+(#C.bk[1]-#H.bk[1])*.5
y=y+(#C.bk-#H.bk)*.5 y=y+(#C.bk-#H.bk)*.5
local X=x for Y=int(y),ceil(y+.5)do
while X<=x+1 do local X=x
X=int(X) while true do
for Y=int(y),ceil(y)do X=int(X)
if not P:ifoverlap(H.bk,X,Y)then if not P:ifoverlap(H.bk,X,Y)then
x,y=X,Y x,y=X,Y
success=true success=true
goto BREAK goto BREAK
end end
end if X==x then
if X==x then X=X-1
X=X-1 elseif X<x then
elseif X<x then X=2*x-X
X=2*x-X else
break
end
end end
end end
::BREAK:: ::BREAK::