Decompiled source of Toybox Destructibles v1.1.0

ToyboxDestroy.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Landfall.TABS;
using Landfall.TABS.GameState;
using RuntimeGizmos;
using TFBGames;
using TMPro;
using ToyBox;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Tabs Poof Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tabs Poof Mod")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8aad4f38-2ad4-4206-bf0b-7d28fb6d5c2e")]
[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")]
namespace explodingtoysarefun;

[BepInPlugin("bayturtleking.toyboxdestroy", "ToyBox Destruction", "1.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Expected O, but got Unknown
		//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_0041: Expected O, but got Unknown
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		changesomestuffifulike.bindddd(((BaseUnityPlugin)this).Config);
		((BaseUnityPlugin)this).Config.SaveOnConfigSet = false;
		justinserthereandhere.loggyyy = ((BaseUnityPlugin)this).Logger;
		justinserthereandhere.patchemalll(new Harmony("bayturtleking.toyboxdestroy"));
		GameObject val = new GameObject("aeauiiiiiiiiii");
		Object.DontDestroyOnLoad((Object)val);
		val.AddComponent<aeauiiiiiiiiii>();
		val.AddComponent<makethemfightwallscuzdumb>();
		val.AddComponent<manitliveaea>();
	}
}
internal static class justinserthereandhere
{
	public static ManualLogSource loggyyy;

	public static void patchemalll(Harmony hrmmm)
	{
		Type[] types;
		try
		{
			types = typeof(justinserthereandhere).Assembly.GetTypes();
		}
		catch (ReflectionTypeLoadException ex)
		{
			types = ex.Types;
		}
		foreach (Type type in types)
		{
			if (type == null || !type.IsDefined(typeof(HarmonyPatch), inherit: true))
			{
				continue;
			}
			try
			{
				hrmmm.PatchAll(type);
			}
			catch (Exception ex2)
			{
				if (loggyyy != null)
				{
					loggyyy.LogError((object)("turtle's very cool toybox prop destroy thing " + type.Name + " did nto work :( and got skippedd: " + ex2));
				}
			}
		}
	}
}
internal enum howtogoboomm
{
	rngbitzz,
	bymatbitz
}
internal static class changesomestuffifulike
{
	public static ConfigEntry<string> hwtobreakk;

	public static ConfigEntry<float> ouchbudgett;

	public static ConfigEntry<bool> bigmeansbeefyy;

	public static ConfigEntry<float> hurtmultiii;

	public static ConfigEntry<float> tooweakignoree;

	public static ConfigEntry<int> rngbitcountt;

	public static ConfigEntry<float> howlongbitssstay;

	public static ConfigEntry<float> yeetforcee;

	public static ConfigEntry<int> bitcapppp;

	public static ConfigEntry<bool> mapguyscanbreakkk;

	public static ConfigEntry<bool> newguysstartbonkk;

	public static ConfigEntry<bool> guysbonkwallsss;

	public static ConfigEntry<float> howfarguyslookk;

	public static ConfigEntry<bool> onlybonkifstuckk;

	public static ConfigEntry<float> howlongtillstuckk;

	public static ConfigEntry<KeyCode> menukeyyyy;

	public static ConfigFile thecfgfilee;

	public static void bindddd(ConfigFile ccc)
	{
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Expected O, but got Unknown
		thecfgfilee = ccc;
		hwtobreakk = ccc.Bind<string>("Destruction", "break style", "Material", new ConfigDescription("material: it breaks all the pieces apart, random: it chops it up into random pieces (like a glass shatter)", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[2] { "Material", "Random" }), Array.Empty<object>()));
		menukeyyyy = ccc.Bind<KeyCode>("Menu", "Menu key", (KeyCode)286, "hides or shows the destruction menu that pops up next to toybox");
		ouchbudgett = ccc.Bind<float>("Destruction", "prop strength", 150f, "how much damage a prop takes before breaking apart like lego bricks");
		bigmeansbeefyy = ccc.Bind<bool>("Destruction", "size health", true, "big props get more strength/health than smaller ones");
		hurtmultiii = ccc.Bind<float>("Destruction", "Damage mult", 1f, "higher means props break easier");
		tooweakignoree = ccc.Bind<float>("Destruction", "Weak hit ignore", 0f, "hits that do less than this do not do any damage to props");
		rngbitcountt = ccc.Bind<int>("Destruction", "Random break size amount", 12, "how many pieces a prop breaks into when break style is Random");
		howlongbitssstay = ccc.Bind<float>("Destruction", "Debris timee", 20f, "how many seconds until the debris disappear. 0 is forever, forever is laggy.");
		yeetforcee = ccc.Bind<float>("Destruction", "Debris fast", 6f, "how fast the pieces get launched from origin");
		bitcapppp = ccc.Bind<int>("Destruction", "Debris limit", 250, "the maximum amount of debris at once");
		mapguyscanbreakkk = ccc.Bind<bool>("Destruction", "Pathfinding props break", true, "props with affect pathfinding can also break");
		newguysstartbonkk = ccc.Bind<bool>("Destruction", "New props start on", false, "the default is that props start with destruction");
		guysbonkwallsss = ccc.Bind<bool>("Units", "Units hit props", true, "units hit props that are in the way of their target so they dont just stand there in a 4 wall prison. there wisefan");
		howfarguyslookk = ccc.Bind<float>("Units", "Hit dist", 2.5f, "how far in front of them a unit looks for a prop to hit because they have short-sighted vision");
		onlybonkifstuckk = ccc.Bind<bool>("Units", "Only when stuck", true, "units only hit props after they stop moving. turn it off and they hit any prop in te way");
		howlongtillstuckk = ccc.Bind<float>("Units", "Stuck time", 0.8f, "how many seconds a unit stands still before its stuck");
	}

	public static howtogoboomm whichstylee()
	{
		if (!(hwtobreakk.Value == "Random"))
		{
			return howtogoboomm.bymatbitz;
		}
		return howtogoboomm.rngbitzz;
	}
}
internal sealed class makeitgoaeaeaea : GameStateListener
{
	public static readonly List<makeitgoaeaeaea> everybonkk = new List<makeitgoaeaeaea>();

	public static bool fighttimee;

	private float hpleffttt;

	private bool hpreddyyy;

	private bool itsdeddd;

	private ToyBuilding tbuildd;

	private Collider[] colsssz;

	private readonly List<GameObject> mybitssszz = new List<GameObject>();

	private readonly List<Renderer> hidrenddz = new List<Renderer>();

	private readonly List<Collider> hidcolllz = new List<Collider>();

	public float myouchbudgett = -1f;

	public int myboomstylee;

	public float mybitstayyy = -1f;

	public int mybitamountt = -1;

	public bool areudeddd => itsdeddd;

	protected override void Awake()
	{
		((GameStateListener)this).Awake();
		everybonkk.Add(this);
	}

	protected override void OnDestroy()
	{
		((GameStateListener)this).OnDestroy();
		everybonkk.Remove(this);
		bringitbackaea();
	}

	public override void OnEnterPlacementState()
	{
		fighttimee = false;
		bringitbackaea();
	}

	public override void OnEnterBattleState()
	{
		fighttimee = true;
		if (itsdeddd)
		{
			bringitbackaea();
		}
		colsssz = ((Component)this).GetComponentsInChildren<Collider>();
		seesahrastufaa();
	}

	public static makeitgoaeaeaea whosbonkabull(Collider ccc)
	{
		if ((Object)(object)ccc == (Object)null)
		{
			return null;
		}
		return ((Component)ccc).GetComponentInParent<makeitgoaeaeaea>();
	}

	public float howbeefyamii()
	{
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: 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_005e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		if (myouchbudgett >= 0f)
		{
			return Mathf.Max(myouchbudgett, 1f);
		}
		float num = changesomestuffifulike.ouchbudgett.Value;
		if (changesomestuffifulike.bigmeansbeefyy.Value)
		{
			Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>();
			Bounds val = default(Bounds);
			bool flag = false;
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				if (!((Object)(object)componentsInChildren[i] == (Object)null))
				{
					if (!flag)
					{
						val = componentsInChildren[i].bounds;
						flag = true;
					}
					else
					{
						((Bounds)(ref val)).Encapsulate(componentsInChildren[i].bounds);
					}
				}
			}
			if (flag)
			{
				float num2 = num;
				Vector3 size = ((Bounds)(ref val)).size;
				num = num2 * Mathf.Clamp(((Vector3)(ref size)).magnitude / 4f, 0.5f, 8f);
			}
		}
		return Mathf.Max(num, 1f);
	}

	private void seesahrastufaa()
	{
		hpleffttt = howbeefyamii();
		hpreddyyy = true;
	}

	public howtogoboomm whichstyleformee()
	{
		if (myboomstylee == 1)
		{
			return howtogoboomm.bymatbitz;
		}
		if (myboomstylee == 2)
		{
			return howtogoboomm.rngbitzz;
		}
		return changesomestuffifulike.whichstylee();
	}

	public int howmanybitsformee()
	{
		if (mybitamountt < 1)
		{
			return changesomestuffifulike.rngbitcountt.Value;
		}
		return mybitamountt;
	}

	public float howlongbitsformee()
	{
		if (!(mybitstayyy >= 0f))
		{
			return changesomestuffifulike.howlongbitssstay.Value;
		}
		return mybitstayyy;
	}

	public void stealsettingsfromm(makeitgoaeaeaea otherr)
	{
		myouchbudgett = otherr.myouchbudgett;
		myboomstylee = otherr.myboomstylee;
		mybitstayyy = otherr.mybitstayyy;
		mybitamountt = otherr.mybitamountt;
	}

	public string squishitdownn()
	{
		CultureInfo invariantCulture = CultureInfo.InvariantCulture;
		return "1;" + ((myouchbudgett >= 0f) ? myouchbudgett.ToString(invariantCulture) : "") + ";" + myboomstylee.ToString(invariantCulture) + ";" + ((mybitstayyy >= 0f) ? mybitstayyy.ToString(invariantCulture) : "") + ";" + ((mybitamountt >= 1) ? mybitamountt.ToString(invariantCulture) : "");
	}

	public void unsquishitupp(string[] bitzz)
	{
		CultureInfo invariantCulture = CultureInfo.InvariantCulture;
		myouchbudgett = ((bitzz.Length > 1 && float.TryParse(bitzz[1], NumberStyles.Float, invariantCulture, out var result)) ? result : (-1f));
		myboomstylee = ((bitzz.Length > 2 && int.TryParse(bitzz[2], NumberStyles.Integer, invariantCulture, out var result2)) ? Mathf.Clamp(result2, 0, 2) : 0);
		mybitstayyy = ((bitzz.Length > 3 && float.TryParse(bitzz[3], NumberStyles.Float, invariantCulture, out result)) ? result : (-1f));
		mybitamountt = ((bitzz.Length > 4 && int.TryParse(bitzz[4], NumberStyles.Integer, invariantCulture, out result2)) ? result2 : (-1));
	}

	public void ouchhh(float howmuchowwwie, Vector3 wheretttt, Vector3 whicwayy)
	{
		//IL_00a5: 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)
		if (itsdeddd)
		{
			return;
		}
		if (!changesomestuffifulike.mapguyscanbreakkk.Value)
		{
			if ((Object)(object)tbuildd == (Object)null)
			{
				tbuildd = ((Component)this).GetComponent<ToyBuilding>();
			}
			if ((Object)(object)tbuildd != (Object)null && tbuildd.IsMapLayer)
			{
				return;
			}
		}
		float num = howmuchowwwie * changesomestuffifulike.hurtmultiii.Value;
		if (num <= changesomestuffifulike.tooweakignoree.Value || num <= 0f)
		{
			return;
		}
		if (!hpreddyyy)
		{
			seesahrastufaa();
		}
		hpleffttt -= num;
		if (hpleffttt > 0f)
		{
			return;
		}
		itsdeddd = true;
		try
		{
			chunkyeeterrr.makeitintopieceasa(((Component)this).transform, wheretttt, whicwayy, mybitssszz, whichstyleformee(), howmanybitsformee(), howlongbitsformee());
		}
		catch (Exception ex)
		{
			if (justinserthereandhere.loggyyy != null)
			{
				justinserthereandhere.loggyyy.LogError((object)("thing broke but the debrissssss did nto spawn :( " + ex));
			}
		}
		Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>();
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			if ((Object)(object)componentsInChildren[i] != (Object)null && componentsInChildren[i].enabled)
			{
				hidrenddz.Add(componentsInChildren[i]);
				componentsInChildren[i].enabled = false;
			}
		}
		Collider[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<Collider>();
		for (int j = 0; j < componentsInChildren2.Length; j++)
		{
			if ((Object)(object)componentsInChildren2[j] != (Object)null && componentsInChildren2[j].enabled)
			{
				hidcolllz.Add(componentsInChildren2[j]);
				componentsInChildren2[j].enabled = false;
			}
		}
		Rigidbody component = ((Component)this).GetComponent<Rigidbody>();
		if ((Object)(object)component != (Object)null)
		{
			component.isKinematic = true;
			component.detectCollisions = false;
		}
	}

	public bool howfaraweeeboom(Vector3 centerrr, int layermaskkk, out float distzzz)
	{
		//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_0063: 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)
		distzzz = float.MaxValue;
		if (itsdeddd)
		{
			return false;
		}
		if (colsssz == null)
		{
			colsssz = ((Component)this).GetComponentsInChildren<Collider>();
		}
		bool result = false;
		for (int i = 0; i < colsssz.Length; i++)
		{
			Collider val = colsssz[i];
			if (!((Object)(object)val == (Object)null) && val.enabled && (layermaskkk & (1 << ((Component)val).gameObject.layer)) != 0)
			{
				Bounds bounds = val.bounds;
				float num = Vector3.Distance(((Bounds)(ref bounds)).ClosestPoint(centerrr), centerrr);
				if (num < distzzz)
				{
					distzzz = num;
				}
				result = true;
			}
		}
		return result;
	}

	private void bringitbackaea()
	{
		for (int i = 0; i < hidrenddz.Count; i++)
		{
			if ((Object)(object)hidrenddz[i] != (Object)null)
			{
				hidrenddz[i].enabled = true;
			}
		}
		for (int j = 0; j < hidcolllz.Count; j++)
		{
			if ((Object)(object)hidcolllz[j] != (Object)null)
			{
				hidcolllz[j].enabled = true;
			}
		}
		hidrenddz.Clear();
		hidcolllz.Clear();
		for (int k = 0; k < mybitssszz.Count; k++)
		{
			if ((Object)(object)mybitssszz[k] != (Object)null)
			{
				Object.Destroy((Object)(object)mybitssszz[k]);
			}
		}
		mybitssszz.Clear();
		if (itsdeddd)
		{
			Rigidbody component = ((Component)this).GetComponent<Rigidbody>();
			if ((Object)(object)component != (Object)null)
			{
				component.detectCollisions = true;
			}
		}
		itsdeddd = false;
		hpreddyyy = false;
	}
}
internal sealed class meshbaggg
{
	public Transform trr;

	public Mesh mshh;

	public Material[] matzz;

	public Vector3[] vertzz;

	public Vector3[] normzz;

	public Vector2[] uvzz;

	public int[][] trizz;
}
internal sealed class bitjoobbb
{
	public meshbaggg bagg;

	public Dictionary<int, List<int>> subtrizz = new Dictionary<int, List<int>>();
}
internal static class chunkyeeterrr
{
	private static readonly Queue<GameObject> bitlnnee = new Queue<GameObject>();

	public static void makeitintopieceasa(Transform whoo, Vector3 wheretttt, Vector3 whicwayy, List<GameObject> ouutbitzz, howtogoboomm stylee, int bitcountt, float bittimeee)
	{
		//IL_0250: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		List<meshbaggg> list = new List<meshbaggg>();
		MeshRenderer[] componentsInChildren = ((Component)whoo).GetComponentsInChildren<MeshRenderer>();
		foreach (MeshRenderer val in componentsInChildren)
		{
			if ((Object)(object)val == (Object)null || !((Renderer)val).enabled)
			{
				continue;
			}
			MeshFilter component = ((Component)val).GetComponent<MeshFilter>();
			if (!((Object)(object)component == (Object)null) && !((Object)(object)component.sharedMesh == (Object)null) && component.sharedMesh.isReadable)
			{
				Mesh sharedMesh = component.sharedMesh;
				meshbaggg meshbaggg2 = new meshbaggg();
				meshbaggg2.trr = ((Component)val).transform;
				meshbaggg2.mshh = sharedMesh;
				meshbaggg2.matzz = ((Renderer)val).sharedMaterials;
				meshbaggg2.vertzz = sharedMesh.vertices;
				meshbaggg2.normzz = sharedMesh.normals;
				meshbaggg2.uvzz = sharedMesh.uv;
				meshbaggg2.trizz = new int[sharedMesh.subMeshCount][];
				for (int j = 0; j < sharedMesh.subMeshCount; j++)
				{
					meshbaggg2.trizz[j] = sharedMesh.GetTriangles(j);
				}
				list.Add(meshbaggg2);
			}
		}
		if (list.Count == 0)
		{
			return;
		}
		List<bitjoobbb> list2 = new List<bitjoobbb>();
		if (stylee == howtogoboomm.bymatbitz)
		{
			for (int k = 0; k < list.Count; k++)
			{
				for (int l = 0; l < list[k].trizz.Length; l++)
				{
					if (list[k].trizz[l].Length >= 3)
					{
						bitjoobbb bitjoobbb2 = new bitjoobbb();
						bitjoobbb2.bagg = list[k];
						bitjoobbb2.subtrizz[l] = new List<int>(list[k].trizz[l]);
						list2.Add(bitjoobbb2);
					}
				}
			}
		}
		if (list2.Count < 2)
		{
			list2.Clear();
			int num = 0;
			for (int m = 0; m < list.Count; m++)
			{
				for (int n = 0; n < list[m].trizz.Length; n++)
				{
					num += list[m].trizz[n].Length / 3;
				}
			}
			for (int num2 = 0; num2 < list.Count; num2++)
			{
				chopitupupup(list[num2], num, list2, bitcountt);
			}
		}
		for (int num3 = 0; num3 < list2.Count; num3++)
		{
			GameObject val2 = bakeonearqrq(list2[num3], wheretttt, whicwayy, bittimeee);
			if (!((Object)(object)val2 == (Object)null))
			{
				ouutbitzz.Add(val2);
				bitlnnee.Enqueue(val2);
			}
		}
		while (bitlnnee.Count > Mathf.Max(changesomestuffifulike.bitcapppp.Value, 1))
		{
			GameObject val3 = bitlnnee.Dequeue();
			if ((Object)(object)val3 != (Object)null)
			{
				Object.Destroy((Object)(object)val3);
			}
		}
	}

	private static void chopitupupup(meshbaggg bagg, int totalltri, List<bitjoobbb> joobzzz, int bitcountt)
	{
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_0129: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: 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)
		List<int> list = new List<int>();
		List<int> list2 = new List<int>();
		List<int> list3 = new List<int>();
		List<int> list4 = new List<int>();
		List<Vector3> list5 = new List<Vector3>();
		for (int i = 0; i < bagg.trizz.Length; i++)
		{
			int[] array = bagg.trizz[i];
			for (int j = 0; j + 2 < array.Length; j += 3)
			{
				list.Add(i);
				list2.Add(array[j]);
				list3.Add(array[j + 1]);
				list4.Add(array[j + 2]);
				list5.Add((bagg.vertzz[array[j]] + bagg.vertzz[array[j + 1]] + bagg.vertzz[array[j + 2]]) / 3f);
			}
		}
		int count = list.Count;
		if (count == 0)
		{
			return;
		}
		int num = Mathf.RoundToInt((float)bitcountt * (float)count / (float)Mathf.Max(totalltri, 1));
		num = Mathf.Clamp(num, 1, count);
		Vector3[] array2 = (Vector3[])(object)new Vector3[num];
		for (int k = 0; k < num; k++)
		{
			array2[k] = list5[Random.Range(0, count)];
		}
		bitjoobbb[] array3 = new bitjoobbb[num];
		for (int l = 0; l < count; l++)
		{
			int num2 = 0;
			float num3 = float.MaxValue;
			for (int m = 0; m < num; m++)
			{
				Vector3 val = list5[l] - array2[m];
				float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
				if (sqrMagnitude < num3)
				{
					num3 = sqrMagnitude;
					num2 = m;
				}
			}
			if (array3[num2] == null)
			{
				array3[num2] = new bitjoobbb();
				array3[num2].bagg = bagg;
			}
			if (!array3[num2].subtrizz.TryGetValue(list[l], out var value))
			{
				value = new List<int>();
				array3[num2].subtrizz[list[l]] = value;
			}
			value.Add(list2[l]);
			value.Add(list3[l]);
			value.Add(list4[l]);
		}
		for (int n = 0; n < num; n++)
		{
			if (array3[n] != null)
			{
				joobzzz.Add(array3[n]);
			}
		}
	}

	private static GameObject bakeonearqrq(bitjoobbb jobbb, Vector3 wheretttt, Vector3 whicwayy, float bittimeee)
	{
		//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c3: Expected O, but got Unknown
		//IL_0105: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0253: Unknown result type (might be due to invalid IL or missing references)
		//IL_0258: Unknown result type (might be due to invalid IL or missing references)
		//IL_0264: 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_0279: Unknown result type (might be due to invalid IL or missing references)
		//IL_0285: Unknown result type (might be due to invalid IL or missing references)
		//IL_028f: 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_02a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c2: 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_02cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02de: Unknown result type (might be due to invalid IL or missing references)
		//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_030f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0314: Unknown result type (might be due to invalid IL or missing references)
		//IL_0318: Unknown result type (might be due to invalid IL or missing references)
		//IL_0327: 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_034e: Unknown result type (might be due to invalid IL or missing references)
		//IL_035d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0379: Unknown result type (might be due to invalid IL or missing references)
		//IL_0383: Unknown result type (might be due to invalid IL or missing references)
		//IL_038b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0395: Unknown result type (might be due to invalid IL or missing references)
		//IL_039f: Unknown result type (might be due to invalid IL or missing references)
		//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0401: Unknown result type (might be due to invalid IL or missing references)
		//IL_0406: Unknown result type (might be due to invalid IL or missing references)
		//IL_0407: Unknown result type (might be due to invalid IL or missing references)
		//IL_040c: Unknown result type (might be due to invalid IL or missing references)
		//IL_042a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0431: Unknown result type (might be due to invalid IL or missing references)
		//IL_0438: Unknown result type (might be due to invalid IL or missing references)
		//IL_0442: Unknown result type (might be due to invalid IL or missing references)
		//IL_0447: Unknown result type (might be due to invalid IL or missing references)
		//IL_044c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0456: Unknown result type (might be due to invalid IL or missing references)
		//IL_045b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0460: Unknown result type (might be due to invalid IL or missing references)
		//IL_0464: Unknown result type (might be due to invalid IL or missing references)
		//IL_0469: Unknown result type (might be due to invalid IL or missing references)
		//IL_046c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0478: 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_0496: Unknown result type (might be due to invalid IL or missing references)
		//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b7: Expected O, but got Unknown
		//IL_041c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0421: Unknown result type (might be due to invalid IL or missing references)
		meshbaggg bagg = jobbb.bagg;
		if ((Object)(object)bagg.trr == (Object)null)
		{
			return null;
		}
		Dictionary<int, int> dictionary = new Dictionary<int, int>();
		List<Vector3> list = new List<Vector3>();
		List<Vector3> list2 = new List<Vector3>();
		List<Vector2> list3 = new List<Vector2>();
		bool flag = bagg.normzz != null && bagg.normzz.Length == bagg.vertzz.Length;
		bool flag2 = bagg.uvzz != null && bagg.uvzz.Length == bagg.vertzz.Length;
		List<int> list4 = new List<int>(jobbb.subtrizz.Keys);
		List<List<int>> list5 = new List<List<int>>();
		Material[] array = (Material[])(object)new Material[list4.Count];
		for (int i = 0; i < list4.Count; i++)
		{
			List<int> list6 = jobbb.subtrizz[list4[i]];
			List<int> list7 = new List<int>(list6.Count);
			for (int j = 0; j < list6.Count; j++)
			{
				if (!dictionary.TryGetValue(list6[j], out var value))
				{
					value = list.Count;
					dictionary[list6[j]] = value;
					list.Add(bagg.vertzz[list6[j]]);
					if (flag)
					{
						list2.Add(bagg.normzz[list6[j]]);
					}
					if (flag2)
					{
						list3.Add(bagg.uvzz[list6[j]]);
					}
				}
				list7.Add(value);
			}
			list5.Add(list7);
			array[i] = ((list4[i] < bagg.matzz.Length) ? bagg.matzz[list4[i]] : null);
		}
		if (list.Count < 3)
		{
			return null;
		}
		Mesh val = new Mesh();
		((Object)val).name = "bitttt";
		if (list.Count > 65000)
		{
			val.indexFormat = (IndexFormat)1;
		}
		val.SetVertices(list);
		if (flag)
		{
			val.SetNormals(list2);
		}
		if (flag2)
		{
			val.SetUVs(0, list3);
		}
		val.subMeshCount = list5.Count;
		for (int k = 0; k < list5.Count; k++)
		{
			val.SetTriangles(list5[k], k);
		}
		if (!flag)
		{
			val.RecalculateNormals();
		}
		val.RecalculateBounds();
		GameObject val2 = new GameObject("bitttt");
		val2.transform.SetPositionAndRotation(bagg.trr.position, bagg.trr.rotation);
		val2.transform.localScale = bagg.trr.lossyScale;
		val2.AddComponent<MeshFilter>().sharedMesh = val;
		((Renderer)val2.AddComponent<MeshRenderer>()).sharedMaterials = array;
		BoxCollider val3 = val2.AddComponent<BoxCollider>();
		Vector3 lossyScale = bagg.trr.lossyScale;
		Bounds bounds = val.bounds;
		val3.center = ((Bounds)(ref bounds)).center;
		bounds = val.bounds;
		float num = Mathf.Max(((Bounds)(ref bounds)).size.x, 0.05f / Mathf.Max(Mathf.Abs(lossyScale.x), 0.0001f));
		bounds = val.bounds;
		float num2 = Mathf.Max(((Bounds)(ref bounds)).size.y, 0.05f / Mathf.Max(Mathf.Abs(lossyScale.y), 0.0001f));
		bounds = val.bounds;
		val3.size = new Vector3(num, num2, Mathf.Max(((Bounds)(ref bounds)).size.z, 0.05f / Mathf.Max(Mathf.Abs(lossyScale.z), 0.0001f)));
		Rigidbody obj = val2.AddComponent<Rigidbody>();
		float num3 = Mathf.Abs(val3.size.x * lossyScale.x * val3.size.y * lossyScale.y * val3.size.z * lossyScale.z);
		obj.mass = Mathf.Clamp(num3 * 0.8f, 0.2f, 30f);
		Transform trr = bagg.trr;
		bounds = val.bounds;
		Vector3 val4 = trr.TransformPoint(((Bounds)(ref bounds)).center) - wheretttt;
		if (((Vector3)(ref val4)).sqrMagnitude < 0.0001f)
		{
			val4 = Random.onUnitSphere;
		}
		((Vector3)(ref val4)).Normalize();
		Vector3 val5 = val4 * 0.6f + ((Vector3)(ref whicwayy)).normalized * 0.6f + Vector3.up * 0.3f;
		Vector3 normalized = ((Vector3)(ref val5)).normalized;
		obj.velocity = normalized * changesomestuffifulike.yeetforcee.Value * Random.Range(0.4f, 1.2f);
		obj.angularVelocity = Random.insideUnitSphere * 4f;
		val2.AddComponent<bitgoraeas>().lyfeee = bittimeee;
		return val2;
	}
}
internal sealed class bitgoraeas : MonoBehaviour
{
	public float lyfeee;

	private float olddnesss;

	private Vector3 ogsizeee;

	private const float shrnkkkk = 1f;

	private void Start()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		ogsizeee = ((Component)this).transform.localScale;
	}

	private void Update()
	{
		//IL_0006: 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_008d: Unknown result type (might be due to invalid IL or missing references)
		if (((Component)this).transform.position.y < -300f)
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}
		else
		{
			if (lyfeee <= 0f)
			{
				return;
			}
			olddnesss += Time.deltaTime;
			if (!(olddnesss < lyfeee))
			{
				float num = (olddnesss - lyfeee) / 1f;
				if (num >= 1f)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
				else
				{
					((Component)this).transform.localScale = ogsizeee * (1f - num);
				}
			}
		}
	}
}
internal sealed class aeauiiiiiiiiii : MonoBehaviour
{
	private int didthiswinnn;

	private void Update()
	{
		if (Time.frameCount % 20 != 0)
		{
			return;
		}
		ToyWindow instance = ToyWindow.Instance;
		if ((Object)(object)instance == (Object)null || (Object)(object)instance.EnablePhysics == (Object)null || ((Object)instance).GetInstanceID() == didthiswinnn)
		{
			return;
		}
		didthiswinnn = ((Object)instance).GetInstanceID();
		try
		{
			slapitinthewinn(instance);
		}
		catch (Exception ex)
		{
			if (justinserthereandhere.loggyyy != null)
			{
				justinserthereandhere.loggyyy.LogError((object)("could nto put the toggle thing in toyboxxxx window :( " + ex));
			}
		}
	}

	private static Transform wheresrowwwhh(Toggle tgg)
	{
		Transform val = ((Component)tgg).transform;
		for (int i = 0; i < 3; i++)
		{
			if (((Component)val).GetComponentsInChildren<TMP_Text>(true).Length != 0)
			{
				break;
			}
			if (((Component)val).GetComponentsInChildren<Text>(true).Length != 0)
			{
				break;
			}
			if ((Object)(object)val.parent == (Object)null)
			{
				break;
			}
			if (val.parent.childCount > 3)
			{
				break;
			}
			val = val.parent;
		}
		return val;
	}

	private static void slapitinthewinn(ToyWindow wnn)
	{
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: 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_0130: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: 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_018f: 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)
		Transform val = wheresrowwwhh(wnn.EnablePhysics);
		Transform val2 = wheresrowwwhh(wnn.AffectPathfindingToggle);
		Transform parent = val.parent;
		GameObject val3 = Object.Instantiate<GameObject>(((Component)val).gameObject, parent);
		((Object)val3).name = "EnablePropDestruction";
		val3.transform.SetSiblingIndex(val.GetSiblingIndex() + 1);
		Toggle componentInChildren = val3.GetComponentInChildren<Toggle>(true);
		((UnityEventBase)componentInChildren.onValueChanged).RemoveAllListeners();
		componentInChildren.SetIsOnWithoutNotify(false);
		TMP_Text[] componentsInChildren = val3.GetComponentsInChildren<TMP_Text>(true);
		for (int i = 0; i < componentsInChildren.Length; i++)
		{
			componentsInChildren[i].text = "Enable prop destruct";
		}
		Text[] componentsInChildren2 = val3.GetComponentsInChildren<Text>(true);
		for (int i = 0; i < componentsInChildren2.Length; i++)
		{
			componentsInChildren2[i].text = "Enable prop destruct";
		}
		if ((Object)(object)((Component)parent).GetComponent<LayoutGroup>() == (Object)null)
		{
			RectTransform val4 = (RectTransform)(object)((val is RectTransform) ? val : null);
			RectTransform val5 = (RectTransform)(object)((val2 is RectTransform) ? val2 : null);
			Transform transform = val3.transform;
			RectTransform val6 = (RectTransform)(object)((transform is RectTransform) ? transform : null);
			if ((Object)(object)val4 != (Object)null && (Object)(object)val5 != (Object)null && (Object)(object)val6 != (Object)null)
			{
				Vector2 val7 = val4.anchoredPosition - val5.anchoredPosition;
				val6.anchoredPosition = val4.anchoredPosition + val7;
				Transform[] array = (Transform[])(object)new Transform[2]
				{
					((Component)wnn.NodesVisibilityButton).transform,
					((Component)wnn.BakePathfindingButton).transform
				};
				foreach (Transform obj in array)
				{
					RectTransform val8 = (RectTransform)(object)((obj is RectTransform) ? obj : null);
					if ((Object)(object)val8 != (Object)null)
					{
						val8.anchoredPosition += new Vector2(0f, val7.y);
					}
				}
			}
		}
		((UnityEvent<bool>)(object)componentInChildren.onValueChanged).AddListener((UnityAction<bool>)toglflipdd);
		val3.AddComponent<toggleeyeballl>().togg = componentInChildren;
	}

	private static void toglflipdd(bool onnn)
	{
		Transform selected = ToyWindowHandler.Selected;
		if (!((Object)(object)selected == (Object)null))
		{
			makeitgoaeaeaea component = ((Component)selected).GetComponent<makeitgoaeaeaea>();
			if (onnn && (Object)(object)component == (Object)null)
			{
				((Component)selected).gameObject.AddComponent<makeitgoaeaeaea>();
			}
			else if (!onnn && (Object)(object)component != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)component);
			}
		}
	}
}
internal sealed class toggleeyeballl : MonoBehaviour
{
	public Toggle togg;

	private void Update()
	{
		if (!((Object)(object)togg == (Object)null))
		{
			Transform selected = ToyWindowHandler.Selected;
			bool flag = (Object)(object)selected != (Object)null && (Object)(object)((Component)selected).GetComponent<makeitgoaeaeaea>() != (Object)null;
			if (togg.isOn != flag)
			{
				togg.SetIsOnWithoutNotify(flag);
			}
			((Selectable)togg).interactable = (Object)(object)selected != (Object)null;
		}
	}
}
[HarmonyPatch(typeof(ProjectileHit), "Hit")]
internal static class arrowpokesthingg
{
	private static void Prefix(ProjectileHit __instance, RaycastHit sentHit, float multiplier)
	{
		//IL_0054: 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)
		if (makeitgoaeaeaea.everybonkk.Count != 0 && !__instance.done)
		{
			makeitgoaeaeaea makeitgoaeaeaea2 = makeitgoaeaeaea.whosbonkabull(((RaycastHit)(ref sentHit)).collider);
			if (!((Object)(object)makeitgoaeaeaea2 == (Object)null))
			{
				float num = (__instance.deltaTime ? (Time.deltaTime * 100f) : 1f);
				makeitgoaeaeaea2.ouchhh(__instance.damage * multiplier * num, ((RaycastHit)(ref sentHit)).point, ((Component)__instance).transform.forward);
			}
		}
	}
}
[HarmonyPatch(typeof(CollisionWeapon), "OnCollisionEnter")]
internal static class swordwhackthinn
{
	private static void Postfix(CollisionWeapon __instance, Collision collision)
	{
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		if (makeitgoaeaeaea.everybonkk.Count == 0 || (__instance.onlyCollideWithRigs && (Object)(object)collision.rigidbody == (Object)null))
		{
			return;
		}
		makeitgoaeaeaea makeitgoaeaeaea2 = makeitgoaeaeaea.whosbonkabull(collision.collider);
		if ((Object)(object)makeitgoaeaeaea2 == (Object)null)
		{
			return;
		}
		MeleeWeapon component = ((Component)__instance).GetComponent<MeleeWeapon>();
		if ((Object)(object)component != (Object)null && !component.canDealDamage)
		{
			return;
		}
		Rigidbody component2 = ((Component)__instance).GetComponent<Rigidbody>();
		if ((Object)(object)component2 == (Object)null)
		{
			return;
		}
		Vector3 val;
		float num;
		if (!((Object)(object)collision.rigidbody != (Object)null))
		{
			val = collision.impulse;
			num = ((Vector3)(ref val)).magnitude / component2.mass * 0.3f;
		}
		else
		{
			val = collision.impulse;
			num = ((Vector3)(ref val)).magnitude / (component2.mass + 10f) * 0.3f;
		}
		float num2 = num;
		num2 = Mathf.Clamp(num2 * __instance.impactMultiplier / FixedTimeStepService.SmallForceCoefficient, 0f, 2f);
		if (num2 < 1f)
		{
			return;
		}
		if (__instance.minVelocity != 0f)
		{
			val = component2.velocity;
			if (((Vector3)(ref val)).magnitude < __instance.minVelocity)
			{
				return;
			}
		}
		Vector3 val2;
		if (collision.contactCount <= 0)
		{
			val2 = collision.transform.position;
		}
		else
		{
			ContactPoint contact = collision.GetContact(0);
			val2 = ((ContactPoint)(ref contact)).point;
		}
		Vector3 wheretttt = val2;
		Vector3 whicwayy = (((Object)(object)component != (Object)null) ? component.swingDirection : ((Component)__instance).transform.forward);
		makeitgoaeaeaea2.ouchhh(__instance.damage * num2, wheretttt, whicwayy);
	}
}
[HarmonyPatch(typeof(Explosion), "Explode")]
internal static class boomtouchthingg
{
	private static void Postfix(Explosion __instance)
	{
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
		if (makeitgoaeaeaea.everybonkk.Count == 0)
		{
			return;
		}
		Vector3 position = ((Component)__instance).transform.position;
		float num = Mathf.Max(__instance.radius, 0.01f);
		float num2 = (__instance.deltaTime ? (Time.deltaTime * 100f) : 1f);
		for (int num3 = makeitgoaeaeaea.everybonkk.Count - 1; num3 >= 0; num3--)
		{
			makeitgoaeaeaea makeitgoaeaeaea2 = makeitgoaeaeaea.everybonkk[num3];
			if (!((Object)(object)makeitgoaeaeaea2 == (Object)null) && makeitgoaeaeaea2.howfaraweeeboom(position, LayerMask.op_Implicit(__instance.layerMask), out var distzzz) && !(distzzz > num))
			{
				float num4 = Mathf.Clamp01(1f - distzzz / num);
				Vector3 whicwayy = ((Component)makeitgoaeaeaea2).transform.position - position;
				makeitgoaeaeaea2.ouchhh(__instance.damage * num2 * num4, position, whicwayy);
			}
		}
	}
}
internal static class sidekickfilee
{
	public static List<ToyBuilding> olddstuffff = new List<ToyBuilding>();

	public static void snappiccc()
	{
		olddstuffff = new List<ToyBuilding>(ToyBuilding.Buildings);
	}

	public static List<ToyBuilding> wtfsnewwwz()
	{
		HashSet<ToyBuilding> hashSet = new HashSet<ToyBuilding>(olddstuffff);
		List<ToyBuilding> list = new List<ToyBuilding>();
		for (int i = 0; i < ToyBuilding.Buildings.Count; i++)
		{
			ToyBuilding val = ToyBuilding.Buildings[i];
			if ((Object)(object)val != (Object)null && !hashSet.Contains(val))
			{
				list.Add(val);
			}
		}
		return list;
	}

	public static string sidefilepthh(string toylpathhh)
	{
		return Path.ChangeExtension(toylpathhh, ".toyd");
	}

	public static void writeitdwnn(string savenameee)
	{
		try
		{
			MapAsset currentLoadedMap = TABSSceneManager.CurrentLoadedMap;
			if ((Object)(object)currentLoadedMap == (Object)null)
			{
				return;
			}
			string text = currentLoadedMap.MapName;
			char[] invalidFileNameChars = Path.GetInvalidFileNameChars();
			foreach (char c in invalidFileNameChars)
			{
				text = text.Replace(c.ToString(), "");
			}
			string text2 = Path.Combine(Main.SavesDirPath, text, savenameee + ".toyl");
			if (File.Exists(text2))
			{
				StringBuilder stringBuilder = new StringBuilder();
				stringBuilder.Append("v2\n");
				for (int j = 0; j < ToyBuilding.Buildings.Count; j++)
				{
					ToyBuilding val = ToyBuilding.Buildings[j];
					makeitgoaeaeaea makeitgoaeaeaea2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<makeitgoaeaeaea>() : null);
					stringBuilder.Append(((Object)(object)makeitgoaeaeaea2 != (Object)null) ? makeitgoaeaeaea2.squishitdownn() : "0;;;;");
					stringBuilder.Append('\n');
				}
				File.WriteAllText(sidefilepthh(text2), stringBuilder.ToString());
			}
		}
		catch (Exception ex)
		{
			if (justinserthereandhere.loggyyy != null)
			{
				justinserthereandhere.loggyyy.LogError((object)("no save pro destruc flag4qea :( " + ex));
			}
		}
	}

	public static void readitbakk(string toylpathhh)
	{
		try
		{
			string path = sidefilepthh(toylpathhh);
			if (!File.Exists(path))
			{
				return;
			}
			string text = File.ReadAllText(path).Trim();
			List<ToyBuilding> list = wtfsnewwwz();
			if (text.StartsWith("v2"))
			{
				string[] array = text.Split(new char[1] { '\n' });
				if (list.Count != array.Length - 1)
				{
					return;
				}
				for (int i = 0; i < list.Count; i++)
				{
					string[] array2 = array[i + 1].Trim().Split(new char[1] { ';' });
					if (!(array2[0] != "1"))
					{
						makeitgoaeaeaea makeitgoaeaeaea2 = ((Component)list[i]).GetComponent<makeitgoaeaeaea>();
						if ((Object)(object)makeitgoaeaeaea2 == (Object)null)
						{
							makeitgoaeaeaea2 = ((Component)list[i]).gameObject.AddComponent<makeitgoaeaeaea>();
						}
						makeitgoaeaeaea2.unsquishitupp(array2);
					}
				}
			}
			else
			{
				if (list.Count != text.Length)
				{
					return;
				}
				for (int j = 0; j < list.Count; j++)
				{
					if (text[j] == '1' && (Object)(object)((Component)list[j]).GetComponent<makeitgoaeaeaea>() == (Object)null)
					{
						((Component)list[j]).gameObject.AddComponent<makeitgoaeaeaea>();
					}
				}
			}
		}
		catch (Exception ex)
		{
			if (justinserthereandhere.loggyyy != null)
			{
				justinserthereandhere.loggyyy.LogError((object)("no load the prop destruc info/flags/whatever :( " + ex));
			}
		}
	}
}
[HarmonyPatch(typeof(ToyWindowHandler), "SaveLayout")]
internal static class savealsoo
{
	private static void Postfix(string saveName)
	{
		sidekickfilee.writeitdwnn(saveName);
	}
}
[HarmonyPatch(typeof(ToyWindowHandler), "LoadButtonClick")]
internal static class loadalsoooo
{
	private static void Prefix()
	{
		sidekickfilee.snappiccc();
	}

	private static void Postfix(string path)
	{
		sidekickfilee.readitbakk(path);
	}
}
[HarmonyPatch(typeof(ToyWindowHandler), "ButtonClick")]
internal static class newprophiii
{
	private static void Prefix()
	{
		sidekickfilee.snappiccc();
	}

	private static void Postfix()
	{
		if (!changesomestuffifulike.newguysstartbonkk.Value)
		{
			return;
		}
		List<ToyBuilding> list = sidekickfilee.wtfsnewwwz();
		for (int i = 0; i < list.Count; i++)
		{
			if ((Object)(object)((Component)list[i]).GetComponent<makeitgoaeaeaea>() == (Object)null)
			{
				((Component)list[i]).gameObject.AddComponent<makeitgoaeaeaea>();
			}
		}
	}
}
internal sealed class makethemfightwallscuzdumb : MonoBehaviour
{
	private const float howoftenlookk = 0.35f;

	private float nextlookkk;

	private bool yelledalreadyy;

	private readonly Dictionary<int, float> stuckforrr = new Dictionary<int, float>();

	private void Update()
	{
		if (!makeitgoaeaeaea.fighttimee)
		{
			if (stuckforrr.Count > 0)
			{
				stuckforrr.Clear();
			}
		}
		else
		{
			if (!changesomestuffifulike.guysbonkwallsss.Value || makeitgoaeaeaea.everybonkk.Count == 0 || Time.time < nextlookkk)
			{
				return;
			}
			nextlookkk = Time.time + 0.35f;
			try
			{
				lookatemalll();
			}
			catch (Exception ex)
			{
				if (!yelledalreadyy && justinserthereandhere.loggyyy != null)
				{
					justinserthereandhere.loggyyy.LogError((object)("units did nto bonk the walll :( " + ex));
				}
				yelledalreadyy = true;
			}
		}
	}

	private void lookatemalll()
	{
		//IL_00cf: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
		//IL_013f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0143: Unknown result type (might be due to invalid IL or missing references)
		//IL_0148: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bc: 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_01ec: 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_0158: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0201: Unknown result type (might be due to invalid IL or missing references)
		//IL_0298: 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_0274: 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_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_026b: 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)
		Unit[] array = Object.FindObjectsOfType<Unit>();
		List<Unit> list = new List<Unit>();
		foreach (Unit val in array)
		{
			if (!((Object)(object)val == (Object)null) && !val.dead && !val.isUnitCopy && !((Object)(object)val.data == (Object)null) && !val.data.Dead)
			{
				list.Add(val);
			}
		}
		for (int j = 0; j < list.Count; j++)
		{
			Unit val2 = list[j];
			if ((Object)(object)val2.api != (Object)null && !val2.api.Active)
			{
				continue;
			}
			Rigidbody mainRig = val2.data.mainRig;
			if ((Object)(object)mainRig == (Object)null)
			{
				continue;
			}
			Vector3 val3 = (((Object)(object)val2.data.hip != (Object)null) ? val2.data.hip.position : mainRig.position);
			if (!wheresthebadguyy(val2, list, val3, out var wheree, out var rigg))
			{
				continue;
			}
			Vector3 val4 = wheree - val3;
			val4.y = 0f;
			float magnitude = ((Vector3)(ref val4)).magnitude;
			int instanceID = ((Object)val2).GetInstanceID();
			if (magnitude <= val2.m_AttackDistance + 0.5f || magnitude < 0.01f)
			{
				stuckforrr.Remove(instanceID);
				continue;
			}
			val4 /= magnitude;
			if (changesomestuffifulike.onlybonkifstuckk.Value)
			{
				Vector3 velocity = mainRig.velocity;
				velocity.y = 0f;
				stuckforrr.TryGetValue(instanceID, out var value);
				value = ((!(((Vector3)(ref velocity)).magnitude < 0.8f)) ? 0f : (value + 0.35f));
				stuckforrr[instanceID] = value;
				if (value < changesomestuffifulike.howlongtillstuckk.Value)
				{
					continue;
				}
			}
			RaycastHit[] array2 = Physics.SphereCastAll(val3, 0.35f, val4, Mathf.Max(changesomestuffifulike.howfarguyslookk.Value, 0.1f), -1, (QueryTriggerInteraction)1);
			makeitgoaeaeaea makeitgoaeaeaea2 = null;
			float num = float.MaxValue;
			Vector3 val5 = val3;
			for (int k = 0; k < array2.Length; k++)
			{
				RaycastHit val6 = array2[k];
				if ((Object)(object)((RaycastHit)(ref val6)).collider == (Object)null || ((RaycastHit)(ref val6)).distance >= num)
				{
					continue;
				}
				makeitgoaeaeaea makeitgoaeaeaea3 = makeitgoaeaeaea.whosbonkabull(((RaycastHit)(ref val6)).collider);
				if (!((Object)(object)makeitgoaeaeaea3 == (Object)null) && !makeitgoaeaeaea3.areudeddd)
				{
					num = ((RaycastHit)(ref val6)).distance;
					makeitgoaeaeaea2 = makeitgoaeaeaea3;
					Vector3 val7;
					if (!(((RaycastHit)(ref val6)).distance > 0f))
					{
						Bounds bounds = ((RaycastHit)(ref val6)).collider.bounds;
						val7 = ((Bounds)(ref bounds)).ClosestPoint(val3);
					}
					else
					{
						val7 = ((RaycastHit)(ref val6)).point;
					}
					val5 = val7;
				}
			}
			if (!((Object)(object)makeitgoaeaeaea2 == (Object)null))
			{
				val2.Attack(val5, rigg, val4);
			}
		}
	}

	private static bool wheresthebadguyy(Unit uu, List<Unit> alivee, Vector3 fromm, out Vector3 wheree, out Rigidbody rigg)
	{
		//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_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		wheree = Vector3.zero;
		rigg = uu.data.targetMainRig;
		if ((Object)(object)rigg != (Object)null)
		{
			DataHandler targetData = uu.data.targetData;
			if ((Object)(object)targetData == (Object)null || !targetData.Dead)
			{
				wheree = rigg.position;
				return true;
			}
		}
		rigg = null;
		float num = float.MaxValue;
		for (int i = 0; i < alivee.Count; i++)
		{
			Unit val = alivee[i];
			if (!((Object)(object)val == (Object)(object)uu) && val.Team != uu.Team && !((Object)(object)val.data.mainRig == (Object)null))
			{
				Vector3 val2 = val.data.mainRig.position - fromm;
				float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude;
				if (sqrMagnitude < num)
				{
					num = sqrMagnitude;
					rigg = val.data.mainRig;
				}
			}
		}
		if ((Object)(object)rigg == (Object)null)
		{
			return false;
		}
		wheree = rigg.position;
		return true;
	}
}
[HarmonyPatch(typeof(TransformGizmo), "GetTarget")]
internal static class noclickbehindmenuu
{
	private static bool Prefix()
	{
		return !manitliveaea.mouseonmenuuu();
	}
}
internal sealed class manitliveaea : MonoBehaviour
{
	private static Rect menuboxxx = new Rect(12f, 90f, 260f, 10f);

	private static bool menuuppp;

	private static bool menuhiddennn;

	private static bool bigstuffopenn;

	private static bool needsavee;

	private static Action doitnextframee;

	private static readonly Dictionary<string, string> typedzz = new Dictionary<string, string>();

	private static readonly CultureInfo cultt = CultureInfo.InvariantCulture;

	private bool typinggg;

	public static bool mouseonmenuuu()
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: 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_0020: 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)
		if (!menuuppp)
		{
			return false;
		}
		Vector3 mousePosition = Input.mousePosition;
		return ((Rect)(ref menuboxxx)).Contains(new Vector2(mousePosition.x, (float)Screen.height - mousePosition.y));
	}

	private void Update()
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		GameObject window = ToyWindowHandler.Window;
		menuuppp = !menuhiddennn && (Object)(object)window != (Object)null && window.activeSelf;
		if (!typinggg && Input.GetKeyDown(changesomestuffifulike.menukeyyyy.Value))
		{
			menuhiddennn = !menuhiddennn;
		}
		if (doitnextframee != null)
		{
			Action action = doitnextframee;
			doitnextframee = null;
			try
			{
				action();
			}
			catch (Exception ex)
			{
				if (justinserthereandhere.loggyyy != null)
				{
					justinserthereandhere.loggyyy.LogError((object)("menu button did nto do the thing :( " + ex));
				}
			}
		}
		if (!menuuppp && typinggg)
		{
			typinggg = false;
			UIScreenInputBlocker.DoBlockInput(false);
		}
		if (needsavee && !typinggg)
		{
			needsavee = false;
			if (changesomestuffifulike.thecfgfilee != null)
			{
				changesomestuffifulike.thecfgfilee.Save();
			}
		}
	}

	private void OnApplicationQuit()
	{
		if (changesomestuffifulike.thecfgfilee != null)
		{
			changesomestuffifulike.thecfgfilee.Save();
		}
	}

	private void OnGUI()
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Expected O, but got Unknown
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: 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)
		if (menuuppp)
		{
			Event current = Event.current;
			if ((int)current.type == 0 && !((Rect)(ref menuboxxx)).Contains(current.mousePosition))
			{
				GUI.FocusControl("");
			}
			menuboxxx = GUILayout.Window(31501, menuboxxx, new WindowFunction(makalilmen), "Turtle's toybox prop destroy", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(260f) });
			((Rect)(ref menuboxxx)).x = Mathf.Clamp(((Rect)(ref menuboxxx)).x, 0f, (float)Screen.width - 60f);
			((Rect)(ref menuboxxx)).y = Mathf.Clamp(((Rect)(ref menuboxxx)).y, 0f, (float)Screen.height - 30f);
			string nameOfFocusedControl = GUI.GetNameOfFocusedControl();
			bool flag = !string.IsNullOrEmpty(nameOfFocusedControl) && nameOfFocusedControl.StartsWith("tbd_");
			if (flag != typinggg)
			{
				typinggg = flag;
				UIScreenInputBlocker.DoBlockInput(flag);
			}
		}
	}

	private static string typeboxxx(string idd, string currr)
	{
		string text = "tbd_" + idd;
		GUI.SetNextControlName(text);
		if (!typedzz.TryGetValue(idd, out var value) || GUI.GetNameOfFocusedControl() != text)
		{
			value = currr;
		}
		value = GUILayout.TextField(value, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
		typedzz[idd] = value;
		return value;
	}

	private static bool isfloattt(string txtt, out float vvv)
	{
		return float.TryParse(txtt.Replace(',', '.'), NumberStyles.Float, cultt, out vvv);
	}

	private static void arowfloatttttttt(string labelll, string idd, ref float valll, float minnn)
	{
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label(labelll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) });
		string text = ((valll >= 0f) ? valll.ToString("0.##", cultt) : "");
		string text2 = typeboxxx(idd, text);
		if (text2 != text)
		{
			float vvv;
			if (text2.Trim().Length == 0)
			{
				valll = -1f;
			}
			else if (isfloattt(text2, out vvv))
			{
				valll = Mathf.Max(vvv, minnn);
			}
		}
		GUILayout.EndHorizontal();
	}

	private static void iareaeraroworaea(string labelll, string idd, ref int valll, int minnn)
	{
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label(labelll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) });
		string text = ((valll >= minnn) ? valll.ToString(cultt) : "");
		string text2 = typeboxxx(idd, text);
		if (text2 != text)
		{
			int result;
			if (text2.Trim().Length == 0)
			{
				valll = -1;
			}
			else if (int.TryParse(text2, NumberStyles.Integer, cultt, out result))
			{
				valll = Mathf.Max(result, minnn);
			}
		}
		GUILayout.EndHorizontal();
	}

	private static void whatisthisgain(string labelll, string idd, ConfigEntry<float> eee, float minnn)
	{
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label(labelll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) });
		string text = eee.Value.ToString("0.##", cultt);
		string text2 = typeboxxx(idd, text);
		if (text2 != text && isfloattt(text2, out var vvv))
		{
			eee.Value = Mathf.Max(vvv, minnn);
			needsavee = true;
		}
		GUILayout.EndHorizontal();
	}

	private static void aglobinrarow(string labelll, string idd, ConfigEntry<int> eee, int minnn)
	{
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		GUILayout.Label(labelll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) });
		string text = eee.Value.ToString(cultt);
		string text2 = typeboxxx(idd, text);
		if (text2 != text && int.TryParse(text2, NumberStyles.Integer, cultt, out var result))
		{
			eee.Value = Mathf.Max(result, minnn);
			needsavee = true;
		}
		GUILayout.EndHorizontal();
	}

	private static void globboolroww(string labelll, ConfigEntry<bool> eee)
	{
		bool flag = GUILayout.Toggle(eee.Value, labelll, Array.Empty<GUILayoutOption>());
		if (flag != eee.Value)
		{
			eee.Value = flag;
			needsavee = true;
		}
	}

	private void makalilmen(int winidd)
	{
		//IL_0410: Unknown result type (might be due to invalid IL or missing references)
		Transform selected = ToyWindowHandler.Selected;
		ToyBuilding val = (((Object)(object)selected != (Object)null) ? ((Component)selected).GetComponent<ToyBuilding>() : null);
		makeitgoaeaeaea makeitgoaeaeaea2 = (((Object)(object)selected != (Object)null) ? ((Component)selected).GetComponent<makeitgoaeaeaea>() : null);
		if ((Object)(object)val == (Object)null)
		{
			GUILayout.Label("Select a prop... foollll", Array.Empty<GUILayoutOption>());
		}
		else
		{
			bool flag = GUILayout.Toggle((Object)(object)makeitgoaeaeaea2 != (Object)null, "Enable prop destruct", Array.Empty<GUILayoutOption>());
			if (flag != ((Object)(object)makeitgoaeaeaea2 != (Object)null))
			{
				GameObject gobb = ((Component)selected).gameObject;
				if (flag)
				{
					doitnextframee = delegate
					{
						if ((Object)(object)gobb != (Object)null && (Object)(object)gobb.GetComponent<makeitgoaeaeaea>() == (Object)null)
						{
							gobb.AddComponent<makeitgoaeaeaea>();
						}
					};
				}
				else
				{
					doitnextframee = delegate
					{
						if ((Object)(object)gobb != (Object)null)
						{
							makeitgoaeaeaea component = gobb.GetComponent<makeitgoaeaeaea>();
							if ((Object)(object)component != (Object)null)
							{
								Object.DestroyImmediate((Object)(object)component);
							}
						}
					};
				}
			}
			if ((Object)(object)makeitgoaeaeaea2 != (Object)null)
			{
				arowfloatttttttt("Strength", "pstr", ref makeitgoaeaeaea2.myouchbudgett, 1f);
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("Break style", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(110f) });
				int num = GUILayout.SelectionGrid(makeitgoaeaeaea2.myboomstylee, new string[3] { "Global", "Material", "Random" }, 3, Array.Empty<GUILayoutOption>());
				if (num != makeitgoaeaeaea2.myboomstylee)
				{
					makeitgoaeaeaea2.myboomstylee = num;
				}
				GUILayout.EndHorizontal();
				arowfloatttttttt("Debris time", "pbit", ref makeitgoaeaeaea2.mybitstayyy, 0f);
				iareaeraroworaea("Pieces", "pcnt", ref makeitgoaeaeaea2.mybitamountt, 1);
				if (GUILayout.Button("Copy to same", Array.Empty<GUILayoutOption>()))
				{
					makeitgoaeaeaea srcc = makeitgoaeaeaea2;
					string pathh = val.path;
					doitnextframee = delegate
					{
						letcopyitae(srcc, pathh);
					};
				}
			}
		}
		GUILayout.Space(6f);
		globboolroww("New props start on", changesomestuffifulike.newguysstartbonkk);
		GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
		if (GUILayout.Button("All on", Array.Empty<GUILayoutOption>()))
		{
			doitnextframee = turnemallonn;
		}
		if (GUILayout.Button("All off", Array.Empty<GUILayoutOption>()))
		{
			doitnextframee = turnemalloffff;
		}
		GUILayout.EndHorizontal();
		bigstuffopenn = GUILayout.Toggle(bigstuffopenn, "Settings", GUI.skin.button, Array.Empty<GUILayoutOption>());
		if (bigstuffopenn)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Break style", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) });
			int num2 = GUILayout.SelectionGrid((changesomestuffifulike.hwtobreakk.Value == "Random") ? 1 : 0, new string[2] { "Material", "Random" }, 2, Array.Empty<GUILayoutOption>());
			if (((num2 == 1) ? "Random" : "Material") != changesomestuffifulike.hwtobreakk.Value)
			{
				changesomestuffifulike.hwtobreakk.Value = ((num2 == 1) ? "Random" : "Material");
				needsavee = true;
			}
			GUILayout.EndHorizontal();
			whatisthisgain("Prop strength", "gstr", changesomestuffifulike.ouchbudgett, 1f);
			globboolroww("Size health", changesomestuffifulike.bigmeansbeefyy);
			whatisthisgain("Damage mult", "gmul", changesomestuffifulike.hurtmultiii, 0.01f);
			whatisthisgain("Weak hit ignore", "gweak", changesomestuffifulike.tooweakignoree, 0f);
			aglobinrarow("Pieces", "gcnt", changesomestuffifulike.rngbitcountt, 1);
			whatisthisgain("Debris time", "gbit", changesomestuffifulike.howlongbitssstay, 0f);
			whatisthisgain("Debris fast", "gyeet", changesomestuffifulike.yeetforcee, 0f);
			aglobinrarow("Debris limit", "gcap", changesomestuffifulike.bitcapppp, 1);
			globboolroww("Pathfinding props break", changesomestuffifulike.mapguyscanbreakkk);
			globboolroww("Units hit props", changesomestuffifulike.guysbonkwallsss);
			whatisthisgain("Hit dist", "gbrch", changesomestuffifulike.howfarguyslookk, 0.1f);
			globboolroww("Only when stuck", changesomestuffifulike.onlybonkifstuckk);
			whatisthisgain("Stuck time", "gstk", changesomestuffifulike.howlongtillstuckk, 0f);
		}
		GUI.DragWindow(new Rect(0f, 0f, 10000f, 22f));
	}

	private static void turnemallonn()
	{
		for (int i = 0; i < ToyBuilding.Buildings.Count; i++)
		{
			ToyBuilding val = ToyBuilding.Buildings[i];
			if ((Object)(object)val != (Object)null && (Object)(object)((Component)val).GetComponent<makeitgoaeaeaea>() == (Object)null)
			{
				((Component)val).gameObject.AddComponent<makeitgoaeaeaea>();
			}
		}
	}

	private static void turnemalloffff()
	{
		for (int i = 0; i < ToyBuilding.Buildings.Count; i++)
		{
			ToyBuilding val = ToyBuilding.Buildings[i];
			makeitgoaeaeaea makeitgoaeaeaea2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<makeitgoaeaeaea>() : null);
			if ((Object)(object)makeitgoaeaeaea2 != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)makeitgoaeaeaea2);
			}
		}
	}

	private static void letcopyitae(makeitgoaeaeaea srcc, string pathh)
	{
		if ((Object)(object)srcc == (Object)null)
		{
			return;
		}
		for (int i = 0; i < ToyBuilding.Buildings.Count; i++)
		{
			ToyBuilding val = ToyBuilding.Buildings[i];
			if (!((Object)(object)val == (Object)null) && !(val.path != pathh))
			{
				makeitgoaeaeaea makeitgoaeaeaea2 = ((Component)val).GetComponent<makeitgoaeaeaea>();
				if ((Object)(object)makeitgoaeaeaea2 == (Object)null)
				{
					makeitgoaeaeaea2 = ((Component)val).gameObject.AddComponent<makeitgoaeaeaea>();
				}
				if ((Object)(object)makeitgoaeaeaea2 != (Object)(object)srcc)
				{
					makeitgoaeaeaea2.stealsettingsfromm(srcc);
				}
			}
		}
	}
}