Skip to content
This repository has been archived by the owner on Jul 8, 2023. It is now read-only.

Commit

Permalink
don't spawn inbound jobs
Browse files Browse the repository at this point in the history
keeps inbound tracks clear for spawning outbound jobs from other stations
  • Loading branch information
fauxnik committed Jul 3, 2020
1 parent be88905 commit 62b8bcf
Showing 1 changed file with 5 additions and 40 deletions.
45 changes: 5 additions & 40 deletions PersistentJobsMod/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -368,49 +368,14 @@ static void Postfix(StationProceduralJobsController __instance)
[HarmonyPatch(typeof(StationProceduralJobGenerator), "GenerateInChainJob")]
class StationProceduralJobGenerator_GenerateInChainJob_Patch
{
static bool Prefix(
ref JobChainController __result,
StationController ___stationController,
JobType startingJobType,
bool forceFulfilledLicenseRequirements = false)
static bool Prefix(ref JobChainController __result)
{
if (thisModEntry.Active)
{
try
{
if (startingJobType == JobType.ShuntingUnload)
{
Debug.Log("[PersistentJobs] gen in shunting unload");
__result = ShuntingUnloadJobProceduralGenerator.GenerateShuntingUnloadJobWithCarSpawning(
___stationController,
forceFulfilledLicenseRequirements,
new System.Random(Environment.TickCount));
if (__result != null)
{
Debug.Log("[PersistentJobs] finalize in shunting unload");
__result.FinalizeSetupAndGenerateFirstJob();
}
return false;
}
Debug.LogWarning(string.Format(
"[PersistentJobs] Got unexpected JobType.{0} in {1}.{2} {3} patch. Falling back to base method.",
startingJobType.ToString(),
"StationProceduralJobGenerator",
"GenerateInChainJob",
"prefix"
));
}
catch (Exception e)
{
thisModEntry.Logger.Error(string.Format(
"Exception thrown during {0}.{1} {2} patch:\n{3}",
"StationProceduralJobGenerator",
"GenerateInChainJob",
"prefix",
e.ToString()
));
OnCriticalFailure();
}
Debug.Log("[PersistentJobs] cancelling inbound job spawning" +
" to keep tracks clear for outbound jobs from other stations");
__result = null;
return false;
}
return true;
}
Expand Down

0 comments on commit 62b8bcf

Please sign in to comment.