protected AITaskExtinguishFireInArea(AIController controller, Vector3 position, float range, bool shouldUseVehicleWaterCannon = true) : base(controller)
        {
            firefighter = controller.Owner as Firefighter;
            if (firefighter == null)
            {
                throw new System.ArgumentException($"The AIController.Owner instance isn't a Firefighter instance. The {nameof(AITaskExtinguishFireInArea)} requires a Firefighter instance.", nameof(controller));
            }

            this.position     = position;
            this.range        = range;
            firesToExtinguish = new List <Fire>();

            if (shouldUseVehicleWaterCannon && Ped.IsInAnyVehicle(false) && Ped.SeatIndex == -1)
            {
                const uint waterCannonVehWeaponHash = 1422046295;
                if (NativeFunction.Natives.SetCurrentPedVehicleWeapon <bool>(Ped, waterCannonVehWeaponHash)) // SetCurrentPedVehicleWeapon returns true if the vehicle has the specified weapon
                {
                    this.range       = range + 10.0f;                                                        // increase range to allow more maneuverability with the truck
                    useVehicleCannon = true;
                }
            }


            rangeSq = this.range * this.range;
        }
        protected override void CreateInternal(out Vehicle vehicle, out AdvancedPed[] peds)
        {
            vehicle = EntityCreator.CreateFirefighterVehicle(SpawnLocation.Position, SpawnLocation.Heading, FirefighterRole.Engine);

            int seats = Math.Min(vehicle.PassengerCapacity + 1, 4);

            Firefighters = new Firefighter[seats];
            peds         = new AdvancedPed[seats];
            for (int i = 0; i < seats; i++)
            {
                Firefighter f = new Firefighter(Vector3.Zero, 0.0f);
                f.PreferedVehicleSeatIndex = i - 1;
                f.Ped.WarpIntoVehicle(vehicle, i - 1);
                f.Equipment.SetEquipped <FireGearEquipment>(false);

                Firefighters[i] = f;
                peds[i]         = f;
            }
        }
예제 #3
0
        private FirefighterPartner(Vector3 position, float heading)
        {
            Firefighter = new Firefighter(position, heading);
            Firefighter.Equipment.SetEquipped <FireGearEquipment>(false);
            Firefighter.AI.IsEnabled = false;
            Firefighter.Deleted     += OnPedDeleted;

            Blip        = new Blip(Firefighter.Ped);
            Blip.Sprite = BlipSprite.Friend;
            Blip.Scale  = 0.65f;
            Blip.Color  = Color.FromArgb(180, 0, 0);
            Blip.Name   = "Firefighter Partner";

            BehaviorAgent = new BehaviorAgent(Firefighter.Ped);
            BehaviorAgent.Blackboard.Set <int>("partnerSeatIndex", GetAllPartners()?.Length ?? 0);
            BehaviorAgent.Blackboard.Set <Firefighter>("partnerFirefighterInstance", Firefighter);

            RegisterFirefighterPartner(this);
        }