diff --git a/About/About.xml b/About/About.xml new file mode 100644 index 0000000..52d8ec2 --- /dev/null +++ b/About/About.xml @@ -0,0 +1,8 @@ + + + Food Alert + Mehni + 0.17.0 + https://github.com/Mehni/FoodAlert/releases/latest + v0.17.0.1 Initial release.\n\n Shows a persistent alert with the amount of food you currently have in storage, and an estimate of how long stocks will last. + \ No newline at end of file diff --git a/About/preview.png b/About/preview.png new file mode 100644 index 0000000..eccb79b Binary files /dev/null and b/About/preview.png differ diff --git a/Assemblies/FoodAlert.dll b/Assemblies/FoodAlert.dll new file mode 100644 index 0000000..08df1f8 Binary files /dev/null and b/Assemblies/FoodAlert.dll differ diff --git a/FoodAlert/FoodAlert.sln b/FoodAlert/FoodAlert.sln new file mode 100644 index 0000000..eedc743 --- /dev/null +++ b/FoodAlert/FoodAlert.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FoodAlert", "FoodAlert\FoodAlert.csproj", "{3F0E51D5-7F89-48FF-80E7-26F0D33C3B64}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3F0E51D5-7F89-48FF-80E7-26F0D33C3B64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3F0E51D5-7F89-48FF-80E7-26F0D33C3B64}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3F0E51D5-7F89-48FF-80E7-26F0D33C3B64}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3F0E51D5-7F89-48FF-80E7-26F0D33C3B64}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/FoodAlert/FoodAlert/FoodAlert.csproj b/FoodAlert/FoodAlert/FoodAlert.csproj new file mode 100644 index 0000000..f05f695 --- /dev/null +++ b/FoodAlert/FoodAlert/FoodAlert.csproj @@ -0,0 +1,63 @@ + + + + + Debug + AnyCPU + {3F0E51D5-7F89-48FF-80E7-26F0D33C3B64} + Library + Properties + FoodAlert + FoodAlert + v3.5 + 512 + + + + false + none + false + ..\..\..\Assemblies\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin_Data\Managed\Assembly-CSharp.dll + False + + + + + + + + + + + ..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\RimWorld\RimWorldWin_Data\Managed\UnityEngine.dll + False + + + + + + + + + \ No newline at end of file diff --git a/FoodAlert/FoodAlert/Properties/AssemblyInfo.cs b/FoodAlert/FoodAlert/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..75b51b6 --- /dev/null +++ b/FoodAlert/FoodAlert/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("FoodAlert")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FoodAlert")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("3f0e51d5-7f89-48ff-80e7-26f0d33c3b64")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/FoodAlert/FoodAlert/SomeFoodAlert.cs b/FoodAlert/FoodAlert/SomeFoodAlert.cs new file mode 100644 index 0000000..64bad5f --- /dev/null +++ b/FoodAlert/FoodAlert/SomeFoodAlert.cs @@ -0,0 +1,62 @@ +using System; +using System.Linq; +using System.Collections.Generic; +using RimWorld; +using Verse; +using UnityEngine; + +namespace FoodAlert +{ + public class Alert_SomeFood : Alert + { + private const float NutritionThresholdPerColonist = 4f; + + public Alert_SomeFood() + { + this.defaultLabel = "SomeFood".Translate(); + this.defaultPriority = AlertPriority.Medium; + } + + public override string GetExplanation() + { + Map map = this.MapWithSomeFood(); + if (map == null) + { + return string.Empty; + } + float totalHumanEdibleNutrition = map.resourceCounter.TotalHumanEdibleNutrition; + int num = map.mapPawns.FreeColonistsSpawnedCount + (from pr in map.mapPawns.PrisonersOfColony + where pr.guest.GetsFood + select pr).Count(); + int num2 = Mathf.FloorToInt(totalHumanEdibleNutrition / (float)num); + return string.Format("SomeFoodDesc".Translate(), totalHumanEdibleNutrition.ToString("F0"), num.ToStringCached(), num2.ToStringCached()); + } + + public override AlertReport GetReport() + { + if (Find.TickManager.TicksGame < 150000) + { + return false; + } + return this.MapWithSomeFood() != null; + } + + private Map MapWithSomeFood() + { + List maps = Find.Maps; + for (int i = 0; i < maps.Count; i++) + { + Map map = maps[i]; + if (map.IsPlayerHome) + { + int freeColonistsSpawnedCount = map.mapPawns.FreeColonistsSpawnedCount; + if (map.resourceCounter.TotalHumanEdibleNutrition > 4f * (float)freeColonistsSpawnedCount) + { + return map; + } + } + } + return null; + } + } +} diff --git a/FoodAlert/FoodAlert/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/FoodAlert/FoodAlert/obj/Debug/DesignTimeResolveAssemblyReferences.cache new file mode 100644 index 0000000..67146ca Binary files /dev/null and b/FoodAlert/FoodAlert/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/FoodAlert/FoodAlert/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/FoodAlert/FoodAlert/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..afce61d Binary files /dev/null and b/FoodAlert/FoodAlert/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/FoodAlert/FoodAlert/obj/Debug/FoodAlert.csproj.FileListAbsolute.txt b/FoodAlert/FoodAlert/obj/Debug/FoodAlert.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..c9b2356 --- /dev/null +++ b/FoodAlert/FoodAlert/obj/Debug/FoodAlert.csproj.FileListAbsolute.txt @@ -0,0 +1,3 @@ +C:\Users\Maniak\Documents\RimWorld Mods\Assemblies\FoodAlert.dll +C:\Users\Maniak\Documents\RimWorld Mods\FoodAlert\FoodAlert\FoodAlert\obj\Debug\FoodAlert.csprojResolveAssemblyReference.cache +C:\Users\Maniak\Documents\RimWorld Mods\FoodAlert\FoodAlert\FoodAlert\obj\Debug\FoodAlert.dll diff --git a/FoodAlert/FoodAlert/obj/Debug/FoodAlert.csprojResolveAssemblyReference.cache b/FoodAlert/FoodAlert/obj/Debug/FoodAlert.csprojResolveAssemblyReference.cache new file mode 100644 index 0000000..29524f0 Binary files /dev/null and b/FoodAlert/FoodAlert/obj/Debug/FoodAlert.csprojResolveAssemblyReference.cache differ diff --git a/FoodAlert/FoodAlert/obj/Debug/FoodAlert.dll b/FoodAlert/FoodAlert/obj/Debug/FoodAlert.dll new file mode 100644 index 0000000..08df1f8 Binary files /dev/null and b/FoodAlert/FoodAlert/obj/Debug/FoodAlert.dll differ diff --git a/Languages/English/Keyed/SomeFood.xml b/Languages/English/Keyed/SomeFood.xml new file mode 100644 index 0000000..b5a0e90 --- /dev/null +++ b/Languages/English/Keyed/SomeFood.xml @@ -0,0 +1,7 @@ + + + + Food reserves + Food is not of an immediate concern.\n\n Full bars worth of food in storage: {0}\n Colonists and prisoners getting food: {1}\n Days worth of food in storage: {2}\n\nThat is a decent amount of food. + + \ No newline at end of file