Skip to content

Commit

Permalink
initial v1.0 update
Browse files Browse the repository at this point in the history
  • Loading branch information
FluffierThanThou committed Jun 14, 2018
1 parent fcb8f90 commit a4b17dc
Show file tree
Hide file tree
Showing 19 changed files with 78 additions and 57 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*.user
*.userosscache
*.sln.docstates
.idea

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
Expand Down
2 changes: 1 addition & 1 deletion About/About.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<name>Work Tab</name>
<author>Fluffy</author>
<url>https://ludeon.com/forums/index.php?topic=15964.0</url>
<targetVersion>0.18.1722</targetVersion>
<targetVersion>1.0.1934</targetVersion>
<description>Provides a vastly more customizable work tab.

&lt;size=24&gt;Important&lt;/size&gt;
Expand Down
Binary file modified Assemblies/0Harmony.dll
Binary file not shown.
Binary file modified Assemblies/WorkTab.dll
Binary file not shown.
4 changes: 4 additions & 0 deletions Source/Core/Mod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
// Controller.cs
// 2017-05-22

using System.Collections.Generic;
using System.Reflection;
using Harmony;
using RimWorld;
using UnityEngine;
using Verse;

Expand Down Expand Up @@ -34,5 +36,7 @@ public override string SettingsCategory()
{
return "WorkTab".Translate();
}

public static List<PawnColumnDef> allColumns;
}
}
10 changes: 7 additions & 3 deletions Source/Core/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ public Settings()

public static void ApplyFontFix( bool state )
{
Logger.Debug( state ? "Applying font fix" : "Disabling font fix" );
_fontFix = state;
Text.fontStyles[0].font.material.mainTexture.filterMode = state ? FilterMode.Point : FilterMode.Trilinear;
LongEventHandler.ExecuteWhenFinished( delegate
{
Logger.Debug( state ? "Applying font fix" : "Disabling font fix" );
_fontFix = state;
Text.fontStyles[0].font.material.mainTexture.filterMode =
state ? FilterMode.Point : FilterMode.Trilinear;
} );
}

// buffers
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/VanillaWorkSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static int GetVanillaPriority( this Pawn pawn, WorkTypeDef worktype )
catch ( ArgumentOutOfRangeException )
{
priority = 0;
Logger.Message( $"Priority requested for a workgiver that did not yet exist for {pawn.NameStringShort}. Did you add mods in an existing game?" );
Logger.Message( $"Priority requested for a workgiver that did not yet exist for {pawn.Name.ToStringShort}. Did you add mods in an existing game?" );
}
return priority;
}
Expand Down
2 changes: 0 additions & 2 deletions Source/Core/WorkPriorityTracker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ public class WorkPriorityTracker: IExposable {
private WorkGiverDef workgiver;
private int[] priorities;
protected internal Pawn pawn;
private string _tooltip;
private bool _variesOverTime;

public WorkPriorityTracker(){
// Scribe
Expand Down
28 changes: 17 additions & 11 deletions Source/Extensions/Job_Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static string DefaultIconPath(this JobDef job)
job == JobDefOf.AttackStatic ||
job == JobDefOf.FleeAndCower ||
job == JobDefOf.ManTurret ||
job == JobDefOf.WaitCombat ||
job == JobDefOf.Wait_Combat ||
job == JobDefOf.Flee )
return "UI/Icons/Various/combat";

Expand Down Expand Up @@ -105,9 +105,9 @@ public static string DefaultIconPath(this JobDef job)
return "UI/Icons/Various/hearts";

// games
if ( job == JobDefOf2.PlayBilliards ||
job == JobDefOf2.PlayChess ||
job == JobDefOf2.PlayHorseshoes ||
if ( job == JobDefOf2.Play_Billiards ||
job == JobDefOf2.Play_Chess ||
job == JobDefOf2.Play_Horseshoes ||
job == JobDefOf2.BuildSnowman )
return "UI/Icons/Various/dice";

Expand All @@ -134,14 +134,16 @@ public static string DefaultIconPath(this JobDef job)

// haul
if (job == JobDefOf.CarryToCryptosleepCasket ||
job == JobDefOf.BuryCorpse ||
job == JobDefOf.HaulCorpseToPublicPlace ||
job == JobDefOf.HaulToCell ||
job == JobDefOf.HaulToContainer ||
job == JobDefOf.Refuel ||
job == JobDefOf.PrepareCaravan_GatherItems ||
job == JobDefOf.FillFermentingBarrel ||
job == JobDefOf.TakeBeerOutOfFermentingBarrel ||
job == JobDefOf.GiveToPackAnimal )
job == JobDefOf.GiveToPackAnimal ||
job == JobDefOf.RearmTurret ||
job == JobDefOf.RearmTurretAtomic )
return "UI/Icons/Various/haul";

// clean
Expand Down Expand Up @@ -175,6 +177,7 @@ public static string DefaultIconPath(this JobDef job)
if (job == JobDefOf.SocialRelax ||
job == JobDefOf.SpectateCeremony ||
job == JobDefOf.StandAndBeSociallyActive ||
job == JobDefOf.Insult ||
job == JobDefOf.UseCommsConsole )
return "UI/Icons/Various/social";

Expand Down Expand Up @@ -206,16 +209,17 @@ public static string DefaultIconPath(this JobDef job)

// waiting
if ( job == JobDefOf.Wait ||
job == JobDefOf.WaitMaintainPosture ||
job == JobDefOf.WaitSafeTemperature ||
job == JobDefOf.WaitWander )
job == JobDefOf.Wait_MaintainPosture ||
job == JobDefOf.Wait_SafeTemperature ||
job == JobDefOf.Wait_Wander )
return "UI/Icons/Various/clock";

// construct
if (job == JobDefOf.FinishFrame ||
job == JobDefOf.PlaceNoCostFrame ||
job == JobDefOf.RemoveFloor ||
job == JobDefOf.SmoothFloor ||
job == JobDefOf.SmoothWall ||
job == JobDefOf.Uninstall ||
job == JobDefOf.Deconstruct ||
job == JobDefOf.BuildRoof ||
Expand All @@ -225,7 +229,7 @@ public static string DefaultIconPath(this JobDef job)
// repair
if (job == JobDefOf.FixBrokenDownBuilding ||
job == JobDefOf.Repair ||
job == JobDefOf2.Maintain ||
job == JobDefOf.Maintain ||
job == JobDefOf.RearmTrap )
return "UI/Icons/Various/wrench";

Expand All @@ -234,7 +238,7 @@ public static string DefaultIconPath(this JobDef job)
return "UI/Icons/Various/chef";

// sick
if (job == JobDefOf.WaitDowned ||
if (job == JobDefOf.Wait_Downed ||
job == JobDefOf.Vomit )
return "UI/Icons/Various/sick";

Expand Down Expand Up @@ -265,6 +269,8 @@ public static string DefaultIconPath(this JobDef job)
job == JobDefOf.UseArtifact ||
job == JobDefOf.Flick ||
job == JobDefOf.EnterTransporter ||
job == JobDefOf2.UseItem ||
job == JobDefOf.Ignite ||
job == JobDefOf.Steal)
return "UI/Icons/Various/hand";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
// DefGenerator_GenerateImpliedDefs_PreResolve.cs
// 2017-05-22

using System.Collections.Generic;
using Harmony;
using RimWorld;
using Verse;

namespace WorkTab
{
[HarmonyPatch(typeof( DefGenerator), "GenerateImpliedDefs_PreResolve")]
[HarmonyPatch( typeof( DefGenerator), "GenerateImpliedDefs_PreResolve")]
public class DefGenerator_GenerateImpliedDefs_PreResolve
{
static void Postfix()
Expand Down Expand Up @@ -54,6 +55,9 @@ static void Postfix()
workTable.columns.Remove(copyPasteColumn);
// Note; the far right column is a spacer to take all remaining available space, so index should be count - 2 (count - 1 before insert).
workTable.columns.Insert( workTable.columns.Count - 1, DefDatabase<PawnColumnDef>.GetNamed("CopyPasteDetailedWorkPriorities"));

// store this list of all columns
Mod.allColumns = new List<PawnColumnDef>( workTable.columns );
}
}
}
7 changes: 2 additions & 5 deletions Source/PawnColumns/PawnColumnWorker_Mood.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,9 @@ protected override Color GetIconColor( Pawn pawn )
{
case MentalStateCategory.Aggro:
return Color.red;
case MentalStateCategory.Sad:
return Color.cyan;
case MentalStateCategory.Panic:
return new Color( .4f, .008f, .235f );
case MentalStateCategory.Malicious:
return Color.yellow;
case MentalStateCategory.Misc:
case MentalStateCategory.Indulgent:
case MentalStateCategory.Undefined:
return new Color( 207 / 256f, 83 / 256f, 0f );
default:
Expand Down
20 changes: 10 additions & 10 deletions Source/PawnColumns/PawnColumnWorker_WorkGiver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ private void HandleInteractionsToggle( Rect rect, Pawn pawn )
{
pawn.SetPriority( WorkGiver, 0, SelectedHours );
if (Settings.playSounds)
SoundDefOf.CheckboxTurnedOff.PlayOneShotOnCamera();
SoundDefOf.Checkbox_TurnedOff.PlayOneShotOnCamera();
}
else
{
pawn.SetPriority( WorkGiver, Mathf.Min( Settings.maxPriority, 3 ), SelectedHours );
if (Settings.playSounds )
SoundDefOf.CheckboxTurnedOn.PlayOneShotOnCamera();
SoundDefOf.Checkbox_TurnedOn.PlayOneShotOnCamera();
if ( Settings.playSounds && Settings.playCrunch && pawn.skills.AverageOfRelevantSkillsFor( WorkGiver.workType ) <= 2f )
SoundDefOf.Crunch.PlayOneShotOnCamera();
}
Expand Down Expand Up @@ -322,7 +322,7 @@ public void HeaderInteractions( Rect rect, PawnTable table )
if ( pawns.Any( p => p.GetPriority( WorkGiver, VisibleHour ) != 0 ) )
{
if (Settings.playSounds)
SoundDefOf.CheckboxTurnedOff.PlayOneShotOnCamera();
SoundDefOf.Checkbox_TurnedOff.PlayOneShotOnCamera();
foreach ( Pawn pawn in pawns )
pawn.SetPriority( WorkGiver, 0, SelectedHours );
}
Expand All @@ -333,7 +333,7 @@ public void HeaderInteractions( Rect rect, PawnTable table )
if ( pawns.Any( p => p.GetPriority( WorkGiver, VisibleHour ) == 0 ) )
{
if (Settings.playSounds)
SoundDefOf.CheckboxTurnedOn.PlayOneShotOnCamera();
SoundDefOf.Checkbox_TurnedOn.PlayOneShotOnCamera();
foreach ( Pawn pawn in pawns )
pawn.SetPriority( WorkGiver, 3, SelectedHours );
}
Expand All @@ -356,35 +356,35 @@ protected virtual void Sort( PawnTable table, bool ascending = true )
if ( table.SortingBy != def )
{
table.SortBy( def, true );
SoundDefOf.TickHigh.PlayOneShotOnCamera();
SoundDefOf.Tick_High.PlayOneShotOnCamera();
}
else if ( table.SortingDescending )
{
table.SortBy( def, false );
SoundDefOf.TickHigh.PlayOneShotOnCamera();
SoundDefOf.Tick_High.PlayOneShotOnCamera();
}
else
{
table.SortBy( null, false );
SoundDefOf.TickLow.PlayOneShotOnCamera();
SoundDefOf.Tick_Low.PlayOneShotOnCamera();
}
}
else
{
if ( table.SortingBy != def )
{
table.SortBy( def, false );
SoundDefOf.TickHigh.PlayOneShotOnCamera();
SoundDefOf.Tick_High.PlayOneShotOnCamera();
}
else if ( table.SortingDescending )
{
table.SortBy( null, false );
SoundDefOf.TickLow.PlayOneShotOnCamera();
SoundDefOf.Tick_Low.PlayOneShotOnCamera();
}
else
{
table.SortBy( def, true );
SoundDefOf.TickHigh.PlayOneShotOnCamera();
SoundDefOf.Tick_High.PlayOneShotOnCamera();
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Source/PawnColumns/PawnColumnWorker_WorkTabLabel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public override void DoCell(Rect rect, Pawn pawn, PawnTable table)

public override int Compare(Pawn a, Pawn b)
{
return String.Compare( a.NameStringShort, b.NameStringShort, StringComparison.CurrentCultureIgnoreCase );
return String.Compare( a.Name.ToStringShort, b.Name.ToStringShort, StringComparison.CurrentCultureIgnoreCase );
}

public string GetTooltip(Pawn pawn)
Expand Down
20 changes: 10 additions & 10 deletions Source/PawnColumns/PawnColumnWorker_WorkType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ private void HandleInteractionsToggle( Rect rect, Pawn pawn )
{
pawn.SetPriority( def.workType, 0, SelectedHours );
if (Settings.playSounds)
SoundDefOf.CheckboxTurnedOff.PlayOneShotOnCamera();
SoundDefOf.Checkbox_TurnedOff.PlayOneShotOnCamera();
}
else
{
pawn.SetPriority( def.workType, Mathf.Min( Settings.maxPriority, 3 ), SelectedHours );
if (Settings.playSounds)
SoundDefOf.CheckboxTurnedOn.PlayOneShotOnCamera();
SoundDefOf.Checkbox_TurnedOn.PlayOneShotOnCamera();
if (Settings.playSounds && Settings.playCrunch && pawn.skills.AverageOfRelevantSkillsFor( def.workType ) <= 2f )
{
SoundDefOf.Crunch.PlayOneShotOnCamera();
Expand Down Expand Up @@ -325,7 +325,7 @@ public void HeaderInteractions( Rect rect, PawnTable table )
if ( pawns.Any( p => p.GetPriority( def.workType, VisibleHour ) != 0 ) )
{
if (Settings.playSounds)
SoundDefOf.CheckboxTurnedOff.PlayOneShotOnCamera();
SoundDefOf.Checkbox_TurnedOff.PlayOneShotOnCamera();
foreach ( Pawn pawn in pawns )
pawn.SetPriority( def.workType, 0, SelectedHours );
}
Expand All @@ -336,7 +336,7 @@ public void HeaderInteractions( Rect rect, PawnTable table )
if ( pawns.Any( p => p.GetPriority( def.workType, VisibleHour ) == 0 ) )
{
if (Settings.playSounds)
SoundDefOf.CheckboxTurnedOn.PlayOneShotOnCamera();
SoundDefOf.Checkbox_TurnedOn.PlayOneShotOnCamera();
foreach ( Pawn pawn in pawns )
pawn.SetPriority( def.workType, 3, SelectedHours );
}
Expand Down Expand Up @@ -364,35 +364,35 @@ protected virtual void Sort( PawnTable table, bool ascending = true )
if ( table.SortingBy != def )
{
table.SortBy( def, true );
SoundDefOf.TickHigh.PlayOneShotOnCamera();
SoundDefOf.Tick_High.PlayOneShotOnCamera();
}
else if ( table.SortingDescending )
{
table.SortBy( def, false );
SoundDefOf.TickHigh.PlayOneShotOnCamera();
SoundDefOf.Tick_High.PlayOneShotOnCamera();
}
else
{
table.SortBy( null, false );
SoundDefOf.TickLow.PlayOneShotOnCamera();
SoundDefOf.Tick_Low.PlayOneShotOnCamera();
}
}
else
{
if ( table.SortingBy != def )
{
table.SortBy( def, false );
SoundDefOf.TickHigh.PlayOneShotOnCamera();
SoundDefOf.Tick_High.PlayOneShotOnCamera();
}
else if ( table.SortingDescending )
{
table.SortBy( null, false );
SoundDefOf.TickLow.PlayOneShotOnCamera();
SoundDefOf.Tick_Low.PlayOneShotOnCamera();
}
else
{
table.SortBy( def, true );
SoundDefOf.TickHigh.PlayOneShotOnCamera();
SoundDefOf.Tick_High.PlayOneShotOnCamera();
}
}
}
Expand Down
Loading

0 comments on commit a4b17dc

Please sign in to comment.