Decompiled source of BetterPedestrianPathfind v0.0.1

BetterPedestrianPathfind.dll

Decompiled 7 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Game.Prefabs;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Entities;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("BetterPedestrianPathfind")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("BetterPedestrianPathfind")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1+374457e0185521e14a31fed98e68f3f9bd10e2dd")]
[assembly: AssemblyProduct("BetterPedestrianPathfind")]
[assembly: AssemblyTitle("BetterPedestrianPathfind")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BetterPedestrianPathfind
{
	[HarmonyPatch]
	internal class Patches
	{
		[HarmonyPatch(typeof(PedestrianPathfind), "Initialize")]
		[HarmonyPrefix]
		private static bool Prefix(ref EntityManager entityManager, ref Entity entity, PedestrianPathfind __instance)
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			PathfindCostInfo val = default(PathfindCostInfo);
			((PathfindCostInfo)(ref val))..ctor(0f, 0f, 0f, 0.01f);
			PathfindCostInfo val2 = default(PathfindCostInfo);
			((PathfindCostInfo)(ref val2))..ctor(0f, 0f, 0f, 5f);
			PathfindCostInfo val3 = default(PathfindCostInfo);
			((PathfindCostInfo)(ref val3))..ctor(0f, 1000f, 0f, 5f);
			PathfindCostInfo val4 = default(PathfindCostInfo);
			((PathfindCostInfo)(ref val4))..ctor(5f, 0f, 0f, 0f);
			ManualLogSource val5 = Logger.CreateLogSource("BetterPedestrianPathfind");
			val5.LogInfo((object)"Override PedestrianPathfind called");
			Logger.Sources.Remove((ILogSource)(object)val5);
			PathfindPedestrianData val6 = default(PathfindPedestrianData);
			val6.m_WalkingCost = ((PathfindCostInfo)(ref val)).ToPathfindCosts();
			val6.m_CrosswalkCost = ((PathfindCostInfo)(ref val2)).ToPathfindCosts();
			val6.m_UnsafeCrosswalkCost = ((PathfindCostInfo)(ref val3)).ToPathfindCosts();
			val6.m_SpawnCost = ((PathfindCostInfo)(ref val4)).ToPathfindCosts();
			((EntityManager)(ref entityManager)).SetComponentData<PathfindPedestrianData>(entity, val6);
			return false;
		}
	}
	[BepInPlugin("BetterPedestrianPathfind", "BetterPedestrianPathfind", "0.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin BetterPedestrianPathfind is loaded!");
			new Harmony("BetterPedestrianPathfind").PatchAll();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "BetterPedestrianPathfind";

		public const string PLUGIN_NAME = "BetterPedestrianPathfind";

		public const string PLUGIN_VERSION = "0.0.1";
	}
}