<commit_before>using System.Collections;
using PlayGroups.Input;
using UI;
using UnityEngine;
using UnityEngine.Networking;

namespace PlayGroup
{
	public class PlayerScript : ManagedNetworkBehaviour
	{
		// the maximum distance the player needs to be to an object to interact with it
		//1.75 is the optimal distance to now have any direction click too far
		//NOTE FOR ANYONE EDITING THIS IN THE FUTURE: Character's head is slightly below the top of the tile
		//hence top reach is slightly lower than bottom reach, where the legs go exactly to the bottom of the tile.
		public const float interactionDistance = 1.75f;

		public GameObject ghost;

		[SyncVar] public JobType JobType = JobType.NULL;

		private float pingUpdate;

		[SyncVar(hook = "OnNameChange")] public string playerName = " ";

		private ChatChannel selectedChannels;

		public PlayerNetworkActions playerNetworkActions { get; set; }

		public WeaponNetworkActions weaponNetworkActions { get; set; }

		public SoundNetworkActions soundNetworkActions { get; set; }

		public PlayerHealth playerHealth { get; set; }

		public PlayerMove playerMove { get; set; }

		public PlayerSprites playerSprites { get; set; }

		public PlayerSync playerSync { get; set; }

		public InputController inputController { get; set; }

		public HitIcon hitIcon { get; set; }

		public ChatChannel SelectedChannels
		{
			get { return selectedChannels & GetAvailableChannels(); }
			set { selectedChannels = value; }
		}

		public override void OnStartClient()
		{
			//Local player is set a frame or two after OnStartClient
			StartCoroutine(WaitForLoad());
			base.OnStartClient();
		}

		private IEnumerator WaitForLoad()
		{
			yield return new WaitForSeconds(2f);
			OnNameChange(playerName);
		}

		//isLocalPlayer is always called after OnStartClient
		public override void OnStartLocalPlayer()
		{
			Init();

			base.OnStartLocalPlayer();
		}

		//You know the drill
		public override void OnStartServer()
		{
			Init();
			base.OnStartServer();
		}

		private void Start()
		{
			playerNetworkActions = GetComponent<PlayerNetworkActions>();
			playerSync = GetComponent<PlayerSync>();
			playerHealth = GetComponent<PlayerHealth>();
			weaponNetworkActions = GetComponent<WeaponNetworkActions>();
			soundNetworkActions = GetComponent<SoundNetworkActions>();
			inputController = GetComponent<InputController>();
			hitIcon = GetComponentInChildren<HitIcon>();
		}

		private void Init()
		{
			if (isLocalPlayer)
			{
				UIManager.ResetAllUI();
				UIManager.DisplayManager.SetCameraFollowPos();
                int rA = Random.Range(0, 3);
				SoundManager.PlayVarAmbient(rA);
				playerMove = GetComponent<PlayerMove>();
				playerSprites = GetComponent<PlayerSprites>();
				GetComponent<InputController>().enabled = true;

				if (!UIManager.Instance.playerListUIControl.window.activeInHierarchy)
				{
					UIManager.Instance.playerListUIControl.window.SetActive(true);
				}

				if (!PlayerManager.HasSpawned)
				{
					//First
					CmdTrySetName(PlayerManager.PlayerNameCache);
				}
				else
				{
					//Manual after respawn
					CmdSetNameManual(PlayerManager.PlayerNameCache);
				}

				PlayerManager.SetPlayerForControl(gameObject);

				if (PlayerManager.LocalPlayerScript.JobType == JobType.NULL)
				{
					// I (client) have connected to the server, ask what my job preference is
					UIManager.Instance.GetComponent<ControlDisplays>().jobSelectWindow.SetActive(true);
				}
                UIManager.SetDeathVisibility(true);
                SelectedChannels = ChatChannel.Local;
            }
			else if (isServer)
			{
				playerMove = GetComponent<PlayerMove>();
			}
		}

		public bool canNotInteract()
		{
			return playerMove == null || !playerMove.allowInput || playerMove.isGhost;
		}

		public override void UpdateMe()
		{
			//Read out of ping in toolTip
			pingUpdate += Time.deltaTime;
			if (pingUpdate >= 5f)
			{
				pingUpdate = 0f;
				int ping = CustomNetworkManager.Instance.client.GetRTT();
				UIManager.SetToolTip = "ping: " + ping;
			}
		}

		[Command]
		private void CmdTrySetName(string name)
		{<commit_msg>I think the last tabs fix.<commit_after>using System.Collections;
using PlayGroups.Input;
using UI;
using UnityEngine;
using UnityEngine.Networking;

namespace PlayGroup
{
	public class PlayerScript : ManagedNetworkBehaviour
	{
		// the maximum distance the player needs to be to an object to interact with it
		//1.75 is the optimal distance to now have any direction click too far
		//NOTE FOR ANYONE EDITING THIS IN THE FUTURE: Character's head is slightly below the top of the tile
		//hence top reach is slightly lower than bottom reach, where the legs go exactly to the bottom of the tile.
		public const float interactionDistance = 1.75f;

		public GameObject ghost;

		[SyncVar] public JobType JobType = JobType.NULL;

		private float pingUpdate;

		[SyncVar(hook = "OnNameChange")] public string playerName = " ";

		private ChatChannel selectedChannels;

		public PlayerNetworkActions playerNetworkActions { get; set; }

		public WeaponNetworkActions weaponNetworkActions { get; set; }

		public SoundNetworkActions soundNetworkActions { get; set; }

		public PlayerHealth playerHealth { get; set; }

		public PlayerMove playerMove { get; set; }

		public PlayerSprites playerSprites { get; set; }

		public PlayerSync playerSync { get; set; }

		public InputController inputController { get; set; }

		public HitIcon hitIcon { get; set; }

		public ChatChannel SelectedChannels
		{
			get { return selectedChannels & GetAvailableChannels(); }
			set { selectedChannels = value; }
		}

		public override void OnStartClient()
		{
			//Local player is set a frame or two after OnStartClient
			StartCoroutine(WaitForLoad());
			base.OnStartClient();
		}

		private IEnumerator WaitForLoad()
		{
			yield return new WaitForSeconds(2f);
			OnNameChange(playerName);
		}

		//isLocalPlayer is always called after OnStartClient
		public override void OnStartLocalPlayer()
		{
			Init();

			base.OnStartLocalPlayer();
		}

		//You know the drill
		public override void OnStartServer()
		{
			Init();
			base.OnStartServer();
		}

		private void Start()
		{
			playerNetworkActions = GetComponent<PlayerNetworkActions>();
			playerSync = GetComponent<PlayerSync>();
			playerHealth = GetComponent<PlayerHealth>();
			weaponNetworkActions = GetComponent<WeaponNetworkActions>();
			soundNetworkActions = GetComponent<SoundNetworkActions>();
			inputController = GetComponent<InputController>();
			hitIcon = GetComponentInChildren<HitIcon>();
		}

		private void Init()
		{
			if (isLocalPlayer)
			{
				UIManager.ResetAllUI();
				UIManager.DisplayManager.SetCameraFollowPos();
				int rA = Random.Range(0, 3);
				SoundManager.PlayVarAmbient(rA);
				playerMove = GetComponent<PlayerMove>();
				playerSprites = GetComponent<PlayerSprites>();
				GetComponent<InputController>().enabled = true;

				if (!UIManager.Instance.playerListUIControl.window.activeInHierarchy)
				{
					UIManager.Instance.playerListUIControl.window.SetActive(true);
				}

				if (!PlayerManager.HasSpawned)
				{
					//First
					CmdTrySetName(PlayerManager.PlayerNameCache);
				}
				else
				{
					//Manual after respawn
					CmdSetNameManual(PlayerManager.PlayerNameCache);
				}

				PlayerManager.SetPlayerForControl(gameObject);

				if (PlayerManager.LocalPlayerScript.JobType == JobType.NULL)
				{
					// I (client) have connected to the server, ask what my job preference is
					UIManager.Instance.GetComponent<ControlDisplays>().jobSelectWindow.SetActive(true);
				}
				UIManager.SetDeathVisibility(true);
				SelectedChannels = ChatChannel.Local;
			}
			else if (isServer)
			{
				playerMove = GetComponent<PlayerMove>();
			}
		}

		public bool canNotInteract()
		{
			return playerMove == null || !playerMove.allowInput || playerMove.isGhost;
		}

		public override void UpdateMe()
		{
			//Read out of ping in toolTip
			pingUpdate += Time.deltaTime;
			if (pingUpdate >= 5f)
			{
				pingUpdate = 0f;
				int ping = CustomNetworkManager.Instance.client.GetRTT();
				UIManager.SetToolTip = "ping: " + ping;
			}
		}

		[Command]
		private void CmdTrySetName(string name)
		{
{'fraction_non_alphanumeric': 0.09111978531349109, 'fraction_numerical': 0.002683581361307636, 'mean_word_length': 3.7558004640371228, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5040218', 'n_tokens_mistral': 2836, 'n_tokens_neox': 2339, 'n_words': 637}