public static bool Prefix(ref CargoTruckAI __instance, ushort vehicleID, ref Vehicle vehicleData, Vector3 refPos, ushort leaderID, ref Vehicle leaderData, ref int index, float minSqrDistance)
 {
     if ((leaderData.m_flags & Vehicle.Flags.WaitingTarget) == (Vehicle.Flags) 0)
     {
         if ((leaderData.m_flags & Vehicle.Flags.GoingBack) == (Vehicle.Flags) 0)
         {
             if (leaderData.m_targetBuilding != 0)
             {
                 BuildingManager instance2 = Singleton <BuildingManager> .instance;
                 BuildingInfo    info2     = instance2.m_buildings.m_buffer[(int)MainDataStore.TargetGasBuilding[leaderID]].Info;
                 float           distance  = Vector3.Distance(instance2.m_buildings.m_buffer[(int)MainDataStore.TargetGasBuilding[leaderID]].m_position, leaderData.GetLastFramePosition());
                 if (((leaderData.m_transferType == 127) || (leaderData.m_transferType == 126)) && (distance < 50))
                 {
                     if (leaderID == vehicleID)
                     {
                         if (MainDataStore.TargetGasBuilding[leaderID] != 0)
                         {
                             Randomizer randomizer2 = new Randomizer((int)vehicleID);
                             Vector3    targetPos2;
                             Vector3    vector2;
                             info2.m_buildingAI.CalculateUnspawnPosition(MainDataStore.TargetGasBuilding[leaderID], ref instance2.m_buildings.m_buffer[(int)MainDataStore.TargetGasBuilding[leaderID]], ref randomizer2, __instance.m_info, out targetPos2, out vector2);
                             vehicleData.SetTargetPos(index++, CalculateTargetPoint(refPos, targetPos2, minSqrDistance, 4f));
                             return(false);
                         }
                     }
                     else
                     {
                         DebugLog.LogToFileOnly("Error: No such case for RealGasStation");
                     }
                 }
             }
         }
     }
     return(true);
 }
        public override bool ArriveAtDestination(ushort vehicleID, ref Vehicle vehicleData)
        {
            if ((vehicleData.m_flags & Vehicle.Flags.WaitingTarget) != ~(Vehicle.Flags.Created | Vehicle.Flags.Deleted | Vehicle.Flags.Spawned | Vehicle.Flags.Inverted | Vehicle.Flags.TransferToTarget | Vehicle.Flags.TransferToSource | Vehicle.Flags.Emergency1 | Vehicle.Flags.Emergency2 | Vehicle.Flags.WaitingPath | Vehicle.Flags.Stopped | Vehicle.Flags.Leaving | Vehicle.Flags.Arriving | Vehicle.Flags.Reversed | Vehicle.Flags.TakingOff | Vehicle.Flags.Flying | Vehicle.Flags.Landing | Vehicle.Flags.WaitingSpace | Vehicle.Flags.WaitingCargo | Vehicle.Flags.GoingBack | Vehicle.Flags.WaitingTarget | Vehicle.Flags.Importing | Vehicle.Flags.Exporting | Vehicle.Flags.Parking | Vehicle.Flags.CustomName | Vehicle.Flags.OnGravel | Vehicle.Flags.WaitingLoading | Vehicle.Flags.Congestion | Vehicle.Flags.DummyTraffic | Vehicle.Flags.Underground | Vehicle.Flags.Transition | Vehicle.Flags.InsideBuilding | Vehicle.Flags.LeftHandDrive))
            {
                return(false);
            }
            if ((vehicleData.m_flags & Vehicle.Flags.WaitingLoading) != ~(Vehicle.Flags.Created | Vehicle.Flags.Deleted | Vehicle.Flags.Spawned | Vehicle.Flags.Inverted | Vehicle.Flags.TransferToTarget | Vehicle.Flags.TransferToSource | Vehicle.Flags.Emergency1 | Vehicle.Flags.Emergency2 | Vehicle.Flags.WaitingPath | Vehicle.Flags.Stopped | Vehicle.Flags.Leaving | Vehicle.Flags.Arriving | Vehicle.Flags.Reversed | Vehicle.Flags.TakingOff | Vehicle.Flags.Flying | Vehicle.Flags.Landing | Vehicle.Flags.WaitingSpace | Vehicle.Flags.WaitingCargo | Vehicle.Flags.GoingBack | Vehicle.Flags.WaitingTarget | Vehicle.Flags.Importing | Vehicle.Flags.Exporting | Vehicle.Flags.Parking | Vehicle.Flags.CustomName | Vehicle.Flags.OnGravel | Vehicle.Flags.WaitingLoading | Vehicle.Flags.Congestion | Vehicle.Flags.DummyTraffic | Vehicle.Flags.Underground | Vehicle.Flags.Transition | Vehicle.Flags.InsideBuilding | Vehicle.Flags.LeftHandDrive))
            {
                vehicleData.m_waitCounter = (byte)Mathf.Min((int)vehicleData.m_waitCounter + 1, (int)byte.MaxValue);
                if (vehicleData.m_waitCounter < (byte)16)
                {
                    return(false);
                }
                if (vehicleData.m_targetBuilding != (ushort)0 && (Singleton <BuildingManager> .instance.m_buildings.m_buffer[(int)vehicleData.m_targetBuilding].m_flags & Building.Flags.IncomingOutgoing) == Building.Flags.None)
                {
                    ushort nextCargoParent = CargoTruckAI.FindNextCargoParent(vehicleData.m_targetBuilding, this.m_info.m_class.m_service, this.m_info.m_class.m_subService);
                    if (nextCargoParent != (ushort)0)
                    {
                        ushort targetBuilding = Singleton <VehicleManager> .instance.m_vehicles.m_buffer[(int)nextCargoParent].m_targetBuilding;
                        if (targetBuilding != (ushort)0)
                        {
                            CargoTruckAI.SwitchCargoParent(nextCargoParent, vehicleID);
                            vehicleData.m_waitCounter = (byte)0;
                            vehicleData.m_flags      &= Vehicle.Flags.Created | Vehicle.Flags.Deleted | Vehicle.Flags.Spawned | Vehicle.Flags.Inverted | Vehicle.Flags.TransferToTarget | Vehicle.Flags.TransferToSource | Vehicle.Flags.Emergency1 | Vehicle.Flags.Emergency2 | Vehicle.Flags.WaitingPath | Vehicle.Flags.Stopped | Vehicle.Flags.Leaving | Vehicle.Flags.Arriving | Vehicle.Flags.Reversed | Vehicle.Flags.TakingOff | Vehicle.Flags.Flying | Vehicle.Flags.Landing | Vehicle.Flags.WaitingSpace | Vehicle.Flags.WaitingCargo | Vehicle.Flags.GoingBack | Vehicle.Flags.WaitingTarget | Vehicle.Flags.Importing | Vehicle.Flags.Exporting | Vehicle.Flags.Parking | Vehicle.Flags.CustomName | Vehicle.Flags.OnGravel | Vehicle.Flags.Congestion | Vehicle.Flags.DummyTraffic | Vehicle.Flags.Underground | Vehicle.Flags.Transition | Vehicle.Flags.InsideBuilding | Vehicle.Flags.LeftHandDrive;
                            this.SetTarget(vehicleID, ref vehicleData, targetBuilding);
                            return((vehicleData.m_flags & Vehicle.Flags.Spawned) == ~(Vehicle.Flags.Created | Vehicle.Flags.Deleted | Vehicle.Flags.Spawned | Vehicle.Flags.Inverted | Vehicle.Flags.TransferToTarget | Vehicle.Flags.TransferToSource | Vehicle.Flags.Emergency1 | Vehicle.Flags.Emergency2 | Vehicle.Flags.WaitingPath | Vehicle.Flags.Stopped | Vehicle.Flags.Leaving | Vehicle.Flags.Arriving | Vehicle.Flags.Reversed | Vehicle.Flags.TakingOff | Vehicle.Flags.Flying | Vehicle.Flags.Landing | Vehicle.Flags.WaitingSpace | Vehicle.Flags.WaitingCargo | Vehicle.Flags.GoingBack | Vehicle.Flags.WaitingTarget | Vehicle.Flags.Importing | Vehicle.Flags.Exporting | Vehicle.Flags.Parking | Vehicle.Flags.CustomName | Vehicle.Flags.OnGravel | Vehicle.Flags.WaitingLoading | Vehicle.Flags.Congestion | Vehicle.Flags.DummyTraffic | Vehicle.Flags.Underground | Vehicle.Flags.Transition | Vehicle.Flags.InsideBuilding | Vehicle.Flags.LeftHandDrive));
                        }
                    }
                }
                Singleton <VehicleManager> .instance.ReleaseVehicle(vehicleID);

                return(true);
            }
            return((vehicleData.m_flags & Vehicle.Flags.GoingBack) != ~(Vehicle.Flags.Created | Vehicle.Flags.Deleted | Vehicle.Flags.Spawned | Vehicle.Flags.Inverted | Vehicle.Flags.TransferToTarget | Vehicle.Flags.TransferToSource | Vehicle.Flags.Emergency1 | Vehicle.Flags.Emergency2 | Vehicle.Flags.WaitingPath | Vehicle.Flags.Stopped | Vehicle.Flags.Leaving | Vehicle.Flags.Arriving | Vehicle.Flags.Reversed | Vehicle.Flags.TakingOff | Vehicle.Flags.Flying | Vehicle.Flags.Landing | Vehicle.Flags.WaitingSpace | Vehicle.Flags.WaitingCargo | Vehicle.Flags.GoingBack | Vehicle.Flags.WaitingTarget | Vehicle.Flags.Importing | Vehicle.Flags.Exporting | Vehicle.Flags.Parking | Vehicle.Flags.CustomName | Vehicle.Flags.OnGravel | Vehicle.Flags.WaitingLoading | Vehicle.Flags.Congestion | Vehicle.Flags.DummyTraffic | Vehicle.Flags.Underground | Vehicle.Flags.Transition | Vehicle.Flags.InsideBuilding | Vehicle.Flags.LeftHandDrive) ? this.ArriveAtSource(vehicleID, ref vehicleData) : this.ArriveAtTarget(vehicleID, ref vehicleData));
        }
        public static void CarAIPathfindFailurePostFix(ushort vehicleID, ref Vehicle data)
        {
            ushort i = vehicleID;

            if ((data.m_transferType == 112) || (data.m_transferType == 113))
            {
                if (data.Info.m_vehicleAI is CargoTruckAI && (data.m_targetBuilding != 0))
                {
                    CargoTruckAI AI = (CargoTruckAI)data.Info.m_vehicleAI;
#if DEBUG
                    DebugLog.LogToFileOnly("PathFind not success " + i.ToString() + "transferType = " + vehicle.m_transferType.ToString() + "And MainDataStore.TargetGasBuilding[vehicleID] = " + MainDataStore.TargetGasBuilding[i].ToString() + "data.m_targetBuilding = " + vehicle.m_targetBuilding.ToString());
#endif
                    AI.SetTarget((ushort)i, ref data, data.m_targetBuilding);
#if DEBUG
                    DebugLog.LogToFileOnly("Reroute to target " + i.ToString() + "vehicle.m_path = " + vehicle.m_path.ToString() + vehicle.m_flags.ToString());
#endif
                    data.m_transferType = MainDataStore.preTranferReason[i];
                    MainDataStore.TargetGasBuilding[i] = 0;
                    return;
                }
                else if (data.Info.m_vehicleAI is PassengerCarAI && data.Info.m_class.m_subService == ItemClass.SubService.ResidentialLow)
                {
                    PassengerCarAI AI = (PassengerCarAI)data.Info.m_vehicleAI;
                    AI.SetTarget((ushort)i, ref data, 0);
                    data.m_transferType = MainDataStore.preTranferReason[i];
                    MainDataStore.TargetGasBuilding[i] = 0;
                    return;
                }
            }
        }
 public static bool Prefix(ref CargoTruckAI __instance, ushort vehicleID, ref Vehicle data, ref bool __result)
 {
     if ((data.m_transferType == 127) || (data.m_transferType == 126))
     {
         if (!MainDataStore.alreadyPaidForFuel[vehicleID])
         {
             CargoTruckAIArriveAtSourceForRealGasStationPre(ref __instance, vehicleID, ref data);
             MainDataStore.alreadyPaidForFuel[vehicleID] = true;
         }
         else
         {
             DebugLog.LogToFileOnly("Vehicle is been paid for fuel");
             if (MainDataStore.finalVehicleForFuelCount[MainDataStore.TargetGasBuilding[vehicleID]] > 0)
             {
                 MainDataStore.finalVehicleForFuelCount[MainDataStore.TargetGasBuilding[vehicleID]]--;
             }
             data.m_transferType = MainDataStore.preTranferReason[vehicleID];
             MainDataStore.TargetGasBuilding[vehicleID] = 0;
             data.Unspawn(vehicleID);
         }
         __result = true;
         return(false);
     }
     return(true);
 }
Пример #5
0
        public static void Prefix(ref CargoTruckAI __instance, ref Vehicle data)
        {
            int transferSize = 0;

            if ((data.m_flags & Vehicle.Flags.TransferToTarget) != 0)
            {
                transferSize = data.m_transferSize;
            }
            if ((data.m_flags & Vehicle.Flags.TransferToSource) != 0)
            {
                transferSize = Mathf.Min(0, data.m_transferSize - __instance.m_cargoCapacity);
            }
            // NON-STOCK CODE START
            ProcessResourceArriveAtTarget(ref data, ref transferSize);
        }
        public static void CargoTruckAIArriveAtSourceForRealGasStationPre(ref CargoTruckAI __instance, ushort vehicleID, ref Vehicle data)
        {
            var distance = Vector3.Distance(data.GetLastFramePosition(), Singleton <BuildingManager> .instance.m_buildings.m_buffer[MainDataStore.TargetGasBuilding[vehicleID]].m_position);

            if (distance < 80f)
            {
                if (MainDataStore.petrolBuffer[MainDataStore.TargetGasBuilding[vehicleID]] > 400)
                {
                    MainDataStore.petrolBuffer[MainDataStore.TargetGasBuilding[vehicleID]] -= 400;
                }
            }
            data.m_transferType = MainDataStore.preTranferReason[vehicleID];
            PathManager instance = Singleton <PathManager> .instance;

            if (data.m_path != 0u)
            {
                instance.ReleasePath(data.m_path);
                data.m_path = 0;
            }
            __instance.SetTarget(vehicleID, ref data, data.m_targetBuilding);
            if (MainDataStore.finalVehicleForFuelCount[MainDataStore.TargetGasBuilding[vehicleID]] > 0)
            {
                MainDataStore.finalVehicleForFuelCount[MainDataStore.TargetGasBuilding[vehicleID]]--;
            }
            MainDataStore.TargetGasBuilding[vehicleID] = 0;

            if (distance < 80f)
            {
                if (Loader.isRealCityRunning)
                {
                    int money = (int)(400f * RealCityUtil.GetResourcePrice(TransferManager.TransferReason.Petrol) + 1000);
                    if (data.m_flags.IsFlagSet(Vehicle.Flags.DummyTraffic))
                    {
                        Singleton <EconomyManager> .instance.AddResource(EconomyManager.Resource.PublicIncome, money, ItemClass.Service.Vehicles, ItemClass.SubService.PlayerIndustryOil, ItemClass.Level.Level2);
                    }
                    else
                    {
                        Singleton <EconomyManager> .instance.AddResource(EconomyManager.Resource.PublicIncome, money, ItemClass.Service.Vehicles, ItemClass.SubService.None, ItemClass.Level.Level2);
                    }
                }
            }
        }
 public static bool Prefix(ref CargoTruckAI __instance, ushort vehicleID, ref Vehicle data, ushort targetBuilding)
 {
     if ((data.m_transferType == 127) || (data.m_transferType == 126))
     {
         data.m_targetBuilding = targetBuilding;
         if (!CustomCargoTruckAI.CustomStartPathFind(vehicleID, ref data))
         {
             data.m_transferType   = MainDataStore.preTranferReason[vehicleID];
             data.m_targetBuilding = 0;
             __instance.SetTarget(vehicleID, ref data, 0);
             if (MainDataStore.finalVehicleForFuelCount[MainDataStore.TargetGasBuilding[vehicleID]] > 0)
             {
                 MainDataStore.finalVehicleForFuelCount[MainDataStore.TargetGasBuilding[vehicleID]]--;
             }
             MainDataStore.TargetGasBuilding[vehicleID] = 0;
             data.Unspawn(vehicleID);
         }
         return(false);
     }
     return(true);
 }
Пример #8
0
        public static void CargoTruckAISetSourceForRealConstruction(ushort vehicleID, ref Vehicle data, ushort sourceBuilding)
        {
            CargoTruckAI AI  = data.Info.m_vehicleAI as CargoTruckAI;
            int          num = Mathf.Min(0, (int)data.m_transferSize - AI.m_cargoCapacity);

            //new added begin
            if (ResourceBuildingAI.IsSpecialBuilding(sourceBuilding))
            {
                if ((TransferManager.TransferReason)data.m_transferType == (TransferManager.TransferReason) 124)
                {
                    MainDataStore.constructionResourceBuffer[sourceBuilding] -= 8000;
                }
                else if ((TransferManager.TransferReason)data.m_transferType == (TransferManager.TransferReason) 125)
                {
                    MainDataStore.operationResourceBuffer[sourceBuilding] -= 8000;
                }
                else
                {
                    DebugLog.LogToFileOnly("find unknow transfor for SpecialBuilding " + data.m_transferType.ToString());
                }
            }
        }
        public static void StartSpecialBuildingTransfer(ushort buildingID, ref Building data, TransferManager.TransferReason material, TransferManager.TransferOffer offer)
        {
            VehicleInfo vehicleInfo = null;

            if (material == (TransferManager.TransferReason) 124)
            {
                vehicleInfo = Singleton <VehicleManager> .instance.GetRandomVehicleInfo(ref Singleton <SimulationManager> .instance.m_randomizer, ItemClass.Service.Industrial, ItemClass.SubService.IndustrialForestry, ItemClass.Level.Level1);
            }
            else if (material == (TransferManager.TransferReason) 125)
            {
                vehicleInfo = Singleton <VehicleManager> .instance.GetRandomVehicleInfo(ref Singleton <SimulationManager> .instance.m_randomizer, ItemClass.Service.Industrial, ItemClass.SubService.IndustrialFarming, ItemClass.Level.Level1);
            }


            if (vehicleInfo != null)
            {
                Array16 <Vehicle> vehicles = Singleton <VehicleManager> .instance.m_vehicles;
                if (Singleton <VehicleManager> .instance.CreateVehicle(out ushort vehicleID, ref Singleton <SimulationManager> .instance.m_randomizer, vehicleInfo, data.m_position, material, false, true))
                {
                    vehicleInfo.m_vehicleAI.SetSource(vehicleID, ref vehicles.m_buffer[vehicleID], buildingID);
                    if (vehicleInfo.m_vehicleAI is CargoTruckAI)
                    {
                        CargoTruckAI AI = vehicleInfo.m_vehicleAI as CargoTruckAI;
                        CustomCargoTruckAI.CargoTruckAISetSourceForRealConstruction(vehicleID, ref vehicles.m_buffer[vehicleID], buildingID);
                        vehicles.m_buffer[(int)vehicleID].m_transferSize = (ushort)AI.m_cargoCapacity;
                    }
                    else
                    {
                        DebugLog.LogToFileOnly("Error: vehicleInfo is not cargoTruckAI " + vehicleInfo.m_vehicleAI.ToString());
                    }
                    vehicleInfo.m_vehicleAI.StartTransfer(vehicleID, ref vehicles.m_buffer[vehicleID], material, offer);
                    ushort building4 = offer.Building;
                    if (building4 != 0)
                    {
                        vehicleInfo.m_vehicleAI.GetSize(vehicleID, ref vehicles.m_buffer[vehicleID], out int _, out int _);
                    }
                }
            }
        }
 public static bool Prefix(ref CargoTruckAI __instance, ushort vehicleID, ref Vehicle data, ushort targetBuilding)
 {
     if ((data.m_transferType == 127) || (data.m_transferType == 126))
     {
         if (targetBuilding == data.m_targetBuilding)
         {
             return(true);
         }
         else
         {
             data.m_flags      &= ~Vehicle.Flags.WaitingTarget;
             data.m_waitCounter = 0;
             ushort tempTargetBuilding = data.m_targetBuilding;
             data.m_targetBuilding = MainDataStore.TargetGasBuilding[vehicleID];
             bool success = CustomCargoTruckAI.CustomStartPathFind(vehicleID, ref data);
             data.m_targetBuilding = tempTargetBuilding;
             if (!success)
             {
                 data.m_transferType = MainDataStore.preTranferReason[vehicleID];
                 PathManager instance = Singleton <PathManager> .instance;
                 if (data.m_path != 0u)
                 {
                     instance.ReleasePath(data.m_path);
                     data.m_path = 0;
                 }
                 __instance.SetTarget(vehicleID, ref data, data.m_targetBuilding);
                 if (MainDataStore.finalVehicleForFuelCount[MainDataStore.TargetGasBuilding[vehicleID]] > 0)
                 {
                     MainDataStore.finalVehicleForFuelCount[MainDataStore.TargetGasBuilding[vehicleID]]--;
                 }
                 MainDataStore.TargetGasBuilding[vehicleID] = 0;
             }
             return(false);
         }
     }
     return(true);
 }
 public static void StartGasTransfer(ushort vehicleID, ref Vehicle data, TransferManager.TransferReason material, TransferManager.TransferOffer offer)
 {
     if ((material == (TransferManager.TransferReason) 113) || (material == (TransferManager.TransferReason) 112))
     {
         if (data.Info.m_vehicleAI is CargoTruckAI)
         {
             CargoTruckAI AI = (CargoTruckAI)data.Info.m_vehicleAI;
             MainDataStore.preTranferReason[vehicleID]  = data.m_transferType;
             MainDataStore.TargetGasBuilding[vehicleID] = offer.Building;
             data.m_transferType = 113;
             if (offer.Building == data.m_targetBuilding)
             {
                 DebugLog.LogToFileOnly("Error: Transfer fuel cargotruck do not need fuel");
             }
             if (data.m_flags.IsFlagSet(Vehicle.Flags.Created) && !data.m_flags.IsFlagSet(Vehicle.Flags.Deleted) && !data.m_flags.IsFlagSet(Vehicle.Flags.Arriving) && (data.m_cargoParent == 0) && data.m_flags.IsFlagSet(Vehicle.Flags.Spawned) && !data.m_flags.IsFlagSet(Vehicle.Flags.GoingBack) && data.m_targetBuilding != 0 && !data.m_flags.IsFlagSet(Vehicle.Flags.Parking))
             {
                 if ((Vector3.Distance(data.GetLastFramePosition(), Singleton <BuildingManager> .instance.m_buildings.m_buffer[data.m_targetBuilding].m_position) > CanNotStartGasTransferDistance) && (FindCargoStation(data.GetLastFramePosition(), ItemClass.Service.PublicTransport, ItemClass.SubService.PublicTransportShip) == 0) && (FindCargoStation(data.GetLastFramePosition(), ItemClass.Service.PublicTransport, ItemClass.SubService.PublicTransportPlane) == 0) && (FindCargoStation(data.GetLastFramePosition(), ItemClass.Service.PublicTransport, ItemClass.SubService.PublicTransportTrain) == 0))
                 {
                     AI.SetTarget(vehicleID, ref data, offer.Building);
                 }
                 //else
                 //{
                 //DebugLog.LogToFileOnly("Info: Cargo is near target position, do not go to gas station now.");
                 //}
             }
             //else
             //{
             //    DebugLog.LogToFileOnly("Warning: Not a valid CargoTruckAI");
             //}
         }
         else if (data.Info.m_vehicleAI is PassengerCarAI)
         {
             PassengerCarAI AI = (PassengerCarAI)data.Info.m_vehicleAI;
             MainDataStore.preTranferReason[vehicleID] = data.m_transferType;
             if (data.m_targetBuilding == 0)
             {
                 MainDataStore.TargetGasBuilding[vehicleID] = offer.Building;
                 data.m_transferType = 112;
                 if (data.m_flags.IsFlagSet(Vehicle.Flags.Created) && !data.m_flags.IsFlagSet(Vehicle.Flags.Deleted) && !data.m_flags.IsFlagSet(Vehicle.Flags.Arriving) && (data.m_cargoParent == 0) && data.m_flags.IsFlagSet(Vehicle.Flags.Spawned) && !data.m_flags.IsFlagSet(Vehicle.Flags.GoingBack) && !data.m_flags.IsFlagSet(Vehicle.Flags.Parking))
                 {
                     ushort citizen = CustomCarAI.GetDriverInstance(vehicleID, ref data);
                     if (Singleton <CitizenManager> .instance.m_instances.m_buffer[citizen].m_targetBuilding != 0)
                     {
                         if ((Vector3.Distance(data.GetLastFramePosition(), Singleton <BuildingManager> .instance.m_buildings.m_buffer[Singleton <CitizenManager> .instance.m_instances.m_buffer[citizen].m_targetBuilding].m_position) > CanNotStartGasTransferDistance) && (FindCargoStation(data.GetLastFramePosition(), ItemClass.Service.PublicTransport, ItemClass.SubService.PublicTransportShip) == 0) && (FindCargoStation(data.GetLastFramePosition(), ItemClass.Service.PublicTransport, ItemClass.SubService.PublicTransportPlane) == 0) && (FindCargoStation(data.GetLastFramePosition(), ItemClass.Service.PublicTransport, ItemClass.SubService.PublicTransportTrain) == 0))
                         {
                             AI.SetTarget(vehicleID, ref data, offer.Building);
                         }
                         //else
                         //{
                         //DebugLog.LogToFileOnly("Info: PassengerCar is near target position, do not go to gas station now.");
                         //}
                     }
                     //else
                     //{
                     //    DebugLog.LogToFileOnly("Warning: No targetBuilding for citizen");
                     //}
                 }
                 //else
                 //{
                 //    DebugLog.LogToFileOnly("Warning: Not a valid PassengerCarAI");
                 //}
             }
             //else
             //{
             //    DebugLog.LogToFileOnly("Error: PassengerCarAI should not have targetBuilding");
             //}
         }
     }
 }