Skip to content

Commit 047227f

Browse files
committed
RW 1.0 update
1 parent b27cc9c commit 047227f

6 files changed

Lines changed: 19 additions & 18 deletions

File tree

About/About.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<ModMetaData>
33
<name>Food Alert</name>
44
<author>Mehni</author>
5-
<targetVersion>0.19.0</targetVersion>
5+
<targetVersion>1.0.0</targetVersion>
66
<url>https://github.com/Mehni/FoodAlert/releases/latest</url>
7-
<description>v1.0.1\n\n Shows a persistent readout with the amount of food you currently have in storage, and an estimate of how long stocks will last.</description>
7+
<description>v1.1.0\n\n Shows a persistent readout with the amount of food you currently have in storage, and an estimate of how long stocks will last.</description>
88
</ModMetaData>

Assemblies/0Harmony.dll

-41 KB
Binary file not shown.

Assemblies/FoodAlert.dll

-512 Bytes
Binary file not shown.

Source/FoodAlert/FoodAlert.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
<ItemGroup>
3434
<Reference Include="0Harmony, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
3535
<SpecificVersion>False</SpecificVersion>
36-
<HintPath>..\..\..\..\..\..\..\..\..\Users\Maniak\Documents\RimWorld Mods\0Harmony.dll</HintPath>
36+
<HintPath>..\..\..\..\Dev\Github\0Harmony.dll</HintPath>
3737
</Reference>
3838
<Reference Include="Assembly-CSharp">
39-
<HintPath>..\..\..\..\RimWorldWin_Data\Managed\Assembly-CSharp.dll</HintPath>
39+
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
4040
<Private>False</Private>
4141
</Reference>
4242
<Reference Include="System" />
@@ -46,7 +46,7 @@
4646
<Reference Include="System.Data" />
4747
<Reference Include="System.Xml" />
4848
<Reference Include="UnityEngine">
49-
<HintPath>..\..\..\..\RimWorldWin_Data\Managed\UnityEngine.dll</HintPath>
49+
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.dll</HintPath>
5050
<Private>False</Private>
5151
</Reference>
5252
</ItemGroup>

Source/FoodAlert/HarmonyPatches.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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\nShit you made me divide by zero. Disregard that.";
66+
67+
if (humansGettingFood == 0)
68+
addendumForFlavour = "\n\nShit 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

Source/FoodAlert/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("0.1.0.1")]
36-
[assembly: AssemblyFileVersion("0.1.0.1")]
35+
[assembly: AssemblyVersion("0.1.1.0")]
36+
[assembly: AssemblyFileVersion("0.1.1.0")]

0 commit comments

Comments
 (0)