Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions Source/Vehicles/AI/JobGivers/JobGiver_AwaitOrders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@ protected override Job TryGiveJob(Pawn pawn)
{
vehicle.vehiclePather.EngageBrakes();
}
Job job = new(JobDefOf_Vehicles.IdleVehicle, vehicle)
{
checkOverrideOnExpire = true,
expiryInterval = overrideExpiryInterval > 0 ? overrideExpiryInterval : 180
};

Job job = JobMaker.MakeJob(JobDefOf_Vehicles.IdleVehicle, vehicle);
job.checkOverrideOnExpire = true;
job.expiryInterval = overrideExpiryInterval > 0 ? overrideExpiryInterval : 180;
return job;
}
}
Expand Down
15 changes: 7 additions & 8 deletions Source/Vehicles/AI/JobGivers/JobGiver_BoardVehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@ protected override Job TryGiveJob(Pawn pawn)
if (!JobDriver_FollowClose.FarEnoughAndPossibleToStartJob(pawn, assignedSeat.Vehicle,
FollowRadius))
return null;
return new Job(JobDefOf.FollowClose, assignedSeat.Vehicle)
{
lord = pawn.GetLord(),
expiryInterval = 140,
checkOverrideOnExpire = true,
followRadius = FollowRadius
};
Job job = JobMaker.MakeJob(JobDefOf.FollowClose, assignedSeat.Vehicle);
job.lord = pawn.GetLord();
job.expiryInterval = 140;
job.checkOverrideOnExpire = true;
job.followRadius = FollowRadius;
Comment thread
SmashPhil marked this conversation as resolved.
return job;
}
return new Job(JobDefOf_Vehicles.Board, assignedSeat.Vehicle);
return JobMaker.MakeJob(JobDefOf_Vehicles.Board, assignedSeat.Vehicle);
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Vehicles;
public class JobGiver_GotoTravelDestinationVehicle : JobGiver_GotoTravelDestination
{
// Amble = Raiders + Vehicle Formations
// Walk =
// Walk =
// Jog = Normal Speed
// Sprint = Speed Away (escaping raiders?)

Expand All @@ -34,11 +34,10 @@ protected override Job TryGiveJob(Pawn pawn)
{
return null;
}
Job job = new(JobDefOf.Goto, cell)
{
locomotionUrgency = LocomotionUrgency.Jog,
expiryInterval = jobMaxDuration
};

Job job = JobMaker.MakeJob(JobDefOf.Goto, cell);
job.locomotionUrgency = LocomotionUrgency.Jog;
job.expiryInterval = jobMaxDuration;
if (vehicle.InhabitedCellsProjected(cell, Rot8.Invalid)
.Any(projCell => pawn.Map.exitMapGrid.IsExitCell(projCell)))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ protected override Job TryGiveJob(Pawn pawn)
if (thing is null)
return null;

return new Job(JobDef, thing)
{
lord = lord
};
}
Job job = JobMaker.MakeJob(JobDef, thing);
job.lord = lord;
return job;
}
}
9 changes: 4 additions & 5 deletions Source/Vehicles/AI/JobGivers/JobGiver_SendSlavesToVehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ protected override Job TryGiveJob(Pawn pawn)
return null;
VehiclePawn vehicle = FindShipToDeposit(pawn, pawn2);
VehicleRoleHandler handler = vehicle.handlers.Find(x => x.role.HandlingTypes == HandlingType.None);
return new Job(JobDefOf.PrepareCaravan_GatherDownedPawns, pawn2)
{
count = 1
};
}
Job job = JobMaker.MakeJob(JobDefOf.PrepareCaravan_GatherDownedPawns, pawn2);
job.count = 1;
return job;
}

private Pawn FindPrisoner(Pawn pawn)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected override Job TryGiveJob(Pawn pawn)
IntVec3 jobCell = vehicle.SurroundingCells.RandomOrFallback(cell =>
resMgr.CanReserve<LocalTargetInfo, VehicleTargetReservation>(vehicle, pawn, cell),
IntVec3.Invalid);
return new Job(JobDefOf_Vehicles.SabotageVehicle, vehicle, jobCell);
return JobMaker.MakeJob(JobDefOf_Vehicles.SabotageVehicle, vehicle, jobCell);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ internal static void PawnGotoAction(IntVec3 clickCell, VehiclePawn vehicle, IntV

if (!IsFeatureEnabled(PathFinderV2))
{
Job job = new(JobDefOf.Goto, gotoLoc);
Job job = JobMaker.MakeJob(JobDefOf.Goto, gotoLoc);
vehicle.jobs.TryTakeOrderedJob(job, JobTag.Misc);
return;
}
Expand Down
6 changes: 2 additions & 4 deletions Source/Vehicles/Components/Vehicles/VehiclePathFollower.cs
Original file line number Diff line number Diff line change
Expand Up @@ -413,10 +413,8 @@ public bool TryOrderMoveTo(in PathOrderData data)
return true;
}

Job job = new(JobDefOf.Goto, new LocalTargetInfo(data.destination))
{
exitMapOnArrival = data.exitMapOnArrival
};
Job job = JobMaker.MakeJob(JobDefOf.Goto, new LocalTargetInfo(data.destination));
job.exitMapOnArrival = data.exitMapOnArrival;
if (vehicle.jobs.TryTakeOrderedJob(job, JobTag.Misc))
{
endRot = data.endRotation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,7 @@ public void PromptToBoardVehicle(Pawn pawn, VehicleRoleHandler handler)
return;
}

Job job = new(JobDefOf_Vehicles.Board, this);
Job job = JobMaker.MakeJob(JobDefOf_Vehicles.Board, this);
GiveLoadJob(pawn, handler);
pawn.jobs.TryTakeOrderedJob(job, JobTag.DraftedOrder);
if (!pawn.Spawned)
Expand Down
2 changes: 1 addition & 1 deletion Source/Vehicles/Comps/FueledTravel/CompFueledTravel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ public override IEnumerable<FloatMenuOption> CompFloatMenuOptions(Pawn selPawn)
yield return new FloatMenuOption("Refuel".Translate().ToString(),
delegate
{
Job job = new(JobDefOf_Vehicles.RefuelVehicle, parent, ClosestFuelAvailable(selPawn));
Job job = JobMaker.MakeJob(JobDefOf_Vehicles.RefuelVehicle, parent, ClosestFuelAvailable(selPawn));
selPawn.jobs.TryTakeOrderedJob(job, JobTag.DraftedOrder);
});
}
Expand Down
6 changes: 3 additions & 3 deletions Source/Vehicles/Comps/Turrets/CompVehicleTurrets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ private void RecacheGizmos()
{
toggleAction = delegate
{
Vehicle.jobs.StartJob(new Job(JobDefOf_Vehicles.DeployVehicle, targetA: Vehicle),
Vehicle.jobs.StartJob(JobMaker.MakeJob(JobDefOf_Vehicles.DeployVehicle, targetA: Vehicle),
JobCondition.InterruptForced);
deployTicks = DeployTicks;
},
Expand Down Expand Up @@ -750,7 +750,7 @@ public void RevalidateTurrets()

private void ResolveAllTurretChildren()
{
// Break all connections, then reassign. Out of sequence parent and renderer registration can result in child
// Break all connections, then reassign. Out of sequence parent and renderer registration can result in child
// turrets being registered as renderers, even though they're drawn by their parents.
foreach (VehicleTurret turret in turrets)
{
Expand Down Expand Up @@ -1077,7 +1077,7 @@ public void ExposeData()
}

/// <summary>
/// Used for serializing turret quotas of turrets that were removed,
/// Used for serializing turret quotas of turrets that were removed,
/// such that they will reload the quota if re-added
/// </summary>
[UsedImplicitly]
Expand Down
8 changes: 6 additions & 2 deletions Source/Vehicles/Harmony/Patches/Patch_JobSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static bool VehicleErrorRecoverJob(Pawn pawn, string message, Exception e
}
else
{
pawn.jobs.StartJob(new Job(JobDefOf_Vehicles.IdleVehicle, -1),
pawn.jobs.StartJob(JobMaker.MakeJob(JobDefOf_Vehicles.IdleVehicle, -1),
JobCondition.Incompletable);
}
startingErrorRecoverJob = false;
Expand All @@ -108,7 +108,11 @@ public static bool VehiclesDontWander(Pawn pawn, ref Job __result)
{
if (pawn is VehiclePawn)
{
__result = new Job(JobDefOf_Vehicles.IdleVehicle);
if (__result is not null)
{
JobMaker.ReturnToPool(__result);
}
__result = JobMaker.MakeJob(JobDefOf_Vehicles.IdleVehicle);
return false;
}
return true;
Expand Down