@@ -14,7 +14,7 @@ class HarmonyPatches
1414 {
1515 static HarmonyPatches ( )
1616 {
17- HarmonyInstance harmony = HarmonyInstance . Create ( "Mehni.RimWorld .FoodAlert.Main " ) ;
17+ HarmonyInstance harmony = HarmonyInstance . Create ( "mehni.rimworld .FoodAlert.main " ) ;
1818
1919 harmony . Patch ( AccessTools . Method ( typeof ( GlobalControlsUtility ) , nameof ( GlobalControlsUtility . DoDate ) ) , null ,
2020 new HarmonyMethod ( typeof ( HarmonyPatches ) , nameof ( FoodCounter_NearDatePostfix ) ) , null ) ;
@@ -24,16 +24,18 @@ private static void FoodCounter_NearDatePostfix(float leftX, float width, ref fl
2424 {
2525 {
2626 var map = Find . CurrentMap ;
27- if ( map == null || ! map . IsPlayerHome ) return ;
28- if ( Find . TickManager . TicksGame < 150000 ) return ;
27+
28+ if ( map == null || ! map . IsPlayerHome )
29+ return ;
30+ if ( Find . TickManager . TicksGame < 150000 )
31+ return ;
2932
3033 float totalHumanEdibleNutrition = map . resourceCounter . TotalHumanEdibleNutrition ;
3134
32- if ( totalHumanEdibleNutrition < 4f * ( float ) map . mapPawns . FreeColonistsSpawnedCount ) return ;
35+ if ( totalHumanEdibleNutrition < 4f * map . mapPawns . FreeColonistsSpawnedCount )
36+ return ;
3337
34- int humansGettingFood = map . mapPawns . FreeColonistsSpawnedCount + ( from pr in map . mapPawns . PrisonersOfColony
35- where pr . guest . GetsFood
36- select pr ) . Count < Pawn > ( ) ;
38+ int humansGettingFood = map . mapPawns . FreeColonistsSpawnedCount + map . mapPawns . PrisonersOfColony . Count ( ) ;
3739
3840 int totalDaysOfFood = Mathf . FloorToInt ( totalHumanEdibleNutrition / humansGettingFood ) ;
3941 string daysWorthOfHumanFood = $ "{ totalDaysOfFood } " + "FoodAlert_DaysOfFood" . Translate ( ) ;
@@ -61,16 +63,16 @@ where pr.guest.GetsFood
6163 addendumForFlavour = "FoodAlert_Decent" . Translate ( ) ;
6264 break ;
6365 }
64- if ( humansGettingFood == 0 ) addendumForFlavour = "\n \n Shit you made me divide by zero. Disregard that." ;
66+
67+ if ( humansGettingFood == 0 )
68+ addendumForFlavour = "\n \n Shit you made me divide by zero. Disregard that." ;
6569
6670 float rightMargin = 7f ;
6771 Rect zlRect = new Rect ( UI . screenWidth - Alert . Width , curBaseY - 24f , Alert . Width , 24f ) ;
6872 Text . Font = GameFont . Small ;
6973
7074 if ( Mouse . IsOver ( zlRect ) )
71- {
7275 Widgets . DrawHighlight ( zlRect ) ;
73- }
7476
7577 GUI . BeginGroup ( zlRect ) ;
7678 Text . Anchor = TextAnchor . UpperRight ;
@@ -83,7 +85,6 @@ where pr.guest.GetsFood
8385
8486 TooltipHandler . TipRegion ( zlRect , new TipSignal ( delegate
8587 {
86-
8788 return string . Format ( "SomeFoodDesc" . Translate ( ) , totalHumanEdibleNutrition . ToString ( "F0" ) , humansGettingFood . ToStringCached ( ) , totalDaysOfFood . ToStringCached ( ) + addendumForFlavour ) ;
8889 } , 76515 ) ) ;
8990
0 commit comments