Skip to content

Commit 2384906

Browse files
finally fix priority crashes
1 parent 486ed32 commit 2384906

File tree

7 files changed

+1
-6
lines changed

7 files changed

+1
-6
lines changed

Assemblies/Fluffy_Tabs.dll

3.5 KB
Binary file not shown.
14.5 KB
Binary file not shown.

Source/Fluffy_Tabs/Work/Detours_WorkSettings.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,19 @@ public class Detours_WorkSettings : Pawn_WorkSettings
3333
public int _GetPriority( WorkTypeDef w )
3434
{
3535
Pawn pawn = pawnField.GetValue( this ) as Pawn;
36+
3637
return pawn.Priorities()?.GetPriority( w ) ?? 0; // return 0 if no tracker was found
3738
}
3839

3940
/// <summary>
4041
/// This detours the vanilla SetPriority method to the Work Tabs priorities, thus ensuring that rogue vanilla or modded code is applied to this mod's priorities.
41-
///
42-
/// NOTE: These priorities are NOT kept around in the vanilla tracker, so after disabling this mod you may run into some issues. (looking at you, craftable robots).
4342
/// </summary>
4443
/// <param name="w"></param>
4544
/// <param name="priority"></param>
4645
public void _SetPriority( WorkTypeDef w, int priority )
4746
{
4847
Pawn pawn = pawnField.GetValue( this ) as Pawn;
4948

50-
5149
// set priority in work tab's priority list
5250
if (pawn.Priorities() != null)
5351
pawn.Priorities().SetPriority( w, priority );
@@ -70,9 +68,6 @@ internal static void SetVanillaPriority( Pawn pawn, WorkTypeDef workTypeDef, int
7068

7169
// update
7270
priorities[workTypeDef] = priority;
73-
74-
// write back TODO: figure out if this is needed, or if we're modifying by reference (which I suspect is the case).
75-
prioritiesField.SetValue( pawn, priorities );
7671
}
7772

7873
internal static DefMap<WorkTypeDef, int> GetVanillaPriorities( Pawn pawn )
Binary file not shown.
-6.5 KB
Binary file not shown.
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)