public static bool IsNoClipping(BasePlayer ply, TickInterpolator ticks, float deltaTime) { if (ConVar.AntiHack.noclip_protection <= 0) { return(false); } ticks.Reset(); if (!ticks.HasNext()) { return(false); } bool flag = ply.transform.parent == null; Matrix4x4 matrix4x4 = (flag ? Matrix4x4.identity : ply.transform.parent.localToWorldMatrix); Vector3 vector3 = (flag ? ticks.StartPoint : matrix4x4.MultiplyPoint3x4(ticks.StartPoint)); Vector3 vector31 = (flag ? ticks.EndPoint : matrix4x4.MultiplyPoint3x4(ticks.EndPoint)); if (ConVar.AntiHack.noclip_protection >= 3) { float single = Mathf.Max(ConVar.AntiHack.noclip_stepsize, 0.1f); int num = Mathf.Max(ConVar.AntiHack.noclip_maxsteps, 1); single = Mathf.Max(ticks.Length / (float)num, single); while (ticks.MoveNext(single)) { vector31 = (flag ? ticks.CurrentPoint : matrix4x4.MultiplyPoint3x4(ticks.CurrentPoint)); if (AntiHack.TestNoClipping(ply, vector3, vector31, true, deltaTime)) { return(true); } vector3 = vector31; } } else if (ConVar.AntiHack.noclip_protection >= 2) { if (AntiHack.TestNoClipping(ply, vector3, vector31, true, deltaTime)) { return(true); } } else if (AntiHack.TestNoClipping(ply, vector3, vector31, false, deltaTime)) { return(true); } return(false); }
public static bool IsNoClipping(BasePlayer ply, TickInterpolator ticks, float deltaTime) { if (ConVar.AntiHack.noclip_protection <= 0) { return(false); } ticks.Reset(); if (!ticks.HasNext()) { return(false); } bool flag = Object.op_Equality((Object)((Component)ply).get_transform().get_parent(), (Object)null); Matrix4x4 matrix4x4 = flag ? Matrix4x4.get_identity() : ((Component)ply).get_transform().get_parent().get_localToWorldMatrix(); Vector3 oldPos = flag ? ticks.StartPoint : ((Matrix4x4) ref matrix4x4).MultiplyPoint3x4(ticks.StartPoint); Vector3 newPos1 = flag ? ticks.EndPoint : ((Matrix4x4) ref matrix4x4).MultiplyPoint3x4(ticks.EndPoint); if (ConVar.AntiHack.noclip_protection >= 3) { float num1 = Mathf.Max(ConVar.AntiHack.noclip_stepsize, 0.1f); int num2 = Mathf.Max(ConVar.AntiHack.noclip_maxsteps, 1); float distance = Mathf.Max(ticks.Length / (float)num2, num1); while (ticks.MoveNext(distance)) { Vector3 newPos2 = flag ? ticks.CurrentPoint : ((Matrix4x4) ref matrix4x4).MultiplyPoint3x4(ticks.CurrentPoint); if (AntiHack.TestNoClipping(ply, oldPos, newPos2, true, deltaTime)) { return(true); } oldPos = newPos2; } } else if (ConVar.AntiHack.noclip_protection >= 2) { if (AntiHack.TestNoClipping(ply, oldPos, newPos1, true, deltaTime)) { return(true); } } else if (AntiHack.TestNoClipping(ply, oldPos, newPos1, false, deltaTime)) { return(true); } return(false); }