/// <summary> /// Sets up AntiSocial. /// </summary> /// <param name="modInstance"></param> private static void DoSetup(Mod modInstance) { if (Instance != null) { modInstance.Monitor.Log($"AntiSocial setup already completed by {AntiSocialManager.modInstance.ModManifest.Name} ({AntiSocialManager.modInstance.ModManifest.UniqueID}).", LogLevel.Warn); return; } Instance = new AntiSocialManager(); AntiSocialManager.modInstance = modInstance; modInstance.Helper.Content.AssetLoaders.Add(Instance); harmonyInstance = HarmonyInstance.Create(OriginModId); harmonyInstance.Patch(original: AccessTools.Method(typeof(NPC), "get_CanSocialize"), postfix: new HarmonyMethod(typeof(AntiSocialManager), "get_CanSocialize_Postfix")); harmonyInstance.Patch(original: AccessTools.Method(typeof(Utility), "getRandomTownNPC", new Type[] { typeof(Random) }), transpiler: new HarmonyMethod(typeof(AntiSocialManager), "getRandomTownNPC_Transpiler")); harmonyInstance.Patch(original: AccessTools.Method(typeof(SocializeQuest), "loadQuestInfo"), transpiler: new HarmonyMethod(typeof(AntiSocialManager), "loadQuestInfo_Transpiler")); }
public override void Entry(IModHelper helper) { AntiSocialManager.DoSetupIfNecessary(this); }