public static void DequeueVehicle(ushort lineID) { if (TransportLineMod._lineData[(int)lineID].QueuedVehicles == null) { return; } TransportLineMod.DecreaseTargetVehicleCount(lineID); TransportLineMod.Dequeue(lineID); }
private static void HandleVehicleSpawn(ushort lineID, TransportInfo info, int targetVehicleCount, int activeVehicleCount, TransferManager.TransferOffer offer) { var itemClass = info.m_class; if ((double)SimHelper.SimulationTime >= (double)TransportLineMod._lineData[(int)lineID].NextSpawnTime || itemClass.m_service == ItemClass.Service.Disaster) { ushort depot = TransportLineMod._lineData[(int)lineID].Depot; if (TransportLineMod.ValidateDepot(lineID, ref depot, info)) { BuildingManager instance2 = Singleton <BuildingManager> .instance; if (TransportLineMod.CanAddVehicle(depot, ref instance2.m_buildings.m_buffer[(int)depot], info)) { string prefabName; if (TransportLineMod.EnqueuedVehiclesCount(lineID) > 0) { prefabName = TransportLineMod.Dequeue(lineID); } else { int diffToTarget = targetVehicleCount - activeVehicleCount; for (int index2 = 0; index2 < diffToTarget; ++index2) { TransportLineMod.EnqueueVehicle(lineID, TransportLineMod.GetRandomPrefab(lineID), false); } prefabName = TransportLineMod.Dequeue(lineID); } if (prefabName == "") { instance2.m_buildings.m_buffer[(int)depot] .Info.m_buildingAI .StartTransfer(depot, ref instance2.m_buildings.m_buffer[(int)depot], info.m_vehicleReason, offer); } else { DepotAIMod.StartTransfer(depot, ref instance2.m_buildings.m_buffer[(int)depot], info.m_vehicleReason, offer, prefabName); } TransportLineMod._lineData[(int)lineID].NextSpawnTime = SimHelper.SimulationTime + (float)OptionsWrapper <Settings> .Options.SpawnTimeInterval; } else { TransportLineMod.ClearEnqueuedVehicles(lineID); } } else { TransportLineMod.ClearEnqueuedVehicles(lineID); } } }