Exemple #1
0
        /// <summary>
        /// calls Die on the passengers' AI then clearsAllRefs
        /// </summary>
        public void DespawnProcedure()
        {
            for (int i = 0; i < myPassengers.Count; i++)
            {
                if (myPassengers[i] != null && myPassengers[i].IsAlive && !myPassengers[i].IsPlayer)
                {
                    SpawnedGangMember memberAI = SpawnManager.instance.GetTargetMemberAI(myPassengers[i]);
                    if (memberAI != null)
                    {
                        memberAI.Die();
                    }
                }
            }

            if (!watchedPed.IsPlayer)
            {
                SpawnedGangMember memberAI = SpawnManager.instance.GetTargetMemberAI(watchedPed);
                if (memberAI != null)
                {
                    memberAI.Die();
                }
            }
            ClearAllRefs();
        }
Exemple #2
0
        public override void Update()
        {
            if (vehicleIAmDriving.IsAlive && watchedPed.IsAlive)
            {
                if (destination != Vector3.Zero)
                {
                    RideToDest();
                }
                else
                {
                    //we are just wandering arond

                    //if there is a war going on and we're in the war zone, get to the player to help/kill him!
                    if (GangWarManager.instance.isOccurring && GangWarManager.instance.warZone == ZoneManager.instance.GetCurrentTurfZone())
                    {
                        playerAsDest            = true;
                        updatesWhileGoingToDest = 0;
                        RideToDest();
                        return;
                    }

                    //the driver can also do some drive-by
                    if (ModOptions.instance.gangMemberAggressiveness !=
                        ModOptions.gangMemberAggressivenessMode.defensive && ModOptions.instance.fightingEnabled)
                    {
                        watchedPed.Task.FightAgainstHatedTargets(100);
                    }


                    //stop tracking this driver/vehicle if he/she leaves the vehicle
                    if (!watchedPed.IsInVehicle())
                    {
                        ClearAllRefs();
                        return;
                    }

                    //if we get too far from the player, despawn
                    if (World.GetDistance(vehicleIAmDriving.Position, Game.Player.Character.Position) >
                        ModOptions.instance.maxDistanceCarSpawnFromPlayer * 1.5f)
                    {
                        if (!watchedPed.IsPlayer)
                        {
                            SpawnedGangMember memberAI = GangManager.instance.GetTargetMemberAI(watchedPed);
                            if (memberAI != null)
                            {
                                memberAI.Die();
                            }
                        }


                        for (int i = 0; i < myPassengers.Count; i++)
                        {
                            if (!myPassengers[i].IsPlayer)
                            {
                                SpawnedGangMember memberAI = GangManager.instance.GetTargetMemberAI(myPassengers[i]);
                                if (memberAI != null)
                                {
                                    memberAI.Die();
                                }
                            }
                        }
                        ClearAllRefs();
                    }
                }
            }
            else
            {
                //our vehicle has been destroyed/ our driver has died

                for (int i = 0; i < myPassengers.Count; i++)
                {
                    if (myPassengers[i].IsAlive && myPassengers[i].IsInVehicle(vehicleIAmDriving))
                    {
                        myPassengers[i].Task.LeaveVehicle();
                    }
                }
                ClearAllRefs();
            }
        }
Exemple #3
0
        public override void Update()
        {
            if (vehicleIAmDriving.IsAlive && watchedPed.IsAlive)
            {
                if (mustReachDest)
                {
                    watchedPed.BlockPermanentEvents = true;                     //our driver shouldn't get distracted
                }

                if (destination != Vector3.Zero)
                {
                    //stop tracking this driver/vehicle if he/she leaves the vehicle
                    if (!watchedPed.IsInVehicle(vehicleIAmDriving))
                    {
                        ClearAllRefs();
                    }
                    else
                    {
                        RideToDest();
                    }
                }
                else
                {
                    //we are just wandering arond
                    //if we get too far from the player, despawn
                    if (World.GetDistance(vehicleIAmDriving.Position, MindControl.CurrentPlayerCharacter.Position) >
                        ModOptions.instance.maxDistanceCarSpawnFromPlayer * 2.5f)
                    {
                        for (int i = 0; i < myPassengers.Count; i++)
                        {
                            if (myPassengers[i] != null && myPassengers[i].IsAlive && !myPassengers[i].IsPlayer)
                            {
                                SpawnedGangMember memberAI = SpawnManager.instance.GetTargetMemberAI(myPassengers[i]);
                                if (memberAI != null)
                                {
                                    memberAI.Die();
                                }
                            }
                        }

                        if (!watchedPed.IsPlayer)
                        {
                            SpawnedGangMember memberAI = SpawnManager.instance.GetTargetMemberAI(watchedPed);
                            if (memberAI != null)
                            {
                                memberAI.Die();
                            }
                        }
                        ClearAllRefs();
                        return;
                    }

                    //if there is a war going on and we're in the war zone, get to the player to help/kill him!
                    if (GangWarManager.instance.isOccurring && GangWarManager.instance.playerNearWarzone)
                    {
                        playerAsDest            = true;
                        updatesWhileGoingToDest = 0;
                        RideToDest();
                        return;
                    }

                    //stop tracking this driver/vehicle if he/she leaves the vehicle or something goes wrong
                    if (!watchedPed.IsInVehicle())
                    {
                        ClearAllRefs();
                        return;
                    }
                }
            }
            else
            {
                //our vehicle has been destroyed/ our driver has died

                ClearAllRefs();
            }
        }