private static void CreatePlatformSigns(string trackId, PlatformController controller) { if (SignLoadFailed) { return; } if (!SignLoadAttempted && !TryLoadSignPrefabs()) { return; // failed to load } if (SignLocations.TryGetValue(trackId, out List <SignDefinition> signList)) { foreach (SignDefinition sign in signList) { GameObject proto; switch (sign.SignType) { case StationSignType.Small: proto = SmallSignPrefab; break; case StationSignType.Lillys: proto = LillySignPrefab; break; default: case StationSignType.Flatscreen: proto = SignPrefab; break; } Vector3 relativePos = sign.Position + WorldMover.currentMove; var newObj = GameObject.Instantiate(proto, relativePos, sign.Rotation); if (newObj != null) { SingletonBehaviour <WorldMover> .Instance.AddObjectToMove(newObj.transform); controller.AddSign(newObj, sign.SignType); PassengerJobs.ModEntry.Logger.Log($"Created sign {sign.SignType} at {trackId}"); } else { PassengerJobs.ModEntry.Logger.Warning($"Failed to create sign {sign.SignType} at {trackId}"); } } } }
protected override void GenerateJob(Station jobOriginStation, float jobTimeLimit = 0, float initialWage = 0, string forcedJobId = null, JobLicenses requiredLicenses = JobLicenses.Basic) { if ((trainCarsToTransport == null) || (trainCarsToTransport.Count == 0) || (startingTrack == null) || (destinationTrack == null)) { trainCarsToTransport = null; startingTrack = null; destinationTrack = null; return; } // Get total cargo capacity float totalCapacity = 0; foreach (var car in trainCarsToTransport) { //car.DumpCargo(); totalCapacity += car.capacity; } Track departTrack = startingTrack; Track arriveTrack = destinationTrack; var taskList = new List <Task>(); // Check for loading task PlatformController loadPlatform = null; if (loadMachine != null) { departTrack = loadMachine.WarehouseTrack; Task stageCarsTask = JobsGenerator.CreateTransportTask(trainCarsToTransport, departTrack, startingTrack); taskList.Add(stageCarsTask); Task loadTask = new WarehouseTask(trainCarsToTransport, WarehouseTaskType.Loading, loadMachine, CargoType.Passengers, totalCapacity); taskList.Add(loadTask); // check to register for unloading display if ((PlatformManager.GetPlatformByTrackId(loadMachine.WarehouseTrack.ID.FullID) is PlatformDefinition pdef) && pdef.Initialized) { loadPlatform = pdef.Controller; } } else { foreach (var car in trainCarsToTransport) { car.LoadCargo(car.capacity, CargoType.Passengers); } } if (unloadMachine != null) { arriveTrack = unloadMachine.WarehouseTrack; } // actual move between stations Task transportTask = JobsGenerator.CreateTransportTask( trainCarsToTransport, arriveTrack, departTrack, Enumerable.Repeat(CargoType.Passengers, trainCarsToTransport.Count).ToList()); taskList.Add(transportTask); // check for unloading task PlatformController unloadPlatform = null; if (unloadMachine != null) { Task unloadTask = new WarehouseTask(trainCarsToTransport, WarehouseTaskType.Unloading, unloadMachine, CargoType.Passengers, totalCapacity); taskList.Add(unloadTask); Task storeCarsTask = JobsGenerator.CreateTransportTask(trainCarsToTransport, destinationTrack, arriveTrack); taskList.Add(storeCarsTask); // check to register for unloading display if ((PlatformManager.GetPlatformByTrackId(unloadMachine.WarehouseTrack.ID.FullID) is PlatformDefinition pdef) && pdef.Initialized) { unloadPlatform = pdef.Controller; } } Task superTask = new SequentialTasks(taskList); // check if we should generate a special job ID if (string.IsNullOrEmpty(forcedJobId) && (specialDefinition != null)) { forcedJobId = IG_GenerateJobId_Patch.GetNamedExpressId(specialDefinition); } job = new Job(superTask, subType, jobTimeLimit, initialWage, chainData, forcedJobId, requiredLicenses); // set up platform displays if (loadPlatform != null) { loadPlatform.AddOutgoingJobToDisplay(job); } if (unloadPlatform != null) { job.JobTaken += unloadPlatform.AddIncomingJobToDisplay; } // track the job if it's a special, for booklet info etc if (specialDefinition != null) { SpecialConsistManager.JobToSpecialMap.Add(job.ID, specialDefinition); } jobOriginStation.AddJobToStation(job); }