Decompiled source of ReppoTrashBin v1.0.0

plugins/ReppoTrashBin.dll

Decompiled 31 minutes ago
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Photon.Pun;
using Photon.Realtime;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace ReppoTrashBin;

[BepInPlugin("local.reppo.trashbin", "ReppoTrashBin", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	private const string Magic = "RTB1";

	private const byte EvPosition = 171;

	private const byte EvHello = 172;

	private const byte EvEmpty = 173;

	private const byte EvDone = 174;

	private const float ConfirmSeconds = 5f;

	private const float UseDistance = 3.5f;

	internal static ManualLogSource Log;

	internal static ConfigEntry<bool> Enabled;

	internal static ConfigEntry<string> EmptyKey;

	internal static ConfigEntry<string> MoveKey;

	internal static ConfigEntry<bool> AllowValuables;

	internal static ConfigEntry<bool> UseCustomPosition;

	internal static ConfigEntry<float> CustomX;

	internal static ConfigEntry<float> CustomY;

	internal static ConfigEntry<float> CustomZ;

	internal static ConfigEntry<float> CustomYaw;

	internal static FieldInfo fInstanceName;

	private static TrashBin bin;

	private static bool binFromHost;

	private static float spawnCheckTimer;

	private static string message;

	private static float messageTimer;

	private static bool pending;

	private static float pendingUntil;

	private static bool subscribed;

	private void Awake()
	{
		Log = ((BaseUnityPlugin)this).Logger;
		Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Trash Bin", "TrashBinEnabled", true, "Kuka a teherautóban. A kidobást a host végzi, ezért a hostnál is be kell legyen kapcsolva.");
		EmptyKey = ((BaseUnityPlugin)this).Config.Bind<string>("Trash Bin", "EmptyKey", "delete", "Ezzel a gombbal üríted a kukát (a kuka mellett állva). Első nyomás: kérdez, második nyomás: kidobja.");
		MoveKey = ((BaseUnityPlugin)this).Config.Bind<string>("Trash Bin", "MoveKey", "insert", "Csak host: a kukát oda teszi, ahova nézel (padlóra). A következő pályákon is ott lesz.");
		AllowValuables = ((BaseUnityPlugin)this).Config.Bind<bool>("Trash Bin", "AllowValuables", true, "Értéktárgyakat is ki lehet dobni (pl. hibás modolt értéktárgyakat). Kidobáskor az értékük elvész.");
		UseCustomPosition = ((BaseUnityPlugin)this).Config.Bind<bool>("Placement", "UseCustomPosition", false, "A host által kijelölt helyet használja (az Insert gomb automatikusan bekapcsolja). Kikapcsolva magától keres helyet a töltő mellett.");
		CustomX = ((BaseUnityPlugin)this).Config.Bind<float>("Placement", "CustomOffsetX", 0f, "A kuka helye a töltőállomáshoz képest (automatikusan töltődik).");
		CustomY = ((BaseUnityPlugin)this).Config.Bind<float>("Placement", "CustomOffsetY", 0f, "A kuka helye a töltőállomáshoz képest (automatikusan töltődik).");
		CustomZ = ((BaseUnityPlugin)this).Config.Bind<float>("Placement", "CustomOffsetZ", 0f, "A kuka helye a töltőállomáshoz képest (automatikusan töltődik).");
		CustomYaw = ((BaseUnityPlugin)this).Config.Bind<float>("Placement", "CustomYaw", 0f, "A kuka elforgatása a töltőállomáshoz képest (automatikusan töltődik).");
		fInstanceName = AccessTools.Field(typeof(ItemAttributes), "instanceName");
		TrySubscribe();
		Log.LogInfo((object)("Trash bin ready. Empty key = " + EmptyKey.Value + ", move key = " + MoveKey.Value));
	}

	private static void TrySubscribe()
	{
		if (subscribed)
		{
			return;
		}
		try
		{
			if (PhotonNetwork.NetworkingClient != null)
			{
				PhotonNetwork.NetworkingClient.EventReceived += OnEvent;
				subscribed = true;
			}
		}
		catch (Exception ex)
		{
			Log.LogDebug((object)("Photon not ready yet: " + ex.Message));
		}
	}

	internal static bool IsHost()
	{
		try
		{
			return SemiFunc.IsMasterClientOrSingleplayer();
		}
		catch (Exception)
		{
			return true;
		}
	}

	private static bool IsMultiplayer()
	{
		try
		{
			return SemiFunc.IsMultiplayer();
		}
		catch (Exception)
		{
			return false;
		}
	}

	internal static void Show(string text, float seconds)
	{
		message = text;
		messageTimer = seconds;
	}

	private static bool ChatOpen()
	{
		try
		{
			if ((Object)(object)ChatManager.instance == (Object)null)
			{
				return false;
			}
			return Traverse.Create((object)ChatManager.instance).Field("chatActive").GetValue<bool>();
		}
		catch (Exception)
		{
			return false;
		}
	}

	private static bool KeyPressed(ConfigEntry<string> entry)
	{
		string value = entry.Value;
		if (string.IsNullOrEmpty(value))
		{
			return false;
		}
		Keyboard current = Keyboard.current;
		if (current == null)
		{
			return false;
		}
		ButtonControl val;
		try
		{
			InputControl obj = ((InputControl)current)[value.Trim()];
			val = (ButtonControl)(object)((obj is ButtonControl) ? obj : null);
		}
		catch (Exception)
		{
			return false;
		}
		if (val != null)
		{
			return val.wasPressedThisFrame;
		}
		return false;
	}

	internal static string KeyLabel()
	{
		string text = EmptyKey.Value ?? "";
		if (text.ToLowerInvariant() == "delete")
		{
			return "DEL";
		}
		return text.ToUpperInvariant();
	}

	internal static Camera MainCamera()
	{
		try
		{
			if ((Object)(object)GameDirector.instance != (Object)null && (Object)(object)GameDirector.instance.MainCamera != (Object)null)
			{
				return GameDirector.instance.MainCamera;
			}
		}
		catch (Exception)
		{
		}
		return Camera.main;
	}

	private static bool InLevel()
	{
		try
		{
			return SemiFunc.RunIsLevel() && SemiFunc.LevelGenDone();
		}
		catch (Exception)
		{
			return false;
		}
	}

	private void Update()
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		if (messageTimer > 0f)
		{
			messageTimer -= Time.deltaTime;
			try
			{
				SemiFunc.UIFocusText(message, Color.white, new Color(1f, 0.55f, 0f), 0.2f);
			}
			catch (Exception)
			{
				messageTimer = 0f;
			}
		}
		if (!subscribed)
		{
			TrySubscribe();
		}
		if (!Enabled.Value)
		{
			if ((Object)(object)bin != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)bin).gameObject);
				bin = null;
			}
			return;
		}
		spawnCheckTimer -= Time.deltaTime;
		if ((Object)(object)bin == (Object)null && spawnCheckTimer <= 0f)
		{
			spawnCheckTimer = 1f;
			try
			{
				TrySpawnBin();
			}
			catch (Exception ex2)
			{
				Log.LogWarning((object)("Bin spawn failed: " + ex2.Message));
			}
		}
		if ((Object)(object)bin == (Object)null)
		{
			return;
		}
		if (pending && Time.time > pendingUntil)
		{
			pending = false;
			bin.SetConfirmList(null);
		}
		if (!ChatOpen())
		{
			if (KeyPressed(EmptyKey))
			{
				OnEmptyKey();
			}
			if (KeyPressed(MoveKey))
			{
				OnMoveKey();
			}
		}
	}

	private static void TrySpawnBin()
	{
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: 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_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: 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_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		if (!InLevel())
		{
			return;
		}
		ChargingStation instance = ChargingStation.instance;
		if ((Object)(object)instance == (Object)null)
		{
			return;
		}
		Vector3 pos;
		float yaw;
		if (IsHost() && UseCustomPosition.Value)
		{
			pos = ((Component)instance).transform.TransformPoint(new Vector3(CustomX.Value, CustomY.Value, CustomZ.Value));
			yaw = ((Component)instance).transform.eulerAngles.y + CustomYaw.Value;
			if (Placement.BoxBlockedStatic(pos + Vector3.up * 0.5f, new Vector3(0.45f, 0.4f, 0.45f), null))
			{
				Log.LogInfo((object)"Saved bin spot is blocked here, searching a free one.");
				Placement.FindSpot(((Component)instance).transform, out pos, out yaw);
			}
		}
		else
		{
			Placement.FindSpot(((Component)instance).transform, out pos, out yaw);
		}
		bin = TrashBin.Create(pos, yaw);
		binFromHost = IsHost();
		Log.LogInfo((object)("Trash bin placed at " + ((Vector3)(ref pos)).ToString("F2")));
		if (IsMultiplayer())
		{
			if (IsHost())
			{
				SendPosition(null);
				return;
			}
			Raise(172, new object[1] { "RTB1" }, (ReceiverGroup)2, null);
		}
	}

	private void OnEmptyKey()
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		Camera val = MainCamera();
		if ((Object)(object)val == (Object)null)
		{
			return;
		}
		float num = Vector3.Distance(((Component)val).transform.position, ((Component)bin).transform.position + Vector3.up * 0.5f);
		if (num > 3.5f)
		{
			if (num < 10f)
			{
				Show("Menj közelebb a kukához!", 2f);
			}
			return;
		}
		List<PhysGrabObject> list = bin.Scan();
		if (list.Count == 0)
		{
			pending = false;
			bin.SetConfirmList(null);
			Show("A kuka üres - tegyél bele valamit, amit ki akarsz dobni.", 2.5f);
			return;
		}
		if (!pending)
		{
			pending = true;
			pendingUntil = Time.time + 5f;
			bin.SetConfirmList(list);
			Show("Biztosan kidobod? " + list.Count + " tárgy - nyomd meg újra: " + KeyLabel(), 5f);
			return;
		}
		pending = false;
		bin.SetConfirmList(null);
		int[] array = ViewIds(list);
		if (IsHost())
		{
			HostEmpty(array, LocalActor());
			return;
		}
		Raise(173, new object[2] { "RTB1", array }, (ReceiverGroup)2, null);
		Show("Kuka ürítése...", 1.5f);
	}

	private static int LocalActor()
	{
		try
		{
			return (PhotonNetwork.LocalPlayer != null) ? PhotonNetwork.LocalPlayer.ActorNumber : (-1);
		}
		catch (Exception)
		{
			return -1;
		}
	}

	private static int[] ViewIds(List<PhysGrabObject> list)
	{
		List<int> list2 = new List<int>();
		foreach (PhysGrabObject item in list)
		{
			PhotonView val = (((Object)(object)item != (Object)null) ? ((Component)item).GetComponent<PhotonView>() : null);
			if ((Object)(object)val != (Object)null)
			{
				list2.Add(val.ViewID);
			}
		}
		return list2.ToArray();
	}

	private static void HostEmpty(int[] ids, int requester)
	{
		if ((Object)(object)bin == (Object)null || !InLevel())
		{
			SendDone(0, "", requester, "A kuka itt nem használható.");
			return;
		}
		List<string> list = new List<string>();
		foreach (int num in ids)
		{
			PhotonView val = PhotonView.Find(num);
			if ((Object)(object)val == (Object)null)
			{
				continue;
			}
			PhysGrabObject component = ((Component)val).GetComponent<PhysGrabObject>();
			if ((Object)(object)component == (Object)null || component.dead || component.grabbed || !bin.Accepts(component) || !bin.Contains(component))
			{
				continue;
			}
			try
			{
				ItemAttributes component2 = ((Component)component).GetComponent<ItemAttributes>();
				if ((Object)(object)component2 != (Object)null && fInstanceName != null && (Object)(object)StatsManager.instance != (Object)null && !SemiFunc.RunIsShop())
				{
					string text = fInstanceName.GetValue(component2) as string;
					if (!string.IsNullOrEmpty(text))
					{
						StatsManager.instance.ItemRemove(text);
					}
				}
				PhysGrabObjectImpactDetector component3 = ((Component)component).GetComponent<PhysGrabObjectImpactDetector>();
				if ((Object)(object)component3 != (Object)null)
				{
					component3.DestroyObject(true, true);
				}
				else
				{
					component.DestroyPhysGrabObject();
				}
				list.Add(TrashBin.NameOf(component));
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("Could not throw away " + ((Object)component).name + ": " + ex.Message));
			}
		}
		Log.LogInfo((object)("Trash bin emptied: " + list.Count + " object(s): " + string.Join(", ", list.ToArray())));
		SendDone(list.Count, string.Join("\n", list.ToArray()), requester, null);
	}

	private static void SendDone(int count, string names, int requester, string error)
	{
		object[] data = new object[5]
		{
			"RTB1",
			count,
			names ?? "",
			requester,
			error ?? ""
		};
		if (IsMultiplayer())
		{
			Raise(174, data, (ReceiverGroup)0, null);
		}
		OnDone(data);
	}

	private static void OnDone(object[] data)
	{
		int num = Convert.ToInt32(data[1]);
		string names = data[2] as string;
		int num2 = Convert.ToInt32(data[3]);
		string text = data[4] as string;
		bool flag = num2 == LocalActor() || !IsMultiplayer();
		if (!string.IsNullOrEmpty(text))
		{
			if (flag)
			{
				Show(text, 2.5f);
			}
			return;
		}
		if ((Object)(object)bin != (Object)null)
		{
			bin.FlashDone(num, names);
		}
		if (flag)
		{
			Show((num > 0) ? ("Kidobva: " + num + " tárgy.") : "Nem volt mit kidobni (vedd ki a kezedből, és várd meg, hogy leessen a kukába).", 2.5f);
		}
	}

	private void OnMoveKey()
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_008d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Unknown result type (might be due to invalid IL or missing references)
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0141: Unknown result type (might be due to invalid IL or missing references)
		if (!IsHost())
		{
			Show("A kukát csak a host teheti át.", 2f);
			return;
		}
		Camera val = MainCamera();
		ChargingStation instance = ChargingStation.instance;
		if ((Object)(object)val == (Object)null || (Object)(object)instance == (Object)null)
		{
			return;
		}
		if (!Placement.RaycastStatic(((Component)val).transform.position, ((Component)val).transform.forward, 6f, out var best, ((Component)bin).transform) || ((RaycastHit)(ref best)).normal.y < 0.6f)
		{
			Show("Nézz a padlóra, oda teszem a kukát (max. 6 m).", 2f);
			return;
		}
		Vector3 val2 = ((Component)val).transform.position - ((RaycastHit)(ref best)).point;
		val2.y = 0f;
		float num;
		if (!(((Vector3)(ref val2)).sqrMagnitude > 0.01f))
		{
			num = 0f;
		}
		else
		{
			Quaternion val3 = Quaternion.LookRotation(((Vector3)(ref val2)).normalized);
			num = ((Quaternion)(ref val3)).eulerAngles.y;
		}
		float num2 = num;
		bin.MoveTo(((RaycastHit)(ref best)).point, num2);
		Vector3 val4 = ((Component)instance).transform.InverseTransformPoint(((RaycastHit)(ref best)).point);
		CustomX.Value = val4.x;
		CustomY.Value = val4.y;
		CustomZ.Value = val4.z;
		CustomYaw.Value = Mathf.DeltaAngle(((Component)instance).transform.eulerAngles.y, num2);
		UseCustomPosition.Value = true;
		Show("A kuka új helye elmentve.", 2f);
		if (IsMultiplayer())
		{
			SendPosition(null);
		}
	}

	private static void SendPosition(int[] targets)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)bin == (Object)null))
		{
			Vector3 position = ((Component)bin).transform.position;
			Raise(171, new object[5]
			{
				"RTB1",
				position.x,
				position.y,
				position.z,
				((Component)bin).transform.eulerAngles.y
			}, (ReceiverGroup)((targets == null) ? 0 : 0), targets);
		}
	}

	private static void Raise(byte code, object[] data, ReceiverGroup group, int[] targets)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Expected O, but got Unknown
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			RaiseEventOptions val = new RaiseEventOptions();
			if (targets != null)
			{
				val.TargetActors = targets;
			}
			else
			{
				val.Receivers = group;
			}
			PhotonNetwork.RaiseEvent(code, (object)data, val, SendOptions.SendReliable);
		}
		catch (Exception ex)
		{
			Log.LogWarning((object)("RaiseEvent failed: " + ex.Message));
		}
	}

	private static void OnEvent(EventData ev)
	{
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		if (ev.Code < 171 || ev.Code > 174 || !(ev.CustomData is object[] array) || array.Length == 0 || !(array[0] is string) || (string)array[0] != "RTB1")
		{
			return;
		}
		try
		{
			switch (ev.Code)
			{
			case 171:
				if (!IsHost())
				{
					Vector3 pos = default(Vector3);
					((Vector3)(ref pos))..ctor(Convert.ToSingle(array[1]), Convert.ToSingle(array[2]), Convert.ToSingle(array[3]));
					float yaw = Convert.ToSingle(array[4]);
					if ((Object)(object)bin != (Object)null)
					{
						bin.MoveTo(pos, yaw);
					}
					binFromHost = true;
				}
				break;
			case 172:
				if (IsHost() && Enabled.Value && !((Object)(object)bin == (Object)null))
				{
					SendPosition(new int[1] { ev.Sender });
				}
				break;
			case 173:
				if (IsHost())
				{
					if (!Enabled.Value)
					{
						Raise(174, new object[5] { "RTB1", 0, "", ev.Sender, "A hostnál ki van kapcsolva a kuka." }, (ReceiverGroup)0, new int[1] { ev.Sender });
					}
					else
					{
						HostEmpty((array[1] as int[]) ?? new int[0], ev.Sender);
					}
				}
				break;
			case 174:
				OnDone(array);
				break;
			}
		}
		catch (Exception ex)
		{
			Log.LogWarning((object)("Trash bin event " + ev.Code + " failed: " + ex.Message));
		}
	}
}
internal static class Placement
{
	private static bool IsStatic(Collider c, Transform ignore)
	{
		if ((Object)(object)c == (Object)null || c.isTrigger || (Object)(object)c.attachedRigidbody != (Object)null)
		{
			return false;
		}
		if ((Object)(object)ignore != (Object)null && ((Component)c).transform.IsChildOf(ignore))
		{
			return false;
		}
		return true;
	}

	internal static bool RaycastStatic(Vector3 origin, Vector3 dir, float length, out RaycastHit best, Transform ignore)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		best = default(RaycastHit);
		bool result = false;
		float num = float.MaxValue;
		RaycastHit[] array = Physics.RaycastAll(origin, dir, length, -1, (QueryTriggerInteraction)1);
		for (int i = 0; i < array.Length; i++)
		{
			RaycastHit val = array[i];
			if (IsStatic(((RaycastHit)(ref val)).collider, ignore) && !(((RaycastHit)(ref val)).distance >= num))
			{
				num = ((RaycastHit)(ref val)).distance;
				best = val;
				result = true;
			}
		}
		return result;
	}

	internal static bool BoxBlockedStatic(Vector3 center, Vector3 half, Transform ignore)
	{
		//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_0002: Unknown result type (might be due to invalid IL or missing references)
		Collider[] array = Physics.OverlapBox(center, half, Quaternion.identity, -1, (QueryTriggerInteraction)1);
		foreach (Collider c in array)
		{
			if (IsStatic(c, ignore))
			{
				return true;
			}
		}
		return false;
	}

	private static bool NearMarker(Vector3 p, List<Vector3> markers, float radius)
	{
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		foreach (Vector3 marker in markers)
		{
			float num = marker.x - p.x;
			float num2 = marker.z - p.z;
			if (num * num + num2 * num2 < radius * radius && Mathf.Abs(marker.y - p.y) < 2.5f)
			{
				return true;
			}
		}
		return false;
	}

	internal static bool FindSpot(Transform station, out Vector3 pos, out float yaw)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: 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_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00de: Unknown result type (might be due to invalid IL or missing references)
		//IL_0324: Unknown result type (might be due to invalid IL or missing references)
		//IL_032b: 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_0335: 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_0340: Unknown result type (might be due to invalid IL or missing references)
		//IL_0345: Unknown result type (might be due to invalid IL or missing references)
		//IL_034a: Unknown result type (might be due to invalid IL or missing references)
		//IL_034d: Unknown result type (might be due to invalid IL or missing references)
		//IL_034f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0355: 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_035b: 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_0364: Unknown result type (might be due to invalid IL or missing references)
		//IL_0164: Unknown result type (might be due to invalid IL or missing references)
		//IL_0169: Unknown result type (might be due to invalid IL or missing references)
		//IL_016e: Unknown result type (might be due to invalid IL or missing references)
		//IL_016f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_0178: Unknown result type (might be due to invalid IL or missing references)
		//IL_017c: 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_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_019e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: 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_01fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0202: Unknown result type (might be due to invalid IL or missing references)
		//IL_0207: 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_020b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Unknown result type (might be due to invalid IL or missing references)
		//IL_021f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0221: Unknown result type (might be due to invalid IL or missing references)
		//IL_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_0225: Unknown result type (might be due to invalid IL or missing references)
		//IL_0227: Unknown result type (might be due to invalid IL or missing references)
		//IL_022c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: 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_0237: Unknown result type (might be due to invalid IL or missing references)
		//IL_0239: 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_0254: Unknown result type (might be due to invalid IL or missing references)
		//IL_0256: Unknown result type (might be due to invalid IL or missing references)
		//IL_0260: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: Unknown result type (might be due to invalid IL or missing references)
		//IL_0279: Unknown result type (might be due to invalid IL or missing references)
		//IL_0286: Unknown result type (might be due to invalid IL or missing references)
		//IL_0288: Unknown result type (might be due to invalid IL or missing references)
		//IL_0292: Unknown result type (might be due to invalid IL or missing references)
		//IL_0297: Unknown result type (might be due to invalid IL or missing references)
		//IL_029c: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
		Vector3 position = station.position;
		float y = position.y;
		if (RaycastStatic(position + Vector3.up * 0.5f, Vector3.down, 3f, out var best, null))
		{
			y = ((RaycastHit)(ref best)).point.y;
		}
		Vector3 val = Vector3.ProjectOnPlane(station.forward, Vector3.up);
		if (((Vector3)(ref val)).sqrMagnitude < 0.01f)
		{
			val = Vector3.forward;
		}
		((Vector3)(ref val)).Normalize();
		List<Vector3> list = new List<Vector3>();
		ItemVolume[] array = Object.FindObjectsByType<ItemVolume>((FindObjectsSortMode)0);
		foreach (ItemVolume val2 in array)
		{
			if ((Object)(object)val2 != (Object)null)
			{
				list.Add(((Component)val2).transform.position);
			}
		}
		SpawnPoint[] array2 = Object.FindObjectsByType<SpawnPoint>((FindObjectsSortMode)0);
		foreach (SpawnPoint val3 in array2)
		{
			if ((Object)(object)val3 != (Object)null)
			{
				list.Add(((Component)val3).transform.position);
			}
		}
		float[] array3 = new float[4] { 1.4f, 1.9f, 2.5f, 3.2f };
		float[] array4 = new float[8] { 90f, -90f, 45f, -45f, 135f, -135f, 180f, 0f };
		Vector3 val4 = default(Vector3);
		((Vector3)(ref val4))..ctor(position.x, y, position.z);
		for (int k = 0; k < 2; k++)
		{
			float[] array5 = array3;
			foreach (float num in array5)
			{
				float[] array6 = array4;
				foreach (float num2 in array6)
				{
					Vector3 val5 = Quaternion.AngleAxis(num2, Vector3.up) * val;
					Vector3 val6 = val4 + val5 * num;
					if (RaycastStatic(val6 + Vector3.up * 1f, Vector3.down, 2f, out best, null) && !(((RaycastHit)(ref best)).normal.y < 0.8f) && !(Mathf.Abs(((RaycastHit)(ref best)).point.y - y) > 0.35f))
					{
						Vector3 point = ((RaycastHit)(ref best)).point;
						Vector3 val7 = val4 + Vector3.up * 0.6f;
						Vector3 val8 = point + Vector3.up * 0.6f;
						Vector3 val9 = val8 - val7;
						Vector3 normalized = ((Vector3)(ref val9)).normalized;
						Vector3 val10 = val8 - val7;
						if (!RaycastStatic(val7, normalized, ((Vector3)(ref val10)).magnitude, out var best2, null) && !BoxBlockedStatic(point + Vector3.up * 0.5f, new Vector3(0.6f, 0.45f, 0.6f), null) && !RaycastStatic(point + Vector3.up * 0.1f, Vector3.up, 1.5f, out best2, null) && (k != 0 || !NearMarker(point, list, 1f)))
						{
							pos = point;
							Vector3 val11 = -val5;
							Quaternion val12 = Quaternion.LookRotation(val11);
							yaw = ((Quaternion)(ref val12)).eulerAngles.y;
							return true;
						}
					}
				}
			}
		}
		Vector3 val13 = val4 + Quaternion.AngleAxis(90f, Vector3.up) * val * 1.4f;
		pos = val13;
		Quaternion val14 = Quaternion.LookRotation(-val);
		yaw = ((Quaternion)(ref val14)).eulerAngles.y;
		Plugin.Log.LogInfo((object)"No free spot found for the trash bin, using the side of the charging station.");
		return false;
	}
}
public class TrashBin : MonoBehaviour
{
	private const float Inner = 0.9f;

	private const float Height = 0.75f;

	private const float Wall = 0.05f;

	private TMP_Text label;

	private MeshRenderer labelRenderer;

	private float scanTimer;

	private int lastCount = -1;

	private List<string> confirmNames;

	private float doneUntil;

	private string doneText;

	private readonly List<PhysGrabObject> found = new List<PhysGrabObject>();

	private readonly HashSet<int> seen = new HashSet<int>();

	public static TrashBin Create(Vector3 pos, float yaw)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Expected O, but got Unknown
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("ReppoTrashBin");
		val.transform.position = pos;
		val.transform.rotation = Quaternion.Euler(0f, yaw, 0f);
		TrashBin trashBin = val.AddComponent<TrashBin>();
		trashBin.Build();
		return trashBin;
	}

	private void Build()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_009f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: 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)
		//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_014a: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0174: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: 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_01f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_020b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0212: Unknown result type (might be due to invalid IL or missing references)
		//IL_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Expected O, but got Unknown
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
		Material mat = null;
		Material mat2 = null;
		float num = 0.475f;
		mat = Part("Bottom", new Vector3(0f, 0.03f, 0f), new Vector3(1f, 0.06f, 1f), ref mat, new Color(0.13f, 0.14f, 0.16f), solid: true);
		Part("Front", new Vector3(0f, 0.375f, num), new Vector3(1f, 0.75f, 0.05f), ref mat, Color.black, solid: true);
		Part("Back", new Vector3(0f, 0.375f, 0f - num), new Vector3(1f, 0.75f, 0.05f), ref mat, Color.black, solid: true);
		Part("Left", new Vector3(0f - num, 0.375f, 0f), new Vector3(0.05f, 0.75f, 0.9f), ref mat, Color.black, solid: true);
		Part("Right", new Vector3(num, 0.375f, 0f), new Vector3(0.05f, 0.75f, 0.9f), ref mat, Color.black, solid: true);
		float num2 = 0.77f;
		mat2 = Part("RimFront", new Vector3(0f, num2, num), new Vector3(1.02f, 0.05f, 0.07f), ref mat2, new Color(1f, 0.55f, 0f), solid: false);
		Part("RimBack", new Vector3(0f, num2, 0f - num), new Vector3(1.02f, 0.05f, 0.07f), ref mat2, Color.black, solid: false);
		Part("RimLeft", new Vector3(0f - num, num2, 0f), new Vector3(0.07f, 0.05f, 0.9f), ref mat2, Color.black, solid: false);
		Part("RimRight", new Vector3(num, num2, 0f), new Vector3(0.07f, 0.05f, 0.9f), ref mat2, Color.black, solid: false);
		GameObject val = new GameObject("Label");
		val.transform.SetParent(((Component)this).transform, false);
		val.transform.localPosition = new Vector3(0f, 0.87f, 0f);
		TextMeshPro val2 = val.AddComponent<TextMeshPro>();
		TMP_FontAsset val3 = FindGameFont();
		if ((Object)(object)val3 != (Object)null)
		{
			((TMP_Text)val2).font = val3;
		}
		((TMP_Text)val2).fontSize = 1.4f;
		((TMP_Text)val2).textWrappingMode = (TextWrappingModes)0;
		((TMP_Text)val2).alignment = (TextAlignmentOptions)1026;
		((TMP_Text)val2).rectTransform.pivot = new Vector2(0.5f, 0f);
		((TMP_Text)val2).rectTransform.sizeDelta = new Vector2(3f, 2f);
		((Graphic)val2).color = new Color(1f, 0.8f, 0.4f);
		((TMP_Text)val2).text = "KUKA";
		label = (TMP_Text)(object)val2;
		labelRenderer = val.GetComponent<MeshRenderer>();
	}

	private static TMP_FontAsset FindGameFont()
	{
		Dictionary<TMP_FontAsset, int> dictionary = new Dictionary<TMP_FontAsset, int>();
		TMP_FontAsset val = null;
		int num = 0;
		try
		{
			TMP_Text[] array = Object.FindObjectsByType<TMP_Text>((FindObjectsSortMode)0);
			foreach (TMP_Text val2 in array)
			{
				if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.font == (Object)null))
				{
					dictionary.TryGetValue(val2.font, out var value);
					value++;
					dictionary[val2.font] = value;
					if (value > num)
					{
						num = value;
						val = val2.font;
					}
				}
			}
		}
		catch (Exception)
		{
		}
		if ((Object)(object)val == (Object)null)
		{
			try
			{
				val = TMP_Settings.defaultFontAsset;
			}
			catch (Exception)
			{
			}
		}
		return val;
	}

	private Material Part(string name, Vector3 localPos, Vector3 size, ref Material mat, Color color, bool solid)
	{
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0085: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Expected O, but got Unknown
		//IL_008e: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
		((Object)val).name = name;
		val.transform.SetParent(((Component)this).transform, false);
		val.transform.localPosition = localPos;
		val.transform.localRotation = Quaternion.identity;
		val.transform.localScale = size;
		if (!solid)
		{
			Collider component = val.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
		}
		MeshRenderer component2 = val.GetComponent<MeshRenderer>();
		if ((Object)(object)component2 != (Object)null)
		{
			if ((Object)(object)mat == (Object)null)
			{
				mat = new Material(((Renderer)component2).sharedMaterial);
				mat.color = color;
			}
			((Renderer)component2).sharedMaterial = mat;
			((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0;
		}
		return mat;
	}

	public void MoveTo(Vector3 pos, float yaw)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_001d: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).transform.position = pos;
		((Component)this).transform.rotation = Quaternion.Euler(0f, yaw, 0f);
	}

	internal bool Accepts(PhysGrabObject p)
	{
		if ((Object)(object)p == (Object)null || p.dead)
		{
			return false;
		}
		if ((Object)(object)((Component)p).GetComponent<PhysGrabCart>() != (Object)null)
		{
			return false;
		}
		if ((Object)(object)((Component)p).GetComponent<PlayerDeathHead>() != (Object)null)
		{
			return false;
		}
		if ((Object)(object)((Component)p).GetComponent<EnemyRigidbody>() != (Object)null)
		{
			return false;
		}
		if ((Object)(object)((Component)p).GetComponentInParent<PlayerAvatar>() != (Object)null)
		{
			return false;
		}
		if ((Object)(object)((Component)p).GetComponent<ItemAttributes>() != (Object)null)
		{
			return true;
		}
		if (Plugin.AllowValuables.Value)
		{
			return (Object)(object)((Component)p).GetComponent<ValuableObject>() != (Object)null;
		}
		return false;
	}

	internal bool Contains(PhysGrabObject p)
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = (((Object)(object)p.rb != (Object)null) ? p.rb.worldCenterOfMass : ((Component)p).transform.position);
		Vector3 val2 = ((Component)this).transform.InverseTransformPoint(val);
		float num = 0.55f;
		if (Mathf.Abs(val2.x) <= num && Mathf.Abs(val2.z) <= num && val2.y >= -0.05f)
		{
			return val2.y <= 1.1f;
		}
		return false;
	}

	public List<PhysGrabObject> Scan()
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		found.Clear();
		seen.Clear();
		Vector3 val = ((Component)this).transform.TransformPoint(new Vector3(0f, 0.425f, 0f));
		Vector3 val2 = default(Vector3);
		((Vector3)(ref val2))..ctor(0.42999998f, 0.475f, 0.42999998f);
		Collider[] array = Physics.OverlapBox(val, val2, ((Component)this).transform.rotation, -1, (QueryTriggerInteraction)1);
		foreach (Collider val3 in array)
		{
			Rigidbody attachedRigidbody = val3.attachedRigidbody;
			if (!((Object)(object)attachedRigidbody == (Object)null))
			{
				PhysGrabObject val4 = ((Component)attachedRigidbody).GetComponent<PhysGrabObject>();
				if ((Object)(object)val4 == (Object)null)
				{
					val4 = ((Component)attachedRigidbody).GetComponentInParent<PhysGrabObject>();
				}
				if (!((Object)(object)val4 == (Object)null) && seen.Add(((Object)val4).GetInstanceID()) && !val4.grabbed && Accepts(val4) && Contains(val4))
				{
					found.Add(val4);
				}
			}
		}
		return new List<PhysGrabObject>(found);
	}

	public static string NameOf(PhysGrabObject p)
	{
		ItemAttributes component = ((Component)p).GetComponent<ItemAttributes>();
		if ((Object)(object)component != (Object)null && (Object)(object)component.item != (Object)null && !string.IsNullOrEmpty(component.item.itemName))
		{
			return component.item.itemName;
		}
		string text = ((Object)((Component)p).gameObject).name.Replace("(Clone)", "").Trim();
		if (text.StartsWith("Valuable "))
		{
			text = text.Substring(9);
		}
		if (text.StartsWith("Item "))
		{
			text = text.Substring(5);
		}
		return text;
	}

	public void SetConfirmList(List<PhysGrabObject> list)
	{
		if (list == null)
		{
			confirmNames = null;
			lastCount = -1;
			return;
		}
		confirmNames = new List<string>();
		foreach (PhysGrabObject item in list)
		{
			if ((Object)(object)item != (Object)null)
			{
				confirmNames.Add(NameOf(item));
			}
		}
		lastCount = -1;
	}

	public void FlashDone(int count, string names)
	{
		doneUntil = Time.time + 3f;
		doneText = ((count > 0) ? ("Kidobva:\n" + names) : "");
		lastCount = -1;
	}

	private void LateUpdate()
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: 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_00a6: 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)
		Camera val = Plugin.MainCamera();
		if ((Object)(object)val == (Object)null || (Object)(object)label == (Object)null)
		{
			return;
		}
		Vector3 val2 = ((Component)val).transform.position - label.transform.position;
		bool flag = ((Vector3)(ref val2)).sqrMagnitude < 100f;
		if ((Object)(object)labelRenderer != (Object)null && ((Renderer)labelRenderer).enabled != flag)
		{
			((Renderer)labelRenderer).enabled = flag;
		}
		if (!flag)
		{
			return;
		}
		val2.y = 0f;
		if (((Vector3)(ref val2)).sqrMagnitude > 0.001f)
		{
			label.transform.rotation = Quaternion.LookRotation(-((Vector3)(ref val2)).normalized);
		}
		scanTimer -= Time.deltaTime;
		if (scanTimer > 0f)
		{
			return;
		}
		scanTimer = 0.3f;
		string text;
		if (confirmNames != null)
		{
			List<string> list = new List<string>();
			list.Add("Biztosan kidobod?");
			for (int i = 0; i < confirmNames.Count && i < 6; i++)
			{
				list.Add(confirmNames[i]);
			}
			if (confirmNames.Count > 6)
			{
				list.Add("+" + (confirmNames.Count - 6) + " további");
			}
			list.Add("Igen: " + Plugin.KeyLabel() + " újra");
			text = string.Join("\n", list.ToArray());
		}
		else if (Time.time < doneUntil && !string.IsNullOrEmpty(doneText))
		{
			text = doneText;
		}
		else
		{
			int count = Scan().Count;
			if (count == lastCount)
			{
				return;
			}
			lastCount = count;
			text = ((count == 0) ? "KUKA" : ("KUKA\n" + count + " tárgy\nÜrítés: " + Plugin.KeyLabel()));
		}
		if (label.text != text)
		{
			label.text = text;
		}
	}
}