private object OnHelicopterTarget(HelicopterTurret turret, BaseCombatEntity entity) { return(InvokePersonal <PersonalHeliComponent, object>(turret?._heliAI?.helicopterBase?.gameObject, personalHeli => { var result = personalHeli.CanInterractWith(entity); return result ? null : (object)false; })); }
////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Called when the heli locks onto a player /// </summary> /// <param name="turret"></param> /// <param name="entity"></param> /// ////////////////////////////////////////////////////////////////////////////////////// // ReSharper disable once UnusedMember.Local // ReSharper disable once UnusedParameter.Local void OnHelicopterTarget(HelicopterTurret turret, BaseCombatEntity entity) { BasePlayer player = entity.ToPlayer(); if (player == null) { return; } if (!_heliTargetCooldown.ContainsKey(player.userID) || (_heliTargetCooldown.ContainsKey(player.userID) && _heliTargetCooldown[player.userID] < DateTime.Now)) { PrintToChat($"{_pluginConfig.Prefix} {Lang("Locked", player.UserIDString, player.displayName)}"); _heliTargetCooldown[player.userID] = DateTime.Now + _pluginConfig.Cooldown; } }
private void Awake() { player = GetComponent <BasePlayer>(); input = player.serverInput; rocketcycletimer = 0.0; reloadtimer = 0.0; isReloading = false; rocketNapalmReploadTime = RocketNapalmReloadTime; rocketMax = RocketMax; hasRockets = true; napalmMax = NapalmMax; hasNapalm = true; rocketDelay = RocketDelay; bulletDamage = BulletDamage; rocketcycle = false; PlayerPOS = player.transform.position + player.eyes.BodyForward() * 3f; string prefab = "assets/prefabs/npc/patrol helicopter/patrolhelicopter.prefab"; helicopterBase = GameManager.server.CreateEntity(prefab); heliAI = helicopterBase.GetComponent <PatrolHelicopterAI>(); heliAI.enabled = false; heliturret = helicopterBase.GetComponent <HelicopterTurret>(); heli = helicopterBase.GetComponent <BaseHelicopter>(); heli.InitalizeWeakspots(); if (!SpawnCrates) { heli.maxCratesToSpawn = 0; } heli.bulletDamage = bulletDamage; heli.spotlightTarget = FindTarget(target); helicopterBase.Spawn(); if (ShowCockpitOverlay) { CockpitOverlay(player); } if (ShowCrosshair) { CrosshairOverlay(player); } helicopterBase.transform.localPosition = PlayerPOS; helicopterBase.transform.rotation = player.eyes.rotation; }