-- HACK: SetPos does not ensure that the position wont be modified again by the gamemovement.
-- There is currently no ENTITY:Teleport binding.
TELEPORT_QUEUE = {}
hook.Add("FinishMove", "LambdaTeleport", function(ply, mv)
local tpData = TELEPORT_QUEUE[ply]
if tpData ~= nil then
ply:SetPos(tpData.Pos)
ply:SetAngles(tpData.Angles)
TELEPORT_QUEUE[ply] = nil
return true
end
end)
local function TeleportPlayer(ent, pos, ang, vel)
-- Mimic IncrementInterpolationFrame, we just make sure we call the things at the right time.
local data = {}
data.Pos = pos
data.Angles = ang
data.Velocity = vel
data.Ent = ent
TELEPORT_QUEUE[ent] = data
end