/// <summary> /// Синхронизация задержанного игрока /// </summary> private void SyncPrisoner(Client prisoner) { var policeman = _policeManager.GetAttachedPlayer(prisoner); if (policeman == null) { return; } _jailManager.PutPrisonerInJail(policeman, prisoner); }
/// <summary> /// Обработка смерти полицейского /// </summary> private void ProcessPoliceman(Client player) { if (!player.hasData(WorkData.IS_POLICEMAN)) { return; } var prisoner = _policeManager.GetAttachedPlayer(player); if (prisoner != null) { _policeManager.DetachPrisoner(player, prisoner, true); } }
/// <summary> /// Обработка респавна заключенного или арестованного игрока /// </summary> private bool ProcessPrisoner(Client player, PlayerInfo playerInfo) { if (playerInfo.Wanted.JailTime > 0) { _jailManager.SetInJail(player); return(true); } var policeman = _policeManager.GetAttachedPlayer(player); if (policeman != null) { _jailManager.PutPrisonerInJail(policeman, player, false); return(true); } return(false); }
/// <summary> /// Обработчик входа в тюремную камеру /// </summary> private void OnPutPrisonerInJail(NetHandle entity, Vector3 jailPosition) { var policeman = API.getPlayerFromHandle(entity); if (policeman == null || policeman.getData(WorkData.IS_POLICEMAN) == null) { return; } var prisoner = _policeManager.GetAttachedPlayer(policeman); if (prisoner == null) { return; } PutPrisonerInJail(policeman, prisoner, true, jailPosition); }
/// <summary> /// Проверяет, что задержанный игрок может выйти из машины /// </summary> private bool PrisonerCanExit(Client prisoner) { return(_policeManager.GetAttachedPlayer(prisoner) == null || PlayerHelper.GetData(prisoner, PoliceManager.PULL_OUT, false)); }