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
8 changes: 8 additions & 0 deletions Defs/PawnColumnDefs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
<headerIconSize>(16,16)</headerIconSize>
</PawnColumnDef>

<PawnColumnDef>
<defName>JobText</defName>
<workerClass>WorkTab.PawnColumnWorker_JobText</workerClass>
<sortable>true</sortable>
<label>Current job</label>
<headerTip>Current job</headerTip>
</PawnColumnDef>

<PawnColumnDef>
<defName>CopyPasteDetailedWorkPriorities</defName>
<workerClass>WorkTab.PawnColumnWorker_CopyPasteDetailedWorkPriorities</workerClass>
Expand Down
2 changes: 2 additions & 0 deletions Languages/English/Keyed/Keyed-English.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
<WorkTab.PlayCrunchTip>Play a crunchy sound when a pawn is assigned to a job they are not skilled at?</WorkTab.PlayCrunchTip>
<WorkTab.DisableScrollwheel>Disable Scrollwheel</WorkTab.DisableScrollwheel>
<WorkTab.DisableScrollwheelTip>Disable the scrollwheel functions (when hovering over skills)</WorkTab.DisableScrollwheelTip>
<WorkTab.JobTextMode>Current job column as text (requires restart)</WorkTab.JobTextMode>
<WorkTab.JobTextModeTip>Render the current job column as a text column with the whole job, instead of just an icon.\n\n(Due to a technical limitation, you must restart the game after enabling this option.)</WorkTab.JobTextModeTip>
<WorkTab.VerticalLabels>Vertical labels</WorkTab.VerticalLabels>
<WorkTab.VerticalLabelsTip>Display work labels vertically</WorkTab.VerticalLabelsTip>
<WorkTab.FontFix>Fix vertical fonts</WorkTab.FontFix>
Expand Down
1 change: 1 addition & 0 deletions Source/Core/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public static class Constants {
public const float MinTimeBarLabelSpacing = 50f;
public const int TimeBarHeight = 40;
public const int VerticalHeaderHeight = 100;
public const int JobTextWidth = 150;
public const int WorkGiverBoxSize = 20;
public const int WorkGiverWidth = 25;
public const int WorkTypeBoxSize = 25;
Expand Down
4 changes: 4 additions & 0 deletions Source/Core/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace WorkTab {
public class Settings: ModSettings {
public static int defaultPriority = 3;
public static bool disableScrollwheel;
public static bool jobTextMode = false;
public static int maxPriority = 9;
public static bool playCrunch = true;
public static bool playSounds = true;
Expand Down Expand Up @@ -51,6 +52,8 @@ public static void DoWindowContents(Rect rect) {
"WorkTab.PlayCrunchTip".Translate());
options.CheckboxLabeled("WorkTab.DisableScrollwheel".Translate(), ref disableScrollwheel,
"WorkTab.DisableScrollwheelTip".Translate());
options.CheckboxLabeled("WorkTab.JobTextMode".Translate(), ref jobTextMode,
"WorkTab.JobTextModeTip".Translate());
bool verticalLabelsBuffer = verticalLabels;
options.CheckboxLabeled("WorkTab.VerticalLabels".Translate(), ref verticalLabelsBuffer,
"WorkTab.VerticalLabelsTip".Translate());
Expand Down Expand Up @@ -86,6 +89,7 @@ public override void ExposeData() {
Scribe_Values.Look(ref playSounds, "PlaySounds", true);
Scribe_Values.Look(ref playCrunch, "PlayCrunch", true);
Scribe_Values.Look(ref disableScrollwheel, "DisableScrollwheel");
Scribe_Values.Look(ref jobTextMode, "JobTextMode");
Scribe_Values.Look(ref verticalLabels, "VerticalLabels", true);
Scribe_Values.Look(ref _fontFix, "FontFix", true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ private static void Postfix() {
// insert mood and job columns before first work column name
int firstWorkindex =
workTable.columns.FindIndex(d => d.workerClass == typeof(PawnColumnWorker_WorkPriority));
workTable.columns.Insert(firstWorkindex, PawnColumnDefOf.Job);
if (Settings.jobTextMode) {
workTable.columns.Insert(firstWorkindex, PawnColumnDefOf.JobText);
} else {
workTable.columns.Insert(firstWorkindex, PawnColumnDefOf.Job);
}
workTable.columns.Insert(firstWorkindex + 1, PawnColumnDefOf.Mood);

// go over PawnColumnDefs and replace all PawnColumnWorker_WorkPriority
Expand Down
33 changes: 33 additions & 0 deletions Source/PawnColumns/PawnColumnWorker_JobText.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Copyright Karel Kroeze, 2020-2021.
// WorkTab/WorkTab/PawnColumnWorker_WorkTabLabel.cs

using RimWorld;
using Verse;
using static WorkTab.Constants;

namespace WorkTab {
public class PawnColumnWorker_JobText : PawnColumnWorker_Text {
public override int GetMinWidth(PawnTable table)
{
return JobTextWidth;
}
private string GetJobString(Pawn pawn)
{
return pawn.jobs?.curDriver?.GetReport() ?? "";
}
protected override string GetTextFor(Pawn pawn) {
return GetJobString(pawn);
}
protected override string GetTip(Pawn pawn) {
return GetJobString(pawn);
}
public string GetValueToCompare(Pawn pawn)
{
return GetJobString(pawn);
}
public override int Compare(Pawn a, Pawn b)
{
return GetValueToCompare(a).CompareTo(GetValueToCompare(b));
}
}
}
1 change: 1 addition & 0 deletions Source/Utilities/DefOf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public static class PawnColumnDefOf {
[MayRequireIdeology] public static PawnColumnDef Guest;
[MayRequireIdeology] public static PawnColumnDef Ideo;
public static PawnColumnDef Job;
public static PawnColumnDef JobText;
public static PawnColumnDef LabelShortWithIcon;
public static PawnColumnDef Mood;
public static PawnColumnDef WorkTabLabel;
Expand Down