Initial commit

This commit is contained in:
2022-12-30 00:58:33 +01:00
commit 3f1075e67f
176 changed files with 25715 additions and 0 deletions

63
mod/Mod.cs Normal file
View File

@@ -0,0 +1,63 @@
using HarmonyLib;
using PeterHan.PLib.Core;
using PeterHan.PLib.Database;
using PeterHan.PLib.Options;
namespace PriorityUX {
public class Mod : KMod.UserMod2 {
// public static readonly Type[] ToolTypes = {
// typeof(AttackTool),
// typeof(CaptureTool),
// typeof(ClearTool),
// typeof(DeconstructTool),
// typeof(DigTool),
// typeof(EmptyPipeTool),
// typeof(HarvestTool),
// typeof(MopTool),
// typeof(PrioritizeTool),
// };
public override void OnLoad(Harmony harmony) {
Debug.Log("UX Mod Load");
Harmony.DEBUG = true;
base.OnLoad(harmony);
Debug.Log("UX Mod PostLoad base");
PUtil.InitLibrary();
LocString.CreateLocStringKeys(typeof(Strings.PRIORITYUX));
new PLocalization().Register();
new POptions().RegisterOptions(this, typeof(Options));
// MethodInfo patchMethod = typeof(GenericToolPatches).GetMethod(nameof(GenericToolPatches.OnActivateTranspiler));
// foreach (var toolType in ToolTypes) {
// MethodInfo method = toolType.GetMethod("OnActivateTool", BindingFlags.NonPublic);
// harmony.Patch(method, postfix: new HarmonyMethod(patchMethod));
// }
}
}
// static class DefaultPriorityFixes {
// [HarmonyPatch(typeof(Capturable), nameof(Capturable.MarkForCapture))]
// [HarmonyPrefix]
// static bool Capturable_MarkForCapture(Capturable __instance, bool mark) {
// Debug.Log("[PriorityUX] >> Capturable_MarkForCapture");
// PrioritySetting priority = new PrioritySetting(PriorityScreen.PriorityClass.basic, 5);
// __instance.MarkForCapture(mark, priority);
// return true;
// }
// static readonly FieldInfo masterPrioritySetting = typeof(Prioritizable).GetField("masterPrioritySetting", BindingFlags.NonPublic);
// [HarmonyPatch(typeof(Prioritizable), "OnSpawn")]
// [HarmonyPrefix]
// static void OnSpawn(object __instance) {
// if (Options.Instance.buildingsInheritPriority) {
// Debug.Log("[PriorityUX] >> Set Prioritizable.OnSpawn");
// masterPrioritySetting.SetValue(__instance, Utils.getLastPriority());
// }
// }
// }
}