using EFT;
using stupid.solutions.stupid.solutions.Data;
using UnityEngine;

internal class RayCast
{
	private static readonly LayerMask LayerMask = -2142957568;

	private static RaycastHit _raycastHit;

	public static Vector3 BarrelRayCast(Player gamePlayer)
	{
		try
		{
			if (gamePlayer.Fireport == null)
			{
				return Vector3.zero;
			}
			Physics.Linecast(gamePlayer.Fireport.position, gamePlayer.Fireport.position - gamePlayer.Fireport.up * 1000f, out _raycastHit);
			return _raycastHit.point;
		}
		catch
		{
			return Vector3.zero;
		}
	}

	public static Vector3 BarrelRayCastO(OnlineGamePlayer gamePlayer)
	{
		try
		{
			_ = gamePlayer.Player.ObservedPlayerController.HandsController.CurrentFireport.position;
			BifacialTransform currentFireport = gamePlayer.Player.ObservedPlayerController.HandsController.CurrentFireport;
			Physics.Linecast(currentFireport.position, currentFireport.position - currentFireport.up * 1000f, out _raycastHit);
			return _raycastHit.point;
		}
		catch
		{
			return Vector3.zero;
		}
	}

	public static string BarrelRayCastTest(Player gamePlayer)
	{
		try
		{
			Physics.Linecast(gamePlayer.Fireport.position, gamePlayer.Fireport.position - gamePlayer.Fireport.up * 1000f, out _raycastHit);
			return _raycastHit.transform.name;
		}
		catch
		{
			return "Unkown";
		}
	}
}
