Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d498bdb
Update FavouriteManager.cs
angelolocritani Aug 16, 2021
2895793
Default priority (+ tip) setting now transletable
angelolocritani Aug 17, 2021
777f1ab
Fix horizontal scroll area
sineme Dec 28, 2022
35c1426
Respect "Disable Scrollwheel" on Checkbox WorkTypes
maarxx Feb 10, 2023
631992c
Replace Job Icon Column with Job Text Column
maarxx Feb 10, 2023
28a5a42
Make Mod Setting for Job Text Column (Icon vs Text)
maarxx Feb 10, 2023
11d2ce8
Localize Mod Setting for Job Text Column
maarxx Feb 10, 2023
15604d9
Add Option to Highlight Current Active Work Cell
maarxx Feb 13, 2023
c2b1a42
Fix: Priorities reset after save-load.
Doomster14 Nov 11, 2023
3fde93d
Removed unused project DynamicPawnTable.
Doomster14 Nov 11, 2023
d841340
Merge pull request fluffy-mods/WorkTab#184 from angelolocritani/patch-1
Doomster14 Nov 12, 2023
294148c
Merge pull request fluffy-mods/WorkTab#201 from sineme/1.4
Doomster14 Nov 12, 2023
cf784fb
Merge pull request fluffy-mods/WorkTab#204 from maarxx/respect_scroll…
Doomster14 Nov 12, 2023
df112dd
Merge pull request fluffy-mods/WorkTab#205 from maarxx/add_long_form_…
Doomster14 Nov 12, 2023
a818e5e
Merge pull request fluffy-mods/WorkTab#206 from maarxx/highlight_acti…
Doomster14 Nov 12, 2023
45b467d
Fix warning: DrawUtilities probably needs a StaticConstructorOnStartu…
Doomster14 Nov 12, 2023
0c87f48
Fix: Naming rule violation.
Doomster14 Nov 12, 2023
21ca947
Fix: active job frame is too bright.
Doomster14 Nov 12, 2023
29fa35a
Fix wording in tooltips: increase/increment/decrease/decrement priori…
Doomster14 Nov 12, 2023
cb9c657
Enable HighlightCurrentJobCell by default.
Doomster14 Nov 12, 2023
59dc4fe
Fix: Numeric settings are reset after restarting the game.
Doomster14 Nov 13, 2023
82ec47a
Fix the last fix: Numeric settings are hard to edit.
Doomster14 Nov 14, 2023
7ac842a
Merge pull request #7 from Phenrei/1.5
Doomster14 Dec 7, 2024
2f964a4
Fix search for label column. Minor improvements.
Doomster14 Dec 8, 2024
cf22e39
Remove political blame from description, restoring old "Buy me a coff…
Doomster14 Dec 8, 2024
392f4cf
Restore original Preview.png, not implying politics.
Doomster14 Dec 8, 2024
8b8b311
Fix: Typo in comment.
Doomster14 Dec 9, 2024
f57b28f
Current job highlighting: misalignment fix, visual improvement.
Doomster14 Dec 10, 2024
8d697f6
Fix: in settings, disabling sound not only grays out crunch sound but…
Doomster14 Dec 10, 2024
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
Binary file modified About/Preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
12 changes: 9 additions & 3 deletions Languages/English/Keyed/Keyed-English.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<WorkTab.CollapseAll>Click to collapse all priorities\nCtrl-click headers to toggle expanding individual priorities</WorkTab.CollapseAll>

<!-- column header tooltips -->
<WorkTab.DetailedColumnTip>Shift + left-click or scroll up to increase priorities\nShift + right click or scroll down to decrease priorities</WorkTab.DetailedColumnTip>
<WorkTab.DetailedColumnTip>Shift + left-click or scroll up to raise priorities\nShift + right click or scroll down to lower priorities</WorkTab.DetailedColumnTip>
<WorkTab.ToggleColumnTip>Shift + left-click or scroll up to toggle priorities on\nShift + right click or scroll down to toggle priorities off</WorkTab.ToggleColumnTip>
<WorkTab.ExpandWorkgiversColumnTip>Ctrl + click to expand list of detailed priorities</WorkTab.ExpandWorkgiversColumnTip>
<WorkTab.CollapseWorkgiversColumnTip>Ctrl + click to collapse list of detailed priorities</WorkTab.CollapseWorkgiversColumnTip>
Expand All @@ -21,12 +21,18 @@
<WorkTab.24HourModeTip>Should times be shown in 12h (e.g. noon, 9p.m.) or 24h (e.g. 12:00, 21:00) mode?</WorkTab.24HourModeTip>
<WorkTab.MaxPriority>Levels of priority</WorkTab.MaxPriority>
<WorkTab.MaxPriorityTip>How many levels of priority should we use? (Limited to between 4 and 9)</WorkTab.MaxPriorityTip>
<WorkTab.DefaultPriority>Default priority</WorkTab.DefaultPriority>
<WorkTab.DefaultPriorityTip>Which level of priority is assigned by default?</WorkTab.DefaultPriorityTip>
<WorkTab.PlaySounds>Sounds</WorkTab.PlaySounds>
<WorkTab.PlaySoundsTip>Play sounds when a priority is changed?</WorkTab.PlaySoundsTip>
<WorkTab.PlayCrunch>Crunchy sounds</WorkTab.PlayCrunch>
<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 description of current activity.\nWhen disabled, an icon is displayed.\n\n(Due to a technical limitation, you must restart the game after changing this option.)</WorkTab.JobTextModeTip>
<WorkTab.HighlightCurrentJobCell>Highlight current job cell</WorkTab.HighlightCurrentJobCell>
<WorkTab.HighlightCurrentJobCellTip>Highlight the grid square in the work tab when the pawn is actually working that job right now.</WorkTab.HighlightCurrentJobCellTip>
<WorkTab.VerticalLabels>Vertical labels</WorkTab.VerticalLabels>
<WorkTab.VerticalLabelsTip>Display work labels vertically</WorkTab.VerticalLabelsTip>
<WorkTab.FontFix>Fix vertical fonts</WorkTab.FontFix>
Expand All @@ -48,7 +54,7 @@
<WorkTab.XIsAssignedToY>{0} is assigned to {1}</WorkTab.XIsAssignedToY>

<!-- pawn label tooltip -->
<WorkTab.LabelCellTip>Click to jump to\nShift-left-click or scroll up to increment priorities\nShift-right-click or scroll down to decrement priorities</WorkTab.LabelCellTip>
<WorkTab.LabelCellTip>Click to jump to\nShift-left-click or scroll up to raise priorities\nShift-right-click or scroll down to lower priorities</WorkTab.LabelCellTip>

<!-- Favourites -->
<Fluffy.WorkTab.CreateFavourite>Create new favourite</Fluffy.WorkTab.CreateFavourite>
Expand Down Expand Up @@ -77,4 +83,4 @@
<Fluffy.WorkTab.Priority.VeryLow>Very low priority</Fluffy.WorkTab.Priority.VeryLow>
<Fluffy.WorkTab.Priority.Lowest>Lowest priority</Fluffy.WorkTab.Priority.Lowest>

</LanguageData>
</LanguageData>
40 changes: 13 additions & 27 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Provides a vastly more customizable work tab.

![Important](https://headers.karel-kroeze.nl/title/Important.png)
![Important](https://headers.karel-kroeze.nl/title/Important.png)

Work Tab completely takes over job priorities from the vanilla game. In order to support core functionalities and other mods, it intercepts calls to get/set priorities. However, when it is told to set priorities by other modded code that is not aware of the time schedule or detailed priorities, the priority will be set for the whole day, and/or for all workgivers in a worktype.

![Features](https://headers.karel-kroeze.nl/title/Features.png)
![Features](https://headers.karel-kroeze.nl/title/Features.png)

Various usability extentions to the 'vanilla' work tab;

Expand All @@ -14,32 +14,32 @@ Various usability extentions to the 'vanilla' work tab;
- Various small UX tweaks; scrolling to increase/decrease/toggle priorities, increase/decrease priorities for whole columns/rows (by holding shift and clicking/scrolling while hovering over the column header/pawn name respectively).
- _All functions are detailed in the tooltips, take a moment to hover over and read them!_

![Known Issues](https://headers.karel-kroeze.nl/title/Known%20Issues.png)
![Known Issues](https://headers.karel-kroeze.nl/title/Known%20Issues.png)

- `"Star Wars -- The Force"` versions prior to 1.21.1 cause priorities to reset for force users. **THIS INCLUDES THE CURRENT STEAM VERSION OF STAR WARS -- THE FORCE!** (as of 25/3/20). There is an official update available by one of the collaborators on the mod on [GitHub](https://github.com/jecrell/Star-Wars---The-Force/releases).

- `Better Pawn Control` has added support for `Work Tab` and `Animal Tab`, but there currently (as of 27/7/21) still is an issue where work settings may reset.

![Notes](https://headers.karel-kroeze.nl/title/Notes.png)
![Notes](https://headers.karel-kroeze.nl/title/Notes.png)

With great power comes great responsibility. The default priorities of tasks within a job is set for a good reason; it's (usually) a sensible default. Changing these can lead to deadlock situations, so change the priorities of individual jobs at your own risk!

Finally, there will never be an 'autolabour' mode where a mod sets priorities for you. Due to the way the AI is handled (e.g. pawns actively look for work, instead of there being a 'bulletin board' of jobs that need doing), it's not feasible to get the complete list of work that needs doing that would be needed to make this a reality, without extreme overhead and loads of special exception coding.

![Powered by Harmony](https://headers.karel-kroeze.nl/title/Powered%20by%20Harmony.png)
![Powered by Harmony](https://headers.karel-kroeze.nl/title/Powered%20by%20Harmony.png)

![Powered by Harmony](https://raw.githubusercontent.com/pardeike/Harmony/master/HarmonyLogo.png)

![Think you found a bug?](https://headers.karel-kroeze.nl/title/Think%20you%20found%20a%20bug%3F.png)
![Think you found a bug?](https://headers.karel-kroeze.nl/title/Think%20you%20found%20a%20bug%3F.png)

Please read [this guide](http://steamcommunity.com/sharedfiles/filedetails/?id=725234314) before creating a bug report,
and then create a bug report [here](https://github.com/fluffy-mods/WorkTab/issues)

![Older versions](https://headers.karel-kroeze.nl/title/Older%20versions.png)
![Older versions](https://headers.karel-kroeze.nl/title/Older%20versions.png)

All current and past versions of this mod can be downloaded from [GitHub](https://github.com/fluffy-mods/WorkTab/releases).

![License](https://headers.karel-kroeze.nl/title/License.png)
![License](https://headers.karel-kroeze.nl/title/License.png)

All original code in this mod is licensed under the [MIT license](https://opensource.org/licenses/MIT). Do what you want, but give me credit.
All original content (e.g. text, imagery, sounds) in this mod is licensed under the [CC-BY-SA 4.0 license](http://creativecommons.org/licenses/by-sa/4.0/).
Expand All @@ -50,26 +50,12 @@ Parts of this mod were created by, or derived from works created by;
- Freepik / flaticon.com: helmet preview image ([BY-NC](https://www.freepik.com/))


![Are you enjoying my mods?](https://headers.karel-kroeze.nl/title/Are%20you%20enjoying%20my%20mods%3F.png)
![Are you enjoying my mods?](https://headers.karel-kroeze.nl/title/Are%20you%20enjoying%20my%20mods%3F.png)

Normally, this is where I ask you to show you appreciation by buying me a coffee.
Become a supporter and show your appreciation by buying me a coffee (or contribute towards a nice single malt).

These are not normal times. Ukraine is being invaded by Russia, at the whim of a ruthless dictator. Innocent people are loosing their lives, and fighting for their continued freedom.
[![Supporters](https://headers.karel-kroeze.nl/donations.png)](https://ko-fi.com/fluffymods)

This is not a matter of politics. This is not a debate. Putins' bloody campaign in Ukraine is illegal, and he will stop at nothing to get what he wants, when he wants it, no matter the cost. The Russian army is invading a country without provocation, bombing civilians and murdering innocents.
[![Buy Me a Coffee](https://i.imgur.com/6P7Ap79.gif)](https://ko-fi.com/fluffymods)

The prospect of waking up to see my country at war is alien to me, as it must have seemed to most Ukrainians. I can do little to influence the outcome of current affairs, but I will do whatever I can.

**I ask you to join me in supporting the people of Ukraine**

![Humanitarian Aid](https://headers.karel-kroeze.nl/title/Humanitarian%20Aid.png)

If you can, donate to the various charities providing humanitarian aid. If you don't know where to donate, Global Citizen maintains a list of charitable organizations active in the region.

<https://www.globalcitizen.org/en/content/ways-to-help-ukraine-conflict/>

![Speak up](https://headers.karel-kroeze.nl/title/Speak%20up.png)

Leaders around the world are deciding on how to respond to Putins' aggression. They are balancing their conscience, and their desire to be re-elected. Many are afraid to impose heavy sanctions because the economic repercussions might loose them votes. The Dutch government, my government, has hinted that they are unwilling to accept Ukranian refugees, and has played a part in allowing Russia to have continued access to international finance. I am ashamed of these actions, taken in my name.

Whereever your live, please let your government know you care more about supporting the people of Ukraine than you do about the price of gas. Join a protest, write letters, call your representatives, and show them that you care about justice!
[![I Have a Black Dog](https://i.ibb.co/ss59Rwy/New-Project-2.png)](https://www.youtube.com/watch?v=XiCrniLQGYc)
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
41 changes: 24 additions & 17 deletions Source/Core/Settings.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
// Settings.cs
// Settings.cs
// Copyright Karel Kroeze, 2020-2020

using UnityEngine;
using Verse;

namespace WorkTab {
public class Settings: ModSettings {
public static int defaultPriority = 3;
public static bool disableScrollwheel;
public static int maxPriority = 9;
public static bool playCrunch = true;
public static bool playSounds = true;
public static bool TwentyFourHourMode = true;
public static bool verticalLabels = true;
private static string _defaultPriorityBuffer = defaultPriority.ToString();

// public static bool sharedFavourites = true;
public static int maxPriority = 9;
public static int defaultPriority = 3;
public static bool TwentyFourHourMode = true;
public static bool playSounds = true;
public static bool playCrunch = true;
public static bool disableScrollwheel = false;
public static bool jobTextMode = false;
public static bool highlightCurrentJobCell = true;
public static bool verticalLabels = true;
private static bool _fontFix = true;
// public static bool sharedFavourites = true;

// buffers
private static string _maxPriorityBuffer = maxPriority.ToString();
// Buffers will be initialized with current settings as soon as
// DoWindowContents() → Listing_Standard.TextFieldNumericLabeled() → Widgets.TextFieldNumeric() will be called.
private static string maxPriorityBuffer = null;
private static string defaultPriorityBuffer = null;

public Settings() {
ApplyFontFix(_fontFix);
Expand All @@ -37,20 +39,23 @@ public static void ApplyFontFix(bool state) {
public static void DoWindowContents(Rect rect) {
Listing_Standard options = new Listing_Standard();
options.Begin(rect);
options.TextFieldNumericLabeled("WorkTab.MaxPriority".Translate(), ref maxPriority, ref _maxPriorityBuffer,
options.TextFieldNumericLabeled("WorkTab.MaxPriority".Translate(), ref maxPriority, ref maxPriorityBuffer,
4, 9, "WorkTab.MaxPriorityTip".Translate(), 1 / 8f);
options.TextFieldNumericLabeled("WorkTab.DefaultPriority".Translate(), ref defaultPriority,
ref _defaultPriorityBuffer, 1, 9, "WorkTab.DefaultPriorityTip".Translate(),
ref defaultPriorityBuffer, 1, 9, "WorkTab.DefaultPriorityTip".Translate(),
1 / 8f);
options.CheckboxLabeled("WorkTab.24HourMode".Translate(), ref TwentyFourHourMode,
"WorkTab.24HourModeTip".Translate());
options.CheckboxLabeled("WorkTab.PlaySounds".Translate(), ref playSounds,
"WorkTab.PlaySoundsTip".Translate());
playCrunch = playSounds && playCrunch; // disabling sounds also disables crunch.
options.CheckboxLabeled("WorkTab.PlayCrunch".Translate(), ref playCrunch, !playSounds,
"WorkTab.PlayCrunchTip".Translate());
options.CheckboxLabeled("WorkTab.DisableScrollwheel".Translate(), ref disableScrollwheel,
"WorkTab.DisableScrollwheelTip".Translate());
options.CheckboxLabeled("WorkTab.JobTextMode".Translate(), ref jobTextMode,
"WorkTab.JobTextModeTip".Translate());
options.CheckboxLabeled("WorkTab.HighlightCurrentJobCell".Translate(), ref highlightCurrentJobCell,
"WorkTab.HighlightCurrentJobCellTip".Translate());
bool verticalLabelsBuffer = verticalLabels;
options.CheckboxLabeled("WorkTab.VerticalLabels".Translate(), ref verticalLabelsBuffer,
"WorkTab.VerticalLabelsTip".Translate());
Expand All @@ -64,7 +69,7 @@ public static void DoWindowContents(Rect rect) {
options.CheckboxLabeled("WorkTab.FontFix".Translate(), ref _fontFixBuffer,
"WorkTab.FontFixTip".Translate());
_fontFixBuffer =
verticalLabels && _fontFixBuffer; // disabling vertical labels makes the font fix unnecesary.
verticalLabels && _fontFixBuffer; // disabling vertical labels makes the font fix unnecessary.

// apply any changes.
if (_fontFixBuffer != _fontFix) {
Expand All @@ -86,7 +91,9 @@ 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 highlightCurrentJobCell, "HighlightCurrentJobCell", true);
Scribe_Values.Look(ref _fontFix, "FontFix", true);

// apply font-fix on load
Expand Down
35 changes: 35 additions & 0 deletions Source/Extensions/PawnTable_Extensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using RimWorld;
using RimWorld.BaseGen;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

namespace WorkTab.Extensions {
internal static class PawnTable_Extensions {
private static ConditionalWeakTable<PawnTable, StrongBox<Rect>> outRectDictionary=new ConditionalWeakTable<PawnTable, StrongBox<Rect>>();
/// <summary>
/// Sets the rectangle the <see cref="PawnTable"/> is drawn in.
/// </summary>
/// <param name="pawnTable">The <see cref="PawnTable"/> being extended.</param>
/// <param name="outRect">The rectangle the <see cref="PawnTable"/> will be drawn in.</param>
internal static void set_OutRect(this PawnTable pawnTable, Rect outRect) {
var value = outRectDictionary.GetValue(
pawnTable,
a => new StrongBox<Rect>(outRect)
);
value.Value = outRect;
}
/// <summary>
/// Gets the rectangle the <see cref="PawnTable"/> will be drawn in.
/// </summary>
/// <param name="pawnTable">The <see cref="PawnTable"/> being extended.</param>
/// <returns>The rectangle the <see cref="PawnTable"/> will be drawn in.</returns>
internal static Rect get_OutRect(this PawnTable pawnTable) {
return outRectDictionary.GetOrCreateValue(pawnTable).Value;
}
}
}
2 changes: 1 addition & 1 deletion Source/Favourites/FavouriteManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private static void LoadFavouriteFloatMenu(Pawn pawn) {
() => LoadFavourite(f.path, pawn)))
.ToList();
if (options.Count == 0) {
options.Add(new FloatMenuOption("Fluffy.WorkTab.NoStoredFavourites", null));
options.Add(new FloatMenuOption("Fluffy.WorkTab.NoStoredFavourites".Translate(), null));
}
Find.WindowStack.Add(new FloatMenu(options));
}
Expand Down
Loading