Skip to content

Commit 40db5a2

Browse files
authored
Fixed an errror that occurred when attempting to set out on a caravan while out of fuel (#336)
* Fixed an errror that occurred when attempting to set out on a caravan while out of fuel * Added draft check within LoadToilTick to LordToil_PrepareCaravan_LeaveWithVehicles
1 parent 3579ff3 commit 40db5a2

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

Source/Vehicles/AI/JobGivers/JobGiver_GotoTravelDestinationVehicle.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Vehicles;
1111
public class JobGiver_GotoTravelDestinationVehicle : JobGiver_GotoTravelDestination
1212
{
1313
// Amble = Raiders + Vehicle Formations
14-
// Walk =
14+
// Walk =
1515
// Jog = Normal Speed
1616
// Sprint = Speed Away (escaping raiders?)
1717

@@ -34,6 +34,10 @@ protected override Job TryGiveJob(Pawn pawn)
3434
{
3535
return null;
3636
}
37+
if (!vehicle.Drafted)
38+
{
39+
return null;
40+
}
3741
Job job = new(JobDefOf.Goto, cell)
3842
{
3943
locomotionUrgency = LocomotionUrgency.Jog,

Source/Vehicles/AI/Lords/Caravan/LordToil_PrepareCaravan_LeaveWithVehicles.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ public override void LordToilTick()
6868
{
6969
if (Find.TickManager.TicksGame % 100 == 0)
7070
{
71+
foreach (Pawn pawn in lord.ownedPawns)
72+
{
73+
if (pawn is not VehiclePawn vehicle)
74+
{
75+
continue;
76+
}
77+
vehicle.ignition.Drafted = true;
78+
}
7179
ExitMapUtility.CheckArrived(lord, lord.ownedPawns, exitSpot, MemoTrigger.ExitMap,
7280
CheckPawnArrived, PawnCanMove);
7381
}

0 commit comments

Comments
 (0)