Decompiled source of Immortal Followers v1.0.0

plugins/Immortal Followers.dll

Decompiled 3 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Mod Dev")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mod Dev")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("edd7670d-f825-4d68-befb-3fc99a3478fb")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("OrionBonnie", "Immortal Followers", "1.0.0")]
public class ImmortalFollowersPlugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(Follower), "Start")]
	private static class Follower_Start_Patch
	{
		private static void Postfix(Follower __instance)
		{
			AddImmortal(__instance);
		}
	}

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		new Harmony("Immortal Followers").PatchAll();
		MakeAllExistingFollowersImmortal();
	}

	private static void MakeAllExistingFollowersImmortal()
	{
		Follower[] array = Object.FindObjectsOfType<Follower>(true);
		foreach (Follower follower in array)
		{
			AddImmortal(follower);
		}
	}

	private static void AddImmortal(Follower follower)
	{
		if (!((Object)(object)follower == (Object)null) && !follower.Brain.HasTrait((TraitType)32))
		{
			follower.AddTrait((TraitType)32, false);
		}
	}
}