Decompiled source of DSPDistributorSign v0.0.1

DSPDistributorSign.dll

Decompiled 10 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DspFontPatcher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DspFontPatcher")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("81DF3045-8007-4F6A-AAF6-903139D85B6C")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
namespace DSPDistributorSign;

[BepInPlugin("Appun.DSP.plugin.DistributorSign", "DSPDistributorSign", "0.0.1")]
[HarmonyPatch]
public class DSPMiniFogWatch : BaseUnityPlugin
{
	public class LogManager
	{
		public static ManualLogSource Logger;
	}

	public static float magnificationRate = 0.8f;

	public void Awake()
	{
		LogManager.Logger = ((BaseUnityPlugin)this).Logger;
		Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(PlanetTransport), "GameTick")]
	public static void PlanetTransport_GameTick_PrePatch(PlanetTransport __instance)
	{
		SignData[] entitySignPool = __instance.factory.entitySignPool;
		EntityData[] entityPool = __instance.factory.entityPool;
		int num2 = default(int);
		for (int i = 1; i < __instance.dispenserCursor; i++)
		{
			if (__instance.dispenserPool[i] == null || __instance.dispenserPool[i].id != i)
			{
				continue;
			}
			int entityId = __instance.dispenserPool[i].entityId;
			int num = 0;
			if (__instance.dispenserPool[i].storage != null && __instance.dispenserPool[i].filter > 0)
			{
				StorageComponent val = __instance.dispenserPool[i].storage;
				do
				{
					num += val.GetItemCount(__instance.dispenserPool[i].filter, ref num2);
					val = val.previousStorage;
				}
				while (val != null);
			}
			entitySignPool[entityId].iconType = 8u;
			entitySignPool[entityId].iconId0 = (uint)__instance.dispenserPool[i].filter;
			entitySignPool[entityId].count0 = ((num == 0) ? 0.1f : ((float)num));
			entitySignPool[entityId].x = entityPool[entityId].pos.x * 1.02f;
			entitySignPool[entityId].y = entityPool[entityId].pos.y * 1.02f;
			entitySignPool[entityId].z = entityPool[entityId].pos.z * 1.02f;
			entitySignPool[entityId].w = 4f;
		}
	}
}