diff --git a/1.1/Assemblies/Numbers.dll b/1.1/Assemblies/Numbers.dll index 02ca50a..f2b0eb5 100644 Binary files a/1.1/Assemblies/Numbers.dll and b/1.1/Assemblies/Numbers.dll differ diff --git a/1.1/Defs/PawnColumnDef/PawnColumns_Numbers.xml b/1.1/Defs/PawnColumnDef/PawnColumns_Numbers.xml index 514cdc1..b457956 100644 --- a/1.1/Defs/PawnColumnDef/PawnColumns_Numbers.xml +++ b/1.1/Defs/PawnColumnDef/PawnColumns_Numbers.xml @@ -44,7 +44,7 @@ true - + Numbers_Psyfocus Numbers.PawnColumnWorker_Psyfocus @@ -54,7 +54,7 @@
  • - + Numbers_Entropy Numbers.PawnColumnWorker_Entropy @@ -64,7 +64,7 @@
  • - + Numbers_PsylinkLevel Numbers.PawnColumnWorker_PsylinkLevel @@ -240,11 +240,14 @@ - + Numbers_Meditation Numbers.PawnColumnWorker_Meditation true + +
  • + diff --git a/1.1/Defs/PawnTableDef/Numbers_PawnTableDef.xml b/1.1/Defs/PawnTableDef/Numbers_PawnTableDef.xml index a91e0a4..e6167e9 100644 --- a/1.1/Defs/PawnTableDef/Numbers_PawnTableDef.xml +++ b/1.1/Defs/PawnTableDef/Numbers_PawnTableDef.xml @@ -39,7 +39,7 @@
  • Numbers_Pain
  • Numbers_RimWorld_StatDef_MeleeDPS
  • Numbers_RimWorld_StatDef_ShootingAccuracyPawn
  • -
  • Numbers_RimWorld_StatDef_MoveSpeed
  • +
  • Numbers_RimWorld_StatDef_MoveSpeed_Normalized
  • @@ -196,7 +196,7 @@
  • Numbers_Equipment
  • Numbers_RimWorld_StatDef_ShootingAccuracyPawn
  • Numbers_RimWorld_RecordDef_Kills
  • -
  • Numbers_RimWorld_StatDef_MoveSpeed
  • +
  • Numbers_RimWorld_StatDef_MoveSpeed_Normalized
  • Numbers_RimWorld_StatDef_MeleeDPS
  • Numbers_RimWorld_NeedDef_Food
  • Numbers_RimWorld_NeedDef_Mood
  • @@ -217,7 +217,7 @@ Numbers.PawnTable_NumbersMain
  • Label
  • -
  • Numbers_RimWorld_StatDef_WorkSpeedGlobal
  • +
  • Numbers_RimWorld_StatDef_WorkSpeedGlobal_Normalized
  • WorkPriority_Patient
  • Numbers_NeedsTreatment
  • WorkPriority_Doctor
  • diff --git a/1.1/Defs/StatDefs/NormalizedStatDefs.xml b/1.1/Defs/StatDefs/NormalizedStatDefs.xml new file mode 100644 index 0000000..d7f44f1 --- /dev/null +++ b/1.1/Defs/StatDefs/NormalizedStatDefs.xml @@ -0,0 +1,37 @@ + + + + + WorkSpeedGlobal_Normalized + + A multiplier on a character's speed at doing any kind of work. Environmental factors such as darkness are removed for better comparison values. + PawnWork + 1 + 0.3 + PercentZero + true + true + 5000 + + + + MoveSpeed_Normalized + + Speed of movement in cells per second. Environmental factors such as darkness are removed for better comparison values. + BasicsPawn + 3.0 + 0.15 + FloatTwo + {0} c/s + +
  • + Moving + 1 +
  • +
    + true + true + 2500 +
    + +
    \ No newline at end of file diff --git a/About/About.xml b/About/About.xml index 7eeb43b..f5ce453 100644 --- a/About/About.xml +++ b/About/About.xml @@ -15,6 +15,7 @@
  • 1.0
  • 1.1
  • +
  • 1.2
  • Adds a customizable general overview tab, allowing you to see any stats on all your colonists or prisoners in a single window. Original by koisama. Updated, expanded and maintained by Mehni. \ No newline at end of file diff --git a/Defs/PawnTableDef/Numbers_PawnTableDef.xml b/Defs/PawnTableDef/Numbers_PawnTableDef.xml index ef25f18..1709642 100644 --- a/Defs/PawnTableDef/Numbers_PawnTableDef.xml +++ b/Defs/PawnTableDef/Numbers_PawnTableDef.xml @@ -39,7 +39,7 @@
  • Numbers_Pain
  • Numbers_RimWorld_StatDef_MeleeDPS
  • Numbers_RimWorld_StatDef_ShootingAccuracyPawn
  • -
  • Numbers_RimWorld_StatDef_MoveSpeed
  • +
  • Numbers_RimWorld_StatDef_MoveSpeed_Normalized
  • @@ -195,7 +195,7 @@
  • Numbers_Equipment
  • Numbers_RimWorld_StatDef_ShootingAccuracyPawn
  • Numbers_RimWorld_RecordDef_Kills
  • -
  • Numbers_RimWorld_StatDef_MoveSpeed
  • +
  • Numbers_RimWorld_StatDef_MoveSpeed_Normalized
  • Numbers_RimWorld_StatDef_MeleeDPS
  • Numbers_RimWorld_NeedDef_Food
  • Numbers_RimWorld_NeedDef_Mood
  • @@ -216,7 +216,7 @@ Numbers.PawnTable_NumbersMain
  • Label
  • -
  • Numbers_RimWorld_StatDef_WorkSpeedGlobal
  • +
  • Numbers_RimWorld_StatDef_WorkSpeedGlobal_Normalized
  • WorkPriority_Patient
  • Numbers_NeedsTreatment
  • WorkPriority_Doctor
  • diff --git a/Numbers/MainTabWindow_Numbers.cs b/Numbers/MainTabWindow_Numbers.cs index e633cd4..b01bd08 100644 --- a/Numbers/MainTabWindow_Numbers.cs +++ b/Numbers/MainTabWindow_Numbers.cs @@ -256,12 +256,18 @@ private List GetHumanLikeStatDefs() var pawnHumanlikeStatDef = source .Concat(tmpPawn.def.SpecialDisplayStats(StatRequest.For(tmpPawn))) .Where(s => s.stat != null && s.ShouldDisplay && s.stat.Worker != null) - .Select(s => s.stat) - .OrderBy(stat => stat.LabelCap.Resolve()); + .Select(s => s.stat); tmpPawn.Destroy(DestroyMode.KillFinalize); - return pawnHumanlikeStatDef.ToList(); + return SubstituteEnvironmentalStatDefsForNormalizedVersion(pawnHumanlikeStatDef).OrderBy(stat => stat.LabelCap.Resolve()).ToList(); + } + + private IEnumerable SubstituteEnvironmentalStatDefsForNormalizedVersion(IEnumerable list) + { + return list + .Concat(new[] { DefDatabase.GetNamed("MoveSpeed_Normalized"), DefDatabase.GetNamed("WorkSpeedGlobal_Normalized") }) + .Where(x => x.parts == null || x.GetStatPart() == null); } } } diff --git a/Numbers/Numbers.csproj b/Numbers/Numbers.csproj index 4ee9b4f..a8f21d7 100644 --- a/Numbers/Numbers.csproj +++ b/Numbers/Numbers.csproj @@ -37,7 +37,7 @@ - ..\..\..\..\..\workshop\content\294100\2009463077\v1.1\Assemblies\0Harmony.dll + ..\..\..\..\..\workshop\content\294100\2009463077\Current\Assemblies\0Harmony.dll False False @@ -74,16 +74,19 @@ + + + @@ -95,6 +98,7 @@ + @@ -111,6 +115,8 @@ + + diff --git a/Numbers/Numbers_PawnColumnDef.cs b/Numbers/Numbers_PawnColumnDef.cs index 852eff9..8ad722f 100644 --- a/Numbers/Numbers_PawnColumnDef.cs +++ b/Numbers/Numbers_PawnColumnDef.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using RimWorld; +using RimWorld; using Verse; namespace Numbers diff --git a/Numbers/Numbers_Utility.cs b/Numbers/Numbers_Utility.cs index 56949de..dfe08e7 100644 --- a/Numbers/Numbers_Utility.cs +++ b/Numbers/Numbers_Utility.cs @@ -27,24 +27,28 @@ public static bool IsWildAnimal(this Pawn p) => p.Faction == null && p.AnimalOrWildMan(); - public static DefModExtension_PawnColumnDefs Ext(this PawnColumnDef def, bool throwError = true) + public static DefModExtension_PawnColumnDefs Ext(this PawnColumnDef def, bool logError = true) { - if (throwError && !def.HasModExtension()) + var ext = def.GetModExtension(); + + if (logError && ext == null) { - Log.Error("Numbers expected DefModExtension PawnColumnDefs, got null"); - return null; + Log.Error($"Numbers expected DefModExtension PawnColumnDefs, got null for def {def.defName}"); } - return def.GetModExtension(); + + return ext; } public static DefModExtension_PawnTableDefs Ext(this PawnTableDef def) { - if (!def.HasModExtension()) + var ext = def.GetModExtension(); + + if (ext == null) { - Log.Error("Numbers expected DefModExtension PawnTableDef, got null"); - return null; + Log.Error($"Numbers expected DefModExtension PawnTableDef, got null for def {def.defName}"); } - return def.GetModExtension(); + + return ext; } public static string WordWrapAt(this string text, float length, PawnTable table = null) diff --git a/Numbers/PawnColumnWorkers/PawnColumnWorker_Bleedrate.cs b/Numbers/PawnColumnWorkers/PawnColumnWorker_Bleedrate.cs index 5f95eaf..77d112c 100644 --- a/Numbers/PawnColumnWorkers/PawnColumnWorker_Bleedrate.cs +++ b/Numbers/PawnColumnWorkers/PawnColumnWorker_Bleedrate.cs @@ -48,7 +48,7 @@ private Color FindPrettyColourForBleedingPawn(Pawn pawn) return Mathf.Approximately(isThisMyBlood, 1f) ? SeverePainColor - : HealthUtility.DarkRedColor; + : HealthUtility.RedColor; } } } diff --git a/Numbers/PawnColumnWorkers/PawnColumnWorker_DiseaseProgression.cs b/Numbers/PawnColumnWorkers/PawnColumnWorker_DiseaseProgression.cs index 047afc6..1821ff3 100644 --- a/Numbers/PawnColumnWorkers/PawnColumnWorker_DiseaseProgression.cs +++ b/Numbers/PawnColumnWorkers/PawnColumnWorker_DiseaseProgression.cs @@ -65,7 +65,7 @@ public override void DoCell(Rect rect, Pawn pawn, PawnTable table) bool redFlag = !(severityChangePerDayFromTendD + severityChangePerDayFromImmu > immunityPerDay); Texture2D texture2D = redFlag ? StaticConstructorOnGameStart.SortingIcon : StaticConstructorOnGameStart.SortingDescendingIcon; - GUI.color = redFlag ? HealthUtility.GoodConditionColor : HealthUtility.DarkRedColor; + GUI.color = redFlag ? HealthUtility.GoodConditionColor : HealthUtility.RedColor; Rect position2 = new Rect(rect.xMax - texture2D.width - 1f, rect.yMax - texture2D.height - 1f, texture2D.width, texture2D.height); GUI.DrawTexture(position2, texture2D); GUI.color = Color.white; @@ -132,7 +132,7 @@ private float GetTextFor(HediffWithComps hediff) private Color GetPrettyColorFor(float deltaSeverity) { if (deltaSeverity <= -0.4f) - return HealthUtility.DarkRedColor; + return HealthUtility.RedColor; if (deltaSeverity <= -0.2f) return SeverePainColor; diff --git a/Numbers/PawnColumnWorkers/PawnColumnWorker_Gear.cs b/Numbers/PawnColumnWorkers/PawnColumnWorker_Gear.cs index f2a2533..dc0eae1 100644 --- a/Numbers/PawnColumnWorkers/PawnColumnWorker_Gear.cs +++ b/Numbers/PawnColumnWorkers/PawnColumnWorker_Gear.cs @@ -60,8 +60,8 @@ private void DrawThing(Rect rect, Thing thing, Pawn selPawn) if (selPawn.IsColonistPlayerControlled) { - Action action = DropThing(thing, selPawn); - list.Add(new FloatMenuOption("DropThing".Translate(), action)); + Action dropAction = DropThing(thing, selPawn); + list.Add(new FloatMenuOption("DropThing".Translate(), dropAction)); } FloatMenu window = new FloatMenu(list, thing.LabelCap); Find.WindowStack.Add(window); @@ -77,31 +77,22 @@ private void DrawThing(Rect rect, Thing thing, Pawn selPawn) private static Action DropThing(Thing thing, Pawn selPawn) { - Action action = null; - ThingWithComps eq = thing as ThingWithComps; if (thing is Apparel ap && selPawn.apparel != null && selPawn.apparel.WornApparel.Contains(ap)) { - action = delegate - { - selPawn.jobs.TryTakeOrderedJob(new Job(JobDefOf.RemoveApparel, ap)); - }; + return () => selPawn.jobs.TryTakeOrderedJob(new Job(JobDefOf.RemoveApparel, ap)); } - else if (eq != null && selPawn.equipment.AllEquipmentListForReading.Contains(eq)) + + if (thing is ThingWithComps eq && selPawn.equipment.AllEquipmentListForReading.Contains(eq)) { - action = delegate - { - selPawn.jobs.TryTakeOrderedJob(new Job(JobDefOf.DropEquipment, eq)); - }; + return() => selPawn.jobs.TryTakeOrderedJob(new Job(JobDefOf.DropEquipment, eq)); } - else if (!thing.def.destroyOnDrop) + + if (!thing.def.destroyOnDrop) { - action = delegate - { - selPawn.inventory.innerContainer.TryDrop(thing, selPawn.Position, selPawn.Map, ThingPlaceMode.Near, out Thing unused); - }; + return () => selPawn.inventory.innerContainer.TryDrop(thing, selPawn.Position, selPawn.Map, ThingPlaceMode.Near, out Thing unused); } - return action; + return null; } public override int Compare(Pawn a, Pawn b) diff --git a/Numbers/PawnColumnWorkers/PawnColumnWorker_PsylinkLevel.cs b/Numbers/PawnColumnWorkers/PawnColumnWorker_PsylinkLevel.cs index 530f696..e77f607 100644 --- a/Numbers/PawnColumnWorkers/PawnColumnWorker_PsylinkLevel.cs +++ b/Numbers/PawnColumnWorkers/PawnColumnWorker_PsylinkLevel.cs @@ -1,6 +1,5 @@ namespace Numbers { - using System; using RimWorld; using Verse; diff --git a/Numbers/StaticConstructorOnGameStart.cs b/Numbers/StaticConstructorOnGameStart.cs index eb3afcd..751222a 100644 --- a/Numbers/StaticConstructorOnGameStart.cs +++ b/Numbers/StaticConstructorOnGameStart.cs @@ -39,7 +39,7 @@ static StaticConstructorOnGameStart() AddRemainingSpaceToPawnTableDefs(); - AddHeadersToPawnColumns(); + AddHeaderToolTipToPawnColumns(); PopulatePresets(); @@ -72,7 +72,7 @@ private static void AddRemainingSpaceToPawnTableDefs() } } - private static void AddHeadersToPawnColumns() + private static void AddHeaderToolTipToPawnColumns() { foreach (PawnColumnDef pawnColumnDef in DefDatabase .AllDefsListForReading @@ -81,7 +81,7 @@ private static void AddHeadersToPawnColumns() && !(x.Worker is PawnColumnWorker_AllHediffs || x.Worker is PawnColumnWorker_SelfTend || x.Worker is PawnColumnWorker_ManhunterOnTameFailChance - || x.Worker is PawnColumnWorker_Ability))) //special treatment for those. + || x.Worker is PawnColumnWorker_Ability))) //these PawnColumnWorkers override GetHeaderTip. { pawnColumnDef.headerTip += (pawnColumnDef.headerTip.NullOrEmpty() ? "" : "\n\n") + "Numbers_ColumnHeader_Tooltip".Translate(); } @@ -103,7 +103,7 @@ private static void PopulatePsycastingPreset() psycastingPreset.Add(DefDatabase.GetNamed("Numbers_Psyfocus")); psycastingPreset.Add(DefDatabase.GetNamed("Numbers_Entropy")); psycastingPreset.AddRange( - DefDatabase.AllDefsListForReading.Where(pcd => pcd.Ext(throwError: false)?.ability != null).ToList() + DefDatabase.AllDefsListForReading.Where(pcd => pcd.Ext(logError: false)?.ability != null).ToList() .OrderBy(x => x.Ext().ability.level) .ThenBy(x => x.Ext().ability.PsyfocusCost) .ThenBy(x => x.Ext().ability.EntropyGain) diff --git a/README.md b/README.md index 2e23339..e4da57a 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,10 @@ It can be added to existing saves without problems. - [GitHub](https://github.com/Mehni/kNumbers) - [All the releases](https://github.com/Mehni/kNumbers/releases) +## Credits + +Much thanks to [Maarxx](https://github.com/maarxx) for singlehandedly adding support for Royalty. Check out their mods [here](https://ludeon.com/forums/index.php?topic=53539)! + ## License Original idea by koisama: https://github.com/koisama/kNumbers, whose original license I respect by the preceding link. For the license since 2018/11/21, see LICENSE. \ No newline at end of file