26 lines
899 B
Plaintext
26 lines
899 B
Plaintext
local lastPosition = nil -- 记录上一次瞬移的位置
|
|
|
|
-- 缓存对象引用,避免重复调用
|
|
local localPlayer = gRegion:GetLocalPlayer()
|
|
local localPlayerAvatar = gRegion:GetLocalPlayerAvatar()
|
|
local hudStatus = localPlayer:GetHudStatus()
|
|
|
|
repeat
|
|
local flashMarkers = hudStatus:GetFlashMarkers()
|
|
|
|
for _, marker in ipairs(flashMarkers) do
|
|
if marker.markerType == 49 and not marker.garbage then
|
|
local markerPosition = marker.baseMarkerInfo:GetPosition()
|
|
|
|
-- 只有当标记位置与上次瞬移的位置不同,才执行瞬移
|
|
if markerPosition ~= lastPosition then
|
|
-- 执行瞬移
|
|
localPlayerAvatar:SetPosition(markerPosition)
|
|
|
|
-- 更新最后瞬移的位置
|
|
lastPosition = markerPosition
|
|
|
|
end
|
|
end
|
|
end
|
|
until yield() |