Decompiled source of SchleemieStickers v1.0.0

SchleemieStickers.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SchleemieStickers")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SchleemieStickers")]
[assembly: AssemblyTitle("SchleemieStickers")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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;
		}
	}
}
[BepInPlugin("local.schleemiestickers", "SchleemieStickers", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private class Sticker
	{
		public string file;

		public float width;

		public Transform t;

		public Collider col;

		public ConfigEntry<Vector3> pos;

		public ConfigEntry<Quaternion> rot;

		public ConfigEntry<bool> placed;
	}

	private Sticker[] stickers;

	private Sticker held;

	private float roll;

	private float nextCheck;

	private bool ran;

	private ConfigEntry<Key> grabKey;

	private ConfigEntry<bool> autoLand;

	private int landStage;

	private float landAt;

	private void Awake()
	{
		((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
		grabKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Controls", "GrabKey", (Key)100, "Look at a sticker, press to pick it up. It sticks to whatever surface you aim at. Scroll = rotate. Press again to drop and save.");
		autoLand = ((BaseUnityPlugin)this).Config.Bind<bool>("Dev", "AutoLandAtCompany", false, "Host only: after loading the ship, route to the Company building and pull the lever (for testing).");
		stickers = new Sticker[2]
		{
			New("schleemies.png", 1.2f, "Schleemies"),
			New("glorto.png", 0.9f, "Glorto")
		};
	}

	private Sticker New(string file, float w, string name)
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		return new Sticker
		{
			file = file,
			width = w,
			placed = ((BaseUnityPlugin)this).Config.Bind<bool>(name, "PlacedByDoor", false, "false = on next ship load, auto-place right of the ship door; set true automatically (or when you move it)."),
			pos = ((BaseUnityPlugin)this).Config.Bind<Vector3>(name, "LocalPosition", Vector3.zero, (ConfigDescription)null),
			rot = ((BaseUnityPlugin)this).Config.Bind<Quaternion>(name, "LocalRotation", Quaternion.LookRotation(Vector3.right, Vector3.up), (ConfigDescription)null)
		};
	}

	private void Update()
	{
		//IL_0187: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_023e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0204: Unknown result type (might be due to invalid IL or missing references)
		//IL_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0213: Unknown result type (might be due to invalid IL or missing references)
		//IL_0228: Unknown result type (might be due to invalid IL or missing references)
		//IL_022d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0106: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		if (!ran)
		{
			ran = true;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Update running");
		}
		if (Time.time > nextCheck)
		{
			nextCheck = Time.time + 1f;
			Spawn();
		}
		AutoLand();
		Keyboard current = Keyboard.current;
		PlayerControllerB val = StartOfRound.Instance?.localPlayerController;
		if (current == null || (Object)(object)val == (Object)null || (Object)(object)stickers[0].t == (Object)null)
		{
			return;
		}
		Transform transform = ((Component)val.gameplayCamera).transform;
		if (held == null)
		{
			if (!((ButtonControl)current[grabKey.Value]).wasPressedThisFrame)
			{
				return;
			}
			RaycastHit[] array = Physics.RaycastAll(transform.position, transform.forward, 12f, -1, (QueryTriggerInteraction)1);
			Array.Sort(array, (RaycastHit a, RaycastHit c) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref c)).distance));
			RaycastHit[] array2 = array;
			for (int num = 0; num < array2.Length; num++)
			{
				RaycastHit h = array2[num];
				Sticker sticker = Array.Find(stickers, (Sticker x) => (Object)(object)x.col == (Object)(object)((RaycastHit)(ref h)).collider);
				if (sticker != null)
				{
					held = sticker;
					roll = 0f;
					sticker.col.enabled = false;
					break;
				}
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)("grab pressed, held=" + (held != null)));
		}
		else
		{
			if (FirstVisible(transform.position, transform.forward, 15f, out var hit))
			{
				roll += ((InputControl<Vector2>)(object)Mouse.current.scroll).ReadValue().y * 0.05f;
				held.t.position = ((RaycastHit)(ref hit)).point + ((RaycastHit)(ref hit)).normal * 0.01f;
				held.t.rotation = Quaternion.LookRotation(-((RaycastHit)(ref hit)).normal, Vector3.up) * Quaternion.Euler(0f, 0f, roll);
			}
			if (((ButtonControl)current[grabKey.Value]).wasPressedThisFrame)
			{
				held.col.enabled = true;
				held.placed.Value = true;
				held.pos.Value = held.t.localPosition;
				held.rot.Value = held.t.localRotation;
				((BaseUnityPlugin)this).Config.Save();
				held = null;
			}
		}
	}

	private static bool FirstVisible(Vector3 o, Vector3 d, float len, out RaycastHit hit)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		RaycastHit[] array = Physics.RaycastAll(o, d, len, -1, (QueryTriggerInteraction)1);
		Array.Sort(array, (RaycastHit a, RaycastHit c) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref c)).distance));
		RaycastHit[] array2 = array;
		for (int num = 0; num < array2.Length; num++)
		{
			RaycastHit val = array2[num];
			Renderer component = ((Component)((RaycastHit)(ref val)).collider).GetComponent<Renderer>();
			if ((Object)(object)component != (Object)null && component.enabled)
			{
				hit = val;
				return true;
			}
		}
		hit = default(RaycastHit);
		return false;
	}

	private void Spawn()
	{
		//IL_008a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Expected O, but got Unknown
		//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Expected O, but got Unknown
		//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.Find("HangarShip");
		if ((Object)(object)val != (Object)null && (Object)(object)stickers[0].t == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"HangarShip found, spawning stickers");
		}
		if ((Object)(object)val == (Object)null || (Object)(object)stickers[0].t != (Object)null)
		{
			return;
		}
		MeshRenderer componentInChildren = val.GetComponentInChildren<MeshRenderer>();
		Material val2 = ((componentInChildren != null) ? ((Renderer)componentInChildren).sharedMaterial : null);
		if ((Object)(object)val2 == (Object)null)
		{
			return;
		}
		Sticker[] array = stickers;
		foreach (Sticker sticker in array)
		{
			Texture2D val3 = new Texture2D(2, 2);
			ImageConversion.LoadImage(val3, File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), sticker.file)));
			Material val4 = new Material(val2);
			val4.mainTexture = (Texture)(object)val3;
			val4.SetTexture("_BaseColorMap", (Texture)(object)val3);
			val4.SetColor("_BaseColor", Color.white);
			((Texture)val3).wrapMode = (TextureWrapMode)1;
			((Texture)val3).filterMode = (FilterMode)1;
			string[] array2 = new string[2] { "_BaseColorMap", "_MainTex" };
			foreach (string text in array2)
			{
				val4.SetTextureScale(text, Vector2.one);
				val4.SetTextureOffset(text, Vector2.zero);
			}
			array2 = new string[4] { "_DetailMap", "_EmissiveColorMap", "_HeightMap", "_BentNormalMap" };
			foreach (string text2 in array2)
			{
				if (val4.HasProperty(text2))
				{
					val4.SetTexture(text2, (Texture)null);
				}
			}
			if (val4.HasProperty("_EmissiveColor"))
			{
				val4.SetColor("_EmissiveColor", Color.black);
			}
			if (val4.HasProperty("_UVMappingMask"))
			{
				val4.SetColor("_UVMappingMask", new Color(1f, 0f, 0f, 0f));
			}
			val4.SetTexture("_NormalMap", (Texture)null);
			val4.SetTexture("_MaskMap", (Texture)null);
			val4.SetFloat("_Metallic", 0f);
			GameObject val5 = GameObject.CreatePrimitive((PrimitiveType)5);
			((Object)val5).name = "Sticker_" + sticker.file;
			((Renderer)val5.GetComponent<MeshRenderer>()).sharedMaterial = val4;
			sticker.t = val5.transform;
			sticker.col = val5.GetComponent<Collider>();
			sticker.t.SetParent(val.transform, false);
			sticker.t.localScale = new Vector3(sticker.width, sticker.width * (float)((Texture)val3).height / (float)((Texture)val3).width, 1f);
			sticker.t.localPosition = sticker.pos.Value;
			sticker.t.localRotation = sticker.rot.Value;
			sticker.col.enabled = sticker.placed.Value;
		}
		PlaceByDoor(val);
		array = stickers;
		for (int i = 0; i < array.Length; i++)
		{
			array[i].col.enabled = true;
		}
	}

	private unsafe void PlaceByDoor(GameObject ship)
	{
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0064: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: Unknown result type (might be due to invalid IL or missing references)
		//IL_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_015c: Unknown result type (might be due to invalid IL or missing references)
		//IL_016a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0181: Unknown result type (might be due to invalid IL or missing references)
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_0226: Unknown result type (might be due to invalid IL or missing references)
		//IL_0235: Unknown result type (might be due to invalid IL or missing references)
		//IL_0242: Unknown result type (might be due to invalid IL or missing references)
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_026a: Unknown result type (might be due to invalid IL or missing references)
		//IL_026f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0278: Unknown result type (might be due to invalid IL or missing references)
		//IL_027d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_029a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0301: Unknown result type (might be due to invalid IL or missing references)
		//IL_030d: Unknown result type (might be due to invalid IL or missing references)
		//IL_031f: Unknown result type (might be due to invalid IL or missing references)
		//IL_032e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0330: Unknown result type (might be due to invalid IL or missing references)
		//IL_0334: Unknown result type (might be due to invalid IL or missing references)
		//IL_0336: Unknown result type (might be due to invalid IL or missing references)
		//IL_033e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0343: Unknown result type (might be due to invalid IL or missing references)
		//IL_0347: Unknown result type (might be due to invalid IL or missing references)
		//IL_034c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0356: Unknown result type (might be due to invalid IL or missing references)
		//IL_0358: Unknown result type (might be due to invalid IL or missing references)
		//IL_0360: Unknown result type (might be due to invalid IL or missing references)
		//IL_0365: Unknown result type (might be due to invalid IL or missing references)
		//IL_036a: Unknown result type (might be due to invalid IL or missing references)
		//IL_036f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0371: Unknown result type (might be due to invalid IL or missing references)
		//IL_0373: Unknown result type (might be due to invalid IL or missing references)
		//IL_0375: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_04dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0505: Unknown result type (might be due to invalid IL or missing references)
		//IL_050a: Unknown result type (might be due to invalid IL or missing references)
		//IL_050f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0514: Unknown result type (might be due to invalid IL or missing references)
		//IL_052c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0544: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_043c: Unknown result type (might be due to invalid IL or missing references)
		//IL_044b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0479: Unknown result type (might be due to invalid IL or missing references)
		//IL_047e: Unknown result type (might be due to invalid IL or missing references)
		//IL_048c: Unknown result type (might be due to invalid IL or missing references)
		//IL_048e: Unknown result type (might be due to invalid IL or missing references)
		Animator val = StartOfRound.Instance?.shipDoorsAnimator;
		if ((Object)(object)val == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"no shipDoorsAnimator");
			return;
		}
		Bounds? val2 = null;
		Renderer[] componentsInChildren = ((Component)val).GetComponentsInChildren<Renderer>();
		foreach (Renderer val3 in componentsInChildren)
		{
			ManualLogSource logger = ((BaseUnityPlugin)this).Logger;
			string name = ((Object)val3).name;
			Bounds bounds = val3.bounds;
			object arg = ((Bounds)(ref bounds)).min;
			bounds = val3.bounds;
			logger.LogInfo((object)$"doorpart {name} min={arg} max={((Bounds)(ref bounds)).max}");
			if (((Object)val3).name.StartsWith("HangarDoor"))
			{
				if (!val2.HasValue)
				{
					val2 = val3.bounds;
					continue;
				}
				Bounds value = val2.Value;
				((Bounds)(ref value)).Encapsulate(val3.bounds);
				val2 = value;
			}
		}
		if (!val2.HasValue)
		{
			((BaseUnityPlugin)this).Logger.LogWarning((object)"no HangarDoor panels");
			return;
		}
		Bounds value2 = val2.Value;
		Renderer[] componentsInChildren2 = ship.GetComponentsInChildren<Renderer>();
		Bounds bounds2 = componentsInChildren2[0].bounds;
		componentsInChildren = componentsInChildren2;
		foreach (Renderer val4 in componentsInChildren)
		{
			((Bounds)(ref bounds2)).Encapsulate(val4.bounds);
		}
		Vector3 val5 = ((Bounds)(ref value2)).center - ((Bounds)(ref bounds2)).center;
		val5.y = 0f;
		Vector3 val6 = ((Mathf.Abs(Vector3.Dot(val5, ship.transform.right)) > Mathf.Abs(Vector3.Dot(val5, ship.transform.forward))) ? ship.transform.right : ship.transform.forward);
		Vector3 val7 = val6 * Mathf.Sign(Vector3.Dot(val5, val6));
		Vector3 val8 = Vector3.Cross(Vector3.up, -val7);
		float num = Vector3.Dot(((Bounds)(ref value2)).center, val8) + Mathf.Abs(Vector3.Dot(((Bounds)(ref value2)).extents, val8));
		((BaseUnityPlugin)this).Logger.LogInfo((object)$"doorpanels center={((Bounds)(ref value2)).center} ext={((Bounds)(ref value2)).extents} shipCenter={((Bounds)(ref bounds2)).center} outward={val7} right={val8} rightEdge={num}");
		float num2 = Vector3.Dot(((Bounds)(ref value2)).center, val7) + Mathf.Abs(Vector3.Dot(((Bounds)(ref value2)).extents, val7));
		float num3 = 0.8f;
		float num4 = Mathf.Abs(Vector3.Dot(((Bounds)(ref bounds2)).extents, val8)) + 5f;
		Sticker[] array = stickers;
		Vector3 val9 = default(Vector3);
		foreach (Sticker sticker in array)
		{
			if (sticker.placed.Value)
			{
				continue;
			}
			float num5 = num2 - num3 - sticker.width / 2f;
			num3 += sticker.width + 0.4f;
			((Vector3)(ref val9))..ctor(((Bounds)(ref value2)).center.x, ((Bounds)(ref value2)).min.y + 1.5f, ((Bounds)(ref value2)).center.z);
			val9 += val7 * (num5 - Vector3.Dot(val9, val7)) + val8 * (Vector3.Dot(((Bounds)(ref bounds2)).center, val8) + num4 - Vector3.Dot(val9, val8));
			RaycastHit[] array2 = Physics.RaycastAll(val9, -val8, 2f * num4, -1, (QueryTriggerInteraction)1);
			Array.Sort(array2, (RaycastHit a, RaycastHit c) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref c)).distance));
			RaycastHit val10 = default(RaycastHit);
			bool flag = false;
			RaycastHit[] array3 = array2;
			for (int num6 = 0; num6 < array3.Length; num6++)
			{
				RaycastHit val11 = array3[num6];
				Renderer component = ((Component)((RaycastHit)(ref val11)).collider).GetComponent<Renderer>();
				ManualLogSource logger2 = ((BaseUnityPlugin)this).Logger;
				object[] array4 = new object[5];
				Transform parent = ((Component)((RaycastHit)(ref val11)).collider).transform.parent;
				array4[0] = ((parent != null) ? ((Object)parent).name : null);
				array4[1] = ((Object)((RaycastHit)(ref val11)).collider).name;
				array4[2] = (Object)(object)component != (Object)null && component.enabled;
				array4[3] = ((RaycastHit)(ref val11)).point;
				array4[4] = ((RaycastHit)(ref val11)).normal;
				logger2.LogInfo((object)string.Format("wall {0}/{1} visible={2} at {3} n={4}", array4));
				if (!flag && (Object)(object)component != (Object)null && component.enabled && Vector3.Dot(((RaycastHit)(ref val11)).normal, val8) > 0.5f)
				{
					val10 = val11;
					flag = true;
				}
			}
			if (!flag)
			{
				ManualLogSource logger3 = ((BaseUnityPlugin)this).Logger;
				Vector3 val12 = val9;
				logger3.LogWarning((object)("no visible wall hit from " + ((object)(*(Vector3*)(&val12))/*cast due to .constrained prefix*/).ToString()));
			}
			else
			{
				sticker.t.position = ((RaycastHit)(ref val10)).point + ((RaycastHit)(ref val10)).normal * 0.01f;
				sticker.t.rotation = Quaternion.LookRotation(-((RaycastHit)(ref val10)).normal, Vector3.up);
				sticker.pos.Value = sticker.t.localPosition;
				sticker.rot.Value = sticker.t.localRotation;
				sticker.placed.Value = true;
			}
		}
		((BaseUnityPlugin)this).Config.Save();
	}

	private void AutoLand()
	{
		StartOfRound instance = StartOfRound.Instance;
		if (!autoLand.Value || landStage > 1 || (Object)(object)instance == (Object)null || !((NetworkBehaviour)instance).IsHost || !instance.inShipPhase)
		{
			return;
		}
		if (landAt == 0f)
		{
			landAt = Time.time + 8f;
		}
		if (!(Time.time < landAt))
		{
			if (landStage == 0)
			{
				instance.ChangeLevelServerRpc(3, Object.FindObjectOfType<Terminal>().groupCredits);
				landStage = 1;
				landAt = Time.time + 3f;
			}
			else
			{
				instance.StartGameServerRpc();
				landStage = 2;
			}
		}
	}
}