Skip to content

Instantly share code, notes, and snippets.

@Gaelan
Created July 7, 2018 06:32
Show Gist options
  • Save Gaelan/3bcc486557520e8ec116b4e858727227 to your computer and use it in GitHub Desktop.
Save Gaelan/3bcc486557520e8ec116b4e858727227 to your computer and use it in GitHub Desktop.
using System;
using System.Diagnostics.CodeAnalysis;
using Harmony;
using HugsLib;
using JetBrains.Annotations;
using RimWorld;
using Verse;
namespace MorePawns
{
[UsedImplicitly]
public class Mod : ModBase
{
public override string ModIdentifier { get; } = "MorePawns";
[ThreadStatic] internal static bool InConfigureStartingPawns;
}
[HarmonyPatch(typeof(Widgets), "TextFieldNumeric")]
internal static class TextFieldNumericPatch
{
[HarmonyPrefix]
public static void ReplaceMax(ref float max)
{
if (Mod.InConfigureStartingPawns)
{
max = 1E+09f;
}
}
}
[HarmonyPatch(typeof(ScenPart_ConfigPage_ConfigureStartingPawns), "DoEditInterface")]
[UsedImplicitly]
internal static class ScenPartPatch
{
[HarmonyPrefix]
[UsedImplicitly]
public static void Prefix() => Mod.InConfigureStartingPawns = true;
[HarmonyPostfix]
[UsedImplicitly]
public static void Postfix() => Mod.InConfigureStartingPawns = false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment