public static void DequeueVehicle(ushort lineID) { if (TransportLineMod._lineData[(int)lineID].QueuedVehicles == null) { return; } TransportLineMod.DecreaseTargetVehicleCount(lineID); TransportLineMod.Dequeue(lineID); }
//based off code in the SimulationStep public static void RemoveVehicle(ushort lineID, ushort vehicleID, bool descreaseTargetVehicleCount) { VehicleManager instance = Singleton <VehicleManager> .instance; if ((instance.m_vehicles.m_buffer[(int)vehicleID].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)) { if (descreaseTargetVehicleCount) { TransportLineMod.DecreaseTargetVehicleCount(lineID); } instance.m_vehicles.m_buffer[(int)vehicleID].Info.m_vehicleAI.SetTransportLine(vehicleID, ref instance.m_vehicles.m_buffer[(int)vehicleID], (ushort)0); } }
public static void DequeueVehicles(ushort lineID, int[] indexes, bool descreaseVehicleCount = true) { lock (TransportLineMod._lineData[(int)lineID].QueuedVehicles) { List <string> stringList = new List <string>( (IEnumerable <string>)TransportLineMod._lineData[(int)lineID].QueuedVehicles); for (int index = indexes.Length - 1; index >= 0; --index) { stringList.RemoveAt(indexes[index]); if (descreaseVehicleCount) { TransportLineMod.DecreaseTargetVehicleCount(lineID); } } TransportLineMod._lineData[(int)lineID].QueuedVehicles = new Queue <string>((IEnumerable <string>)stringList); } }