diff --git a/Defs/PawnColumnDefs.xml b/Defs/PawnColumnDefs.xml index 4dd4668..3af3e8f 100644 --- a/Defs/PawnColumnDefs.xml +++ b/Defs/PawnColumnDefs.xml @@ -19,6 +19,14 @@ (16,16) + + JobText + WorkTab.PawnColumnWorker_JobText + true + + Current job + + CopyPasteDetailedWorkPriorities WorkTab.PawnColumnWorker_CopyPasteDetailedWorkPriorities diff --git a/Languages/English/Keyed/Keyed-English.xml b/Languages/English/Keyed/Keyed-English.xml index 1d18a97..6ac6062 100644 --- a/Languages/English/Keyed/Keyed-English.xml +++ b/Languages/English/Keyed/Keyed-English.xml @@ -27,6 +27,8 @@ Play a crunchy sound when a pawn is assigned to a job they are not skilled at? Disable Scrollwheel Disable the scrollwheel functions (when hovering over skills) + Current job column as text (requires restart) + 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.) Vertical labels Display work labels vertically Fix vertical fonts diff --git a/Source/Core/Constants.cs b/Source/Core/Constants.cs index e89c628..4eeef82 100644 --- a/Source/Core/Constants.cs +++ b/Source/Core/Constants.cs @@ -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; diff --git a/Source/Core/Settings.cs b/Source/Core/Settings.cs index f0cb3cc..938fd33 100644 --- a/Source/Core/Settings.cs +++ b/Source/Core/Settings.cs @@ -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; @@ -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()); @@ -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); diff --git a/Source/HarmonyPatches/DefGenerator_GenerateImpliedDefs_PreResolve.cs b/Source/HarmonyPatches/DefGenerator_GenerateImpliedDefs_PreResolve.cs index 89b93a4..9333c15 100644 --- a/Source/HarmonyPatches/DefGenerator_GenerateImpliedDefs_PreResolve.cs +++ b/Source/HarmonyPatches/DefGenerator_GenerateImpliedDefs_PreResolve.cs @@ -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 diff --git a/Source/PawnColumns/PawnColumnWorker_JobText.cs b/Source/PawnColumns/PawnColumnWorker_JobText.cs new file mode 100644 index 0000000..263df17 --- /dev/null +++ b/Source/PawnColumns/PawnColumnWorker_JobText.cs @@ -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)); + } + } +} diff --git a/Source/Utilities/DefOf.cs b/Source/Utilities/DefOf.cs index c643126..7792ab5 100644 --- a/Source/Utilities/DefOf.cs +++ b/Source/Utilities/DefOf.cs @@ -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;