Skip to content

Commit 144abd4

Browse files
we're now up to paranoid levels of checking priorities
Added a check on the retrieval side, resetting to zero if an invalid priority was found. Also added some logging to hopefully find the real culprit.
1 parent 4c00781 commit 144abd4

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Assemblies/Fluffy_Tabs.dll

512 Bytes
Binary file not shown.

Source/Fluffy_Tabs/Work/PawnPrioritiesTracker.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,17 @@ public int GetPriority( WorkGiverDef workgiver, int hour )
8888
{
8989
try
9090
{
91-
return Find.PlaySettings.useWorkPriorities ? priorities[hour][workgiver] : priorities[hour][workgiver] > 0 ? 1 : 0;
91+
var priority = Find.PlaySettings.useWorkPriorities ? priorities[hour][workgiver] : priorities[hour][workgiver] > 0 ? 1 : 0;
92+
if ( !pawn.CapableOf( workgiver ) && priority > 0 )
93+
{
94+
// log it
95+
Log.Error( $"Found priority {priority} for a pawn incapable of {workgiver.defName}. Did you add/change mods without starting a new game?" );
96+
97+
// force priority back to 0.
98+
priority = 0;
99+
SetPriority( workgiver, 0, hour );
100+
}
101+
return priority;
92102
}
93103
catch ( ArgumentOutOfRangeException )
94104
{

0 commit comments

Comments
 (0)