Decompiled source of Koki Weapons v2.1.2

KokiWeapons.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using ComputerysModdingUtilities;
using FishNet;
using FishNet.Connection;
using FishNet.Managing;
using FishNet.Managing.Object;
using FishNet.Managing.Server;
using FishNet.Object;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MyceliumNetworking;
using Steamworks;
using UnityEngine;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: StraftatMod(false)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Koki")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+989b3eeb281029cdf7114b7b0f5e8953cde9f711")]
[assembly: AssemblyProduct("KokiWeapons")]
[assembly: AssemblyTitle("KokiWeapons")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[HarmonyPatch(typeof(Settings))]
public class SpawnWeaponOnTaunt
{
	public static List<GameObject> weapons = new List<GameObject>();

	[HarmonyPatch("IncreaseTauntsAmount")]
	public static void Prefix(Settings __instance)
	{
		//IL_00c4: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_010c: Unknown result type (might be due to invalid IL or missing references)
		string text = "";
		if (Input.GetKeyDown((KeyCode)49))
		{
			text = "RC Car";
		}
		else if (Input.GetKeyDown((KeyCode)50))
		{
			text = "Repulsion Grenade";
		}
		else if (Input.GetKeyDown((KeyCode)51))
		{
			text = "HandGrenade";
		}
		else if (Input.GetKeyDown((KeyCode)52))
		{
			text = "Teleport Mine";
		}
		else if (Input.GetKeyDown((KeyCode)53))
		{
			text = "APMine";
		}
		else if (Input.GetKeyDown((KeyCode)54))
		{
			text = "Gun";
		}
		if (!(text == "") && InstanceFinder.IsServer)
		{
			FirstPersonController[] array = Object.FindObjectsOfType<FirstPersonController>();
			foreach (FirstPersonController val in array)
			{
				Vector3 val2 = val.playerCameraHolder.transform.position + ((Vector3)(ref val.dirForward)).normalized;
				val2.y -= 0.5f;
				GameObject val3 = Object.Instantiate<GameObject>(SpawnerManager.NameToWeaponDict[text], val2, Quaternion.identity);
				val3.GetComponent<ItemBehaviour>().DispenserDrop(Vector3.zero);
				val3.GetComponent<Rigidbody>().isKinematic = true;
				((NetworkBehaviour)val).ServerManager.Spawn(val3, (NetworkConnection)null);
				weapons.Add(val3);
			}
		}
	}
}
[HarmonyPatch(typeof(WeaponHandSpawner), "RpcLogic___SpawnObject_2587446063")]
public static class CreatePlaceItemEvent
{
	public class PlaceItemEventArgs : EventArgs
	{
		public WeaponHandSpawner spawner;

		public GameObject spawnedObj;

		public bool runOriginalCode = false;
	}

	public static event EventHandler<PlaceItemEventArgs> PlaceItemEvent;

	public static bool TriggerPlaceItemEvent(WeaponHandSpawner __instance, GameObject obj)
	{
		PlaceItemEventArgs e = new PlaceItemEventArgs
		{
			spawner = __instance,
			spawnedObj = obj
		};
		CreatePlaceItemEvent.PlaceItemEvent(null, e);
		return e.runOriginalCode;
	}

	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
	{
		//IL_0050: 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_0075: Expected O, but got Unknown
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Expected O, but got Unknown
		//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bb: Expected O, but got Unknown
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Expected O, but got Unknown
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d7: Expected O, but got Unknown
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ea: Expected O, but got Unknown
		MethodInfo methodInfo = AccessTools.Method(typeof(ServerManager), "Spawn", new Type[2]
		{
			typeof(GameObject),
			typeof(NetworkConnection)
		}, (Type[])null);
		MethodInfo methodInfo2 = AccessTools.Method(typeof(CreatePlaceItemEvent), "TriggerPlaceItemEvent", (Type[])null, (Type[])null);
		Label label = default(Label);
		return new CodeMatcher(instructions, generator).End().MatchBack(false, (CodeMatch[])(object)new CodeMatch[1]
		{
			new CodeMatch((OpCode?)OpCodes.Ret, (object)null, (string)null)
		}).CreateLabel(ref label)
			.MatchBack(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Callvirt, (object)methodInfo, (string)null)
			})
			.Advance(1)
			.Insert((CodeInstruction[])(object)new CodeInstruction[4]
			{
				new CodeInstruction(OpCodes.Ldarg_0, (object)null),
				new CodeInstruction(OpCodes.Ldloc_0, (object)null),
				new CodeInstruction(OpCodes.Call, (object)methodInfo2),
				new CodeInstruction(OpCodes.Brfalse, (object)label)
			})
			.InstructionEnumeration();
	}
}
[HarmonyPatch(typeof(Resources), "LoadAll", new Type[]
{
	typeof(string),
	typeof(Type)
})]
public static class InsertWeaponsIntoResources
{
	public static void Postfix(string path, ref Object[] __result)
	{
		if (!(path != "RandomWeapons"))
		{
			List<Object> list = new List<Object>(__result);
			list.AddRange((IEnumerable<Object>)KokiWeaponsPlugin.CustomWeapons);
			__result = list.ToArray();
		}
	}
}
[HarmonyPatch(typeof(SpawnerManager), "PopulateAllWeapons")]
public static class PostWeaponRegistration
{
	internal static AssetBundle SharedAssets;

	public static void Postfix()
	{
		if (!KokiWeaponsPlugin.RegisteredWeapons)
		{
			KokiWeaponsPlugin.RegisteredWeapons = true;
			LoadDecals();
			RegisterFishnet.Postfix();
		}
	}

	public static void LoadDecals()
	{
		PhysicsGrenade component = SpawnerManager.NameToWeaponDict["HandGrenade"].GetComponent<PhysicsGrenade>();
		GameObject[] array = SharedAssets.LoadAllAssets<GameObject>();
		foreach (GameObject val in array)
		{
			if (((Object)val).name.EndsWith("Decal"))
			{
				if (((Object)val).name == "explosionDecal")
				{
					Object.Instantiate<GameObject>(component.explosionDecal).transform.SetParent(val.transform);
				}
				else if (((Object)val).name == "bloodDecal")
				{
					Object.Instantiate<GameObject>(component.bloodSplatter).transform.SetParent(val.transform);
				}
			}
		}
	}
}
[HarmonyPatch(typeof(NetworkManager), "Start")]
public static class RegisterFishnet
{
	public static void Postfix()
	{
		if (!KokiWeaponsPlugin.RegisteredWeapons)
		{
			return;
		}
		PrefabObjects spawnablePrefabs = InstanceFinder.NetworkManager.SpawnablePrefabs;
		NetworkObject val = default(NetworkObject);
		foreach (GameObject networkObject in KokiWeaponsPlugin.NetworkObjects)
		{
			if (Object.op_Implicit((Object)(object)networkObject))
			{
				networkObject.TryGetComponent<NetworkObject>(ref val);
				spawnablePrefabs.AddObject(val, false);
			}
		}
		spawnablePrefabs.InitializePrefabRange(0);
	}

	public static void DeregisterFishnet()
	{
		HashSet<NetworkObject> hashSet = new HashSet<NetworkObject>();
		foreach (GameObject networkObject in KokiWeaponsPlugin.NetworkObjects)
		{
			hashSet.Add(networkObject.GetComponent<NetworkObject>());
		}
		NetworkManager networkManager = InstanceFinder.NetworkManager;
		PrefabObjects spawnablePrefabs = networkManager.SpawnablePrefabs;
		int objectCount = spawnablePrefabs.GetObjectCount();
		List<NetworkObject> list = new List<NetworkObject>();
		for (int i = 0; i < objectCount; i++)
		{
			NetworkObject val = spawnablePrefabs.GetObject(true, i);
			if ((Object)(object)val != (Object)null && !hashSet.Contains(val))
			{
				list.Add(val);
			}
		}
		spawnablePrefabs.Clear();
		spawnablePrefabs.AddObjects(list, false);
		spawnablePrefabs.InitializePrefabRange(0);
	}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.koki.kokiweapons", "Koki Weapons", "2.1.1")]
internal class KokiWeaponsPlugin : BaseUnityPlugin
{
	internal static KokiWeaponsPlugin Instance;

	private static Harmony Harmony;

	private static readonly string[] BundleNames = new string[4] { "kokiweapons_shared", "tptrap", "repulsiongrenade", "rccar" };

	internal static List<GameObject> CustomWeapons = new List<GameObject>();

	internal static List<GameObject> NetworkObjects = new List<GameObject>();

	internal static bool RegisteredWeapons = false;

	internal static bool KWDebug = false;

	private void Awake()
	{
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		Instance = this;
		((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
		Harmony = new Harmony("com.koki.kokiweapons");
		Harmony.PatchAll();
		foreach (AssetBundle allLoadedAssetBundle in AssetBundle.GetAllLoadedAssetBundles())
		{
			if (BundleNames.Contains(((Object)allLoadedAssetBundle).name))
			{
				allLoadedAssetBundle.Unload(true);
			}
		}
		LoadBundles();
		((Component)this).gameObject.AddComponent<TPTrapNetworking>();
		((Component)this).gameObject.AddComponent<RCCarNetworking>();
		UpdateTrapLinkOnPlace.Init();
		RCCarLink.Init();
	}

	private void OnDestroy()
	{
		Harmony.UnpatchSelf();
		foreach (GameObject weapon in SpawnWeaponOnTaunt.weapons)
		{
			if (Object.op_Implicit((Object)(object)weapon))
			{
				InstanceFinder.ServerManager.Despawn(weapon, (DespawnType?)null);
			}
		}
		((Component)this).gameObject.GetComponent<TPTrapNetworking>().Deregister();
		((Component)this).gameObject.AddComponent<RCCarNetworking>().Deregister();
		if (RegisteredWeapons)
		{
			Array.Resize(ref SpawnerManager.AllWeapons, SpawnerManager.AllWeapons.Length - CustomWeapons.Count);
			RegisterFishnet.DeregisterFishnet();
		}
	}

	private void LoadBundles()
	{
		string text = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
		if (Utility.IsNullOrWhiteSpace(text))
		{
			KWDebug = true;
			Debug.LogError((object)"DEBUG MODE ACTIVE");
			text = Path.Combine(Paths.PluginPath, "DEVELOPMENT-BUILD-Koki Weapons");
		}
		else
		{
			Harmony.Unpatch((MethodBase)typeof(Settings).GetMethod("IncreaseTauntsAmount"), (HarmonyPatchType)1, "com.koki.kokiweapons");
		}
		AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(text, "kokiweapons_shared"));
		Material[] array = val.LoadAllAssets<Material>();
		foreach (Material val2 in array)
		{
			val2.shader = Shader.Find(((Object)val2.shader).name);
		}
		PostWeaponRegistration.SharedAssets = val;
		string[] files = Directory.GetFiles(text);
		foreach (string path in files)
		{
			string fileName = Path.GetFileName(path);
			if (!BundleNames.Contains(fileName) || fileName == "kokiweapons_shared")
			{
				continue;
			}
			AssetBundle val3 = AssetBundle.LoadFromFile(Path.Combine(text, fileName));
			GameObject[] array2 = val3.LoadAllAssets<GameObject>();
			foreach (GameObject val4 in array2)
			{
				if (Object.op_Implicit((Object)(object)val4.GetComponent<ItemBehaviour>()))
				{
					CustomWeapons.Add(val4);
				}
				if (Object.op_Implicit((Object)(object)val4.GetComponent<NetworkObject>()))
				{
					NetworkObjects.Add(val4);
				}
			}
		}
		if (!KWDebug || !Object.op_Implicit((Object)(object)InstanceFinder.NetworkManager))
		{
			return;
		}
		SpawnerManager.AllWeapons = null;
		SpawnerManager.PopulateAllWeapons();
		Type[] array3 = new Type[2]
		{
			typeof(RCCar),
			typeof(RCCarItem)
		};
		Dictionary<string, Type> dictionary = array3.Zip(array3.Select((Type type) => type.Name), (Type k2, string v) => new
		{
			k = k2,
			v = v
		}).ToDictionary(x => x.v, x => x.k);
		foreach (GameObject networkObject in NetworkObjects)
		{
			Component[] components = networkObject.GetComponents<Component>();
			foreach (Component val5 in components)
			{
				if (dictionary.ContainsKey(((object)val5).GetType().Name))
				{
					Component destination = networkObject.AddComponent(dictionary[((object)val5).GetType().Name]);
					CopyComponentData(val5, destination);
					Object.Destroy((Object)(object)val5);
				}
			}
		}
	}

	private static void CopyComponentData(Component source, Component destination)
	{
		try
		{
			string text = JsonUtility.ToJson((object)source);
			JsonUtility.FromJsonOverwrite(text, (object)destination);
		}
		catch (Exception ex)
		{
			Debug.LogWarning((object)("[HotReload] Failed to copy data via JsonUtility: " + ex.Message));
		}
	}
}
public class KBGrenade : PhysicsGrenade
{
	internal static ConfigEntry<int> grenadeDamage = ((BaseUnityPlugin)KokiWeaponsPlugin.Instance).Config.Bind<int>("KB Grenade", "Damage", 0, new ConfigDescription("How much damage the KB Grenade should deal on impact, range from 0-100.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));

	internal void KBExplosion(Vector3 position)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_0136: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00df: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).transform.position = position;
		Collider[] array = Physics.OverlapSphere(position, base.explosionRadius, LayerMask.op_Implicit(base.bodyLayer));
		Rigidbody rb = null;
		CollectionExtensions.DoIf<Collider>((IEnumerable<Collider>)array, (Func<Collider, bool>)((Collider c) => Object.op_Implicit((Object)(object)c) && ((Component)c).gameObject.TryGetComponent<Rigidbody>(ref rb)), (Action<Collider>)delegate(Collider item)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: 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_0069: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val2 = ((Component)item).transform.position - ((Component)this).transform.position;
			val2.y = 0f;
			((Vector3)(ref val2)).Normalize();
			val2 *= 10f;
			val2.y = 2f;
			Transform transform = ((Component)item).transform;
			transform.position += new Vector3(0f, 2.5f, 0f);
			rb.AddForce(val2, (ForceMode)1);
		});
		CollectionExtensions.Do<PlayerHealth>(array.Select((Collider c) => ((Component)c).GetComponentInParent<PlayerHealth>()).Distinct(), (Action<PlayerHealth>)delegate(PlayerHealth ph)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)ph) && !ph.sync___get_value_isKilled())
			{
				Vector3 val2 = ((Component)ph.controller).transform.position - ((Component)this).transform.position;
				if (val2.y < 0f)
				{
					val2.y = 0f;
				}
				((Vector3)(ref val2)).Normalize();
				if (ph.controller.isGrounded)
				{
					Transform transform = ((Component)ph.controller).transform;
					transform.position += new Vector3(0f, 2.5f, 0f);
				}
				ph.controller.CustomAddForce(val2, 120f);
				if (base.isOwner && grenadeDamage.Value > 0)
				{
					ph.RemoveHealth((float)(grenadeDamage.Value / 25));
				}
			}
		});
		Object.Destroy((Object)(object)((Component)this).gameObject, 3f);
		((Behaviour)this).enabled = false;
		((Component)base.graph).gameObject.SetActive(false);
		if (!base.fragGrenade)
		{
			GameObject val = Object.Instantiate<GameObject>(base.explosionVfx, ((Component)this).transform.position, Quaternion.identity);
			if ((Object)(object)val.transform.Find("ball") != (Object)null)
			{
				val.transform.Find("ball").localScale = base.vfxScale;
			}
		}
		Object.Instantiate<GameObject>(base.explosionDecal, ((Component)this).transform.position, Quaternion.identity);
		base.audio.Play();
	}

	internal void Spin()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: 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)
		base.graph.Rotate(base.rotateAxis * base.rotateSpeed * Time.deltaTime);
	}
}
[HarmonyPatch(typeof(PhysicsGrenade))]
internal class KBGrenadeOverrides
{
	[HarmonyPatch("RpcLogic___HandleExplosion_4276783012")]
	[HarmonyPrefix]
	private static bool RedirectHandleExplosion(PhysicsGrenade __instance, Vector3 position)
	{
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		if (__instance is KBGrenade kBGrenade)
		{
			kBGrenade.KBExplosion(position);
			return false;
		}
		return true;
	}

	[HarmonyPatch("Update")]
	[HarmonyPostfix]
	private static void StartSpin(PhysicsGrenade __instance)
	{
		if (__instance is KBGrenade kBGrenade)
		{
			kBGrenade.Spin();
		}
	}
}
public enum CarType
{
	Boom
}
public class RCCar : MonoBehaviour
{
	[SerializeField]
	private Transform _cameraPosition;

	[SerializeField]
	private Rigidbody _rb;

	public CarType carType;

	[Header("Bomb Car")]
	public GameObject explosionVFX;

	public AudioClip explosionSound;

	public GameObject explosionDecal;

	public GameObject bloodDecal;

	public float explosionRadius;

	private bool _exploded = false;

	[Header("Movement Settings")]
	public float accel;

	public float maxSpeed;

	public float turnSpeed;

	public AnimationCurve enginePowerCurve = AnimationCurve.Linear(0f, 1f, 1f, 0f);

	[NonSerialized]
	public bool driving = false;

	[NonSerialized]
	public GameObject rcCarItem;

	private FirstPersonController _driver;

	private InputAction _moveInput;

	private Vector3 _inputVector;

	private Transform _cameraTransform;

	private Transform _playerGraphicsTransform;

	private void Awake()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		PauseManager.OnBeforeSpawn += new BeforeSpawnAction(Despawn);
	}

	private void Despawn()
	{
		if (Object.op_Implicit((Object)(object)this) && Object.op_Implicit((Object)(object)((Component)this).gameObject))
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
			if (InstanceFinder.IsServer && ((Component)this).gameObject.GetComponent<NetworkObject>().IsSpawned)
			{
				InstanceFinder.ServerManager.Despawn(((Component)this).gameObject, (DespawnType?)null);
			}
		}
	}

	private void OnDestroy()
	{
		if (driving)
		{
			EndDriving();
		}
	}

	private void Update()
	{
		//IL_0017: 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)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		if (driving)
		{
			_inputVector = Vector2.op_Implicit(_moveInput.ReadValue<Vector2>());
			if (_inputVector.x != 0f)
			{
				float num = _inputVector.x * _inputVector.y * turnSpeed * Time.deltaTime;
				((Component)this).transform.Rotate(0f, num, 0f);
			}
		}
	}

	private void FixedUpdate()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: 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_0088: Unknown result type (might be due to invalid IL or missing references)
		if (driving && _inputVector.y != 0f)
		{
			Vector3 velocity = _rb.velocity;
			float num = Mathf.Clamp01(((Vector3)(ref velocity)).magnitude / maxSpeed);
			float num2 = enginePowerCurve.Evaluate(num);
			_rb.AddForce(((Component)this).transform.forward * accel * num2 * _inputVector.y, (ForceMode)5);
		}
	}

	public void BeginDriving(FirstPersonController driver)
	{
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a0: Expected O, but got Unknown
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Unknown result type (might be due to invalid IL or missing references)
		//IL_0128: Unknown result type (might be due to invalid IL or missing references)
		//IL_012d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: 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_0179: 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)
		_moveInput = driver.move;
		driving = true;
		_driver = driver;
		_cameraTransform = ((Component)driver.playerCamera).transform;
		_cameraTransform.SetParent(_cameraPosition);
		_cameraTransform.localPosition = Vector3.zero;
		driver.playerCamera = null;
		_playerGraphicsTransform = ((Component)driver).transform.root.Find("Graphics").Find("PF_Aboubi_04").Find("SK_Aboubi_00");
		foreach (Transform item in _playerGraphicsTransform)
		{
			Transform val = item;
			((Component)val).gameObject.SetActive(true);
		}
		Transform val2 = _cameraTransform.Find("BobPosition").Find("FPArms");
		((Component)val2.Find("BothHandPositions")).gameObject.SetActive(false);
		((Component)val2.Find("PF_FPArm_Container_IK_00")).gameObject.SetActive(false);
		PlayerActions player = InputManager.inputActions.Player;
		PlayerActions player2 = driver.playerControls.Player;
		((PlayerActions)(ref player2)).Interact.performed -= driver.playerPickupScript.HandleInteraction;
		player2 = driver.playerControls.Player;
		((PlayerActions)(ref player2)).Interact.performed += EndDriving;
		player2 = driver.playerControls.Player;
		((PlayerActions)(ref player2)).FireHold.performed += TriggerWeapon;
	}

	public void TriggerWeapon(CallbackContext _)
	{
		if (carType == CarType.Boom && !_exploded)
		{
			_exploded = true;
			if (driving)
			{
				EndDriving();
				_driver.playerPickupScript.sync___set_value_objInHand(rcCarItem, true);
				((Weapon)_driver.playerPickupScript.objInHand.GetComponent<WeaponHandSpawner>()).currentAmmo = 0;
			}
			RCCarNetworking.RPC("ExplodeObservers", new object[1] { ((Component)this).gameObject.GetComponent<NetworkObject>().ObjectId });
		}
	}

	public void EndDriving(CallbackContext context)
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		EndDriving();
		PlayerActions player = InputManager.inputActions.Player;
		((PlayerActions)(ref player)).Interact.performed += _driver.playerPickupScript.HandleInteraction;
		((PlayerActions)(ref player)).Interact.performed -= EndDriving;
		((PlayerActions)(ref player)).FireHold.performed -= TriggerWeapon;
	}

	public void EndDriving()
	{
		//IL_00f4: 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_0033: Expected O, but got Unknown
		driving = false;
		if (Object.op_Implicit((Object)(object)_playerGraphicsTransform))
		{
			foreach (Transform item in _playerGraphicsTransform)
			{
				Transform val = item;
				if (!Object.op_Implicit((Object)(object)val))
				{
					return;
				}
				((Component)val).gameObject.SetActive(false);
			}
			((Component)_playerGraphicsTransform.GetChild(6)).gameObject.SetActive(true);
		}
		if (Object.op_Implicit((Object)(object)_cameraTransform) && Object.op_Implicit((Object)(object)_driver.playerCameraHolder))
		{
			_driver.playerCamera = ((Component)_cameraTransform).GetComponent<Camera>();
			_cameraTransform.SetParent(_driver.playerCameraHolder.transform);
			_cameraTransform.localPosition = Vector3.zero;
			Transform val2 = _cameraTransform.Find("BobPosition").Find("FPArms");
			((Component)val2.Find("BothHandPositions")).gameObject.SetActive(true);
			((Component)val2.Find("PF_FPArm_Container_IK_00")).gameObject.SetActive(true);
		}
	}

	public void Explode()
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0079: Unknown result type (might be due to invalid IL or missing references)
		CollectionExtensions.Do<PlayerHealth>((from collider in Physics.OverlapSphere(((Component)this).transform.position, explosionRadius, 67584).Where(delegate(Collider collider)
			{
				//IL_0040: 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_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_005b: Unknown result type (might be due to invalid IL or missing references)
				if (((Component)((Component)collider).transform).tag == "ShatterableGlass" && Object.op_Implicit((Object)(object)((Component)collider).gameObject.GetComponent<ShatterableGlass>()))
				{
					((Component)collider).gameObject.GetComponent<ShatterableGlass>().Shatter3D(((Component)collider).transform.position, ((Component)collider).transform.position - ((Component)this).transform.position);
				}
				return Object.op_Implicit((Object)(object)((Component)collider).GetComponentInParent<PlayerHealth>());
			})
			select ((Component)collider).GetComponentInParent<PlayerHealth>()).Distinct(), (Action<PlayerHealth>)delegate(PlayerHealth health)
		{
			//IL_002e: 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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: 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)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			if (InstanceFinder.IsServer && Object.op_Implicit((Object)(object)health) && !health.sync___get_value_isKilled())
			{
				Object.Instantiate<GameObject>(bloodDecal, ((Component)health).transform.position, Quaternion.Euler(0f, (float)Random.Range(0, 360), 0f));
				health.ChangeKilledState(true);
				health.RemoveHealth(10f);
				if ((Object)(object)((Component)((Component)health).transform).gameObject == (Object)(object)((Component)((Component)_driver).transform).gameObject)
				{
					Settings.Instance.IncreaseSuicidesAmount();
					health.suicide = true;
				}
				else
				{
					PauseManager.Instance.WriteLog("<b><color=#" + PauseManager.Instance.selfNameLogColor + ">" + health.sync___get_value_playerValues().playerClient.PlayerNameTag + "</color></b> was blown up using a <b><color=white>RC Car</color></b> by <b><color=#" + PauseManager.Instance.enemyNameLogColor + ">" + ClientInstance.Instance.PlayerNameTag + "</color></b>");
				}
				health.Explode(false, true, ((Object)((Component)health).gameObject).name, ((Component)health).transform.position - ((Component)this).transform.position, 60f, ((Component)this).transform.position);
				health.SetKiller(((Component)_driver).transform);
			}
		});
		Object.Instantiate<GameObject>(explosionVFX, ((Component)this).transform.position, Quaternion.identity);
		SoundManager.Instance.PlaySound(explosionSound);
		Despawn();
	}
}
public class RCCarItem : MonoBehaviour
{
	[NonSerialized]
	public RCCar car;
}
public class RCCarNetworking : MonoBehaviour
{
	private static readonly uint ID = 932828u;

	public void Awake()
	{
		MyceliumNetwork.RegisterNetworkObject((object)this, ID, 0);
	}

	public void Deregister()
	{
		MyceliumNetwork.DeregisterNetworkObject((object)this, ID, 0);
	}

	public static void RPC(string methodname, object[] parameters)
	{
		MyceliumNetwork.RPC(ID, methodname, (ReliableType)1, parameters);
	}

	public static void TargetedRPC(CSteamID steamID, string methodname, object[] parameters)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		MyceliumNetwork.RPCTarget(ID, methodname, steamID, (ReliableType)1, parameters);
	}

	[CustomRPC]
	public void LinkCarToCarItem(int carItemNob, int carNob)
	{
		NetworkObject value = null;
		NetworkObject value2 = null;
		Debug.LogError((object)"got rpc");
		if (!InstanceFinder.IsServer)
		{
			((ManagedObjects)InstanceFinder.ClientManager.Objects).Spawned.TryGetValue(carItemNob, out value);
			((ManagedObjects)InstanceFinder.ClientManager.Objects).Spawned.TryGetValue(carNob, out value2);
			Debug.LogError((object)$"client nobs: {value}, {value2}");
		}
		else
		{
			((ManagedObjects)InstanceFinder.ServerManager.Objects).Spawned.TryGetValue(carItemNob, out value);
			((ManagedObjects)InstanceFinder.ServerManager.Objects).Spawned.TryGetValue(carNob, out value2);
			Debug.LogError((object)$"server nobs: {value}, {value2}");
		}
		GameObject gameObject = ((Component)value).gameObject;
		RCCar component = ((Component)value2).gameObject.GetComponent<RCCar>();
		gameObject.GetComponent<RCCarItem>().car = component;
		component.rcCarItem = gameObject;
	}

	[CustomRPC]
	public void ExplodeObservers(int carNob)
	{
		NetworkObject value = null;
		if (!InstanceFinder.IsServer)
		{
			((ManagedObjects)InstanceFinder.ClientManager.Objects).Spawned.TryGetValue(carNob, out value);
		}
		else
		{
			((ManagedObjects)InstanceFinder.ServerManager.Objects).Spawned.TryGetValue(carNob, out value);
		}
		((Component)value).gameObject.GetComponent<RCCar>().Explode();
	}
}
[HarmonyPatch(typeof(WeaponHandSpawner), "Fire")]
public static class FirePatch
{
	public static bool Prefix(WeaponHandSpawner __instance)
	{
		//IL_009e: 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)
		if (!Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<RCCarItem>()))
		{
			return true;
		}
		if (!PauseManager.Instance.pause && !((Object)(object)((Weapon)__instance).behaviour.playerPickup.currentEnvironmentInteractable != (Object)null) && ((NetworkBehaviour)((Weapon)__instance).playerController).IsOwner && ((Weapon)__instance).playerController.sync___get_value_canMove() && !(__instance.fireTimer > 0f))
		{
			__instance.fireTimer = ((Weapon)__instance).timeBetweenFire;
			if (((Weapon)__instance).currentAmmo == 1 && __instance.canPlace)
			{
				__instance.SpawnObject(__instance.objToSpawn, __instance.position, __instance.rotation);
				((Weapon)__instance).CameraAnimation();
				((Weapon)__instance).WeaponAnimation();
				((Weapon)__instance).currentAmmo = 2;
				((Weapon)__instance).needsAmmo = false;
				__instance.maxInteractionDistance = 0f;
			}
			else if (((NetworkBehaviour)((Weapon)__instance).playerController).IsOwner)
			{
				RCCar car = ((Component)__instance).gameObject.GetComponent<RCCarItem>().car;
				if (!car.driving)
				{
					car.BeginDriving(((Weapon)__instance).playerController);
				}
			}
		}
		return false;
	}
}
public static class RCCarLink
{
	public static void Init()
	{
		CreatePlaceItemEvent.PlaceItemEvent += LinkRCCar;
	}

	public static void LinkRCCar(object sender, CreatePlaceItemEvent.PlaceItemEventArgs eventArgs)
	{
		WeaponHandSpawner spawner = eventArgs.spawner;
		GameObject spawnedObj = eventArgs.spawnedObj;
		RCCarItem rCCarItem = default(RCCarItem);
		if (!((Component)spawner).gameObject.TryGetComponent<RCCarItem>(ref rCCarItem))
		{
			eventArgs.runOriginalCode = true;
			return;
		}
		eventArgs.runOriginalCode = false;
		RCCarNetworking.RPC("LinkCarToCarItem", new object[2]
		{
			((Component)spawner).gameObject.GetComponent<NetworkObject>().ObjectId,
			spawnedObj.GetComponent<NetworkObject>().ObjectId
		});
	}
}
[HarmonyPatch(typeof(FirstPersonController), "HandleCameraController")]
public static class HandleNullCamera
{
	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
	{
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Expected O, but got Unknown
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Expected O, but got Unknown
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Expected O, but got Unknown
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Expected O, but got Unknown
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Expected O, but got Unknown
		FieldInfo fieldInfo = AccessTools.Field(typeof(FirstPersonController), "playerCamera");
		MethodInfo methodInfo = AccessTools.Method(typeof(Object), "op_Implicit", (Type[])null, (Type[])null);
		Label label = generator.DefineLabel();
		return new CodeMatcher(instructions, generator).Start().InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[5]
		{
			new CodeInstruction(OpCodes.Ldarg_0, (object)null),
			new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo),
			new CodeInstruction(OpCodes.Call, (object)methodInfo),
			new CodeInstruction(OpCodes.Brtrue, (object)label),
			new CodeInstruction(OpCodes.Ret, (object)null)
		}).AddLabels((IEnumerable<Label>)new <>z__ReadOnlySingleElementList<Label>(label))
			.InstructionEnumeration();
	}
}
public class TPLink : MonoBehaviour
{
	[NonSerialized]
	public int otherTrapNob = -1;
}
public class TPTrap : MonoBehaviour
{
	[NonSerialized]
	public Transform owner;

	private GameObject _otherTrap;

	private bool _detonated = false;

	public GameObject explosionVfx;

	public AudioClip explosionAudio;

	private void Awake()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		PauseManager.OnBeforeSpawn += new BeforeSpawnAction(Despawn);
		Animation component = ((Component)((Component)this).transform.Find("TeleTrapPhysMesh").Find("trap_010")).GetComponent<Animation>();
		component["tpmineSphere"].layer = 0;
		component.Play("tpmineSphere");
		component["tpmineTorus"].layer = 1;
		component.Play("tpmineTorus");
	}

	public void Prime(GameObject other)
	{
		_otherTrap = other;
		((Component)((Component)this).transform.Find("radius")).gameObject.SetActive(true);
	}

	private void OnTriggerStay(Collider col)
	{
		if (!Object.op_Implicit((Object)(object)_otherTrap) || _detonated || !((Component)col).CompareTag("Player") || !InstanceFinder.IsServer)
		{
			return;
		}
		_detonated = true;
		GameObject[] players = GetPlayers();
		TPTrap tPTrap = default(TPTrap);
		_otherTrap.TryGetComponent<TPTrap>(ref tPTrap);
		if (!tPTrap._detonated)
		{
			tPTrap._detonated = true;
			GameObject[] players2 = tPTrap.GetPlayers();
			IEnumerable<CSteamID> enumerable = from go in players
				where TeleportIfHost(go, _otherTrap.transform.position)
				select GOToCSteamID(go);
			IEnumerable<CSteamID> enumerable2 = from go in players2
				where TeleportIfHost(go, ((Component)this).transform.position)
				select GOToCSteamID(go);
			CollectionExtensions.Do<CSteamID>(enumerable, (Action<CSteamID>)delegate(CSteamID ID)
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				TPTrapNetworking.TargetedRPC(ID, "TPPlayer", new object[1] { _otherTrap.transform.position });
			});
			CollectionExtensions.Do<CSteamID>(enumerable2, (Action<CSteamID>)delegate(CSteamID ID)
			{
				//IL_0000: 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)
				TPTrapNetworking.TargetedRPC(ID, "TPPlayer", new object[1] { ((Component)this).transform.position });
			});
			int objectId = ((Component)this).gameObject.GetComponent<NetworkObject>().ObjectId;
			int objectId2 = _otherTrap.GetComponent<NetworkObject>().ObjectId;
			TPTrapNetworking.RPC("DestroyTrapPair", new object[2] { objectId, objectId2 });
		}
		else
		{
			Debug.LogError((object)"UHHHHHHHHHHHHHHHH OH");
		}
	}

	private CSteamID GOToCSteamID(GameObject go)
	{
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		return (CSteamID)ulong.Parse(go.GetComponent<NetworkObject>().Owner.GetAddress());
	}

	private bool TeleportIfHost(GameObject potentialHost, Vector3 pos)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: 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)
		CSteamID val = GOToCSteamID(potentialHost);
		if (val == SteamUser.GetSteamID())
		{
			potentialHost.GetComponent<PlayerHealth>().sync___set_value_killer(owner, true);
			potentialHost.GetComponent<FirstPersonController>().Teleport(pos, 0f, false, (Transform)null, 0f, 0f, true);
			return false;
		}
		return true;
	}

	private GameObject[] GetPlayers()
	{
		//IL_0023: 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)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = default(Vector3);
		((Vector3)(ref val))..ctor(3.2f, 1.631936f, 3.2f);
		int num = 67584;
		Collider[] source = Physics.OverlapBox(((Component)this).transform.position, val, Quaternion.identity, num);
		return (from col in source
			select ((Component)((Component)col).transform.root).gameObject into go
			where go.CompareTag("Player")
			select go).Distinct().ToArray();
	}

	public void Explode()
	{
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)_otherTrap))
		{
			((Component)_otherTrap.transform.Find("radius")).gameObject.SetActive(false);
		}
		Object.Destroy((Object)(object)((Component)this).gameObject);
		Object.Instantiate<GameObject>(explosionVfx, ((Component)this).transform.position, Quaternion.identity);
		SoundManager.Instance.PlaySound(explosionAudio);
	}

	private void Despawn()
	{
		if (InstanceFinder.IsServer && Object.op_Implicit((Object)(object)this) && Object.op_Implicit((Object)(object)((Component)this).gameObject))
		{
			InstanceFinder.ServerManager.Despawn(((Component)this).gameObject, (DespawnType?)null);
		}
	}
}
public class TPTrapNetworking : MonoBehaviour
{
	private static readonly uint ID = 932828u;

	public void Start()
	{
		MyceliumNetwork.RegisterNetworkObject((object)this, ID, 0);
	}

	public void Deregister()
	{
		MyceliumNetwork.DeregisterNetworkObject((object)this, ID, 0);
	}

	public static void RPC(string methodname, object[] parameters)
	{
		MyceliumNetwork.RPC(ID, methodname, (ReliableType)1, parameters);
	}

	public static void TargetedRPC(CSteamID steamID, string methodname, object[] parameters)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		MyceliumNetwork.RPCTarget(ID, methodname, steamID, (ReliableType)1, parameters);
	}

	[CustomRPC]
	public void LinkMines(int nobID1, int nobID2)
	{
		NetworkObject value3;
		NetworkObject value4;
		if (!InstanceFinder.IsServer && ((ManagedObjects)InstanceFinder.ClientManager.Objects).Spawned.TryGetValue(nobID1, out var value) && ((ManagedObjects)InstanceFinder.ClientManager.Objects).Spawned.TryGetValue(nobID2, out var value2))
		{
			GameObject gameObject = ((Component)value).gameObject;
			GameObject gameObject2 = ((Component)value2).gameObject;
			gameObject.GetComponent<TPTrap>().Prime(gameObject2);
			gameObject2.GetComponent<TPTrap>().Prime(gameObject);
		}
		else if (((ManagedObjects)InstanceFinder.ServerManager.Objects).Spawned.TryGetValue(nobID1, out value3) && ((ManagedObjects)InstanceFinder.ServerManager.Objects).Spawned.TryGetValue(nobID2, out value4))
		{
			GameObject gameObject3 = ((Component)value3).gameObject;
			GameObject gameObject4 = ((Component)value4).gameObject;
			gameObject3.GetComponent<TPTrap>().Prime(gameObject4);
			gameObject4.GetComponent<TPTrap>().Prime(gameObject3);
		}
	}

	[CustomRPC]
	public void DestroyTrapPair(int nobID1, int nobID2)
	{
		NetworkObject value;
		NetworkObject value2;
		if (!InstanceFinder.IsServer)
		{
			((ManagedObjects)InstanceFinder.ClientManager.Objects).Spawned.TryGetValue(nobID1, out value);
			((ManagedObjects)InstanceFinder.ClientManager.Objects).Spawned.TryGetValue(nobID2, out value2);
		}
		else
		{
			((ManagedObjects)InstanceFinder.ServerManager.Objects).Spawned.TryGetValue(nobID1, out value);
			((ManagedObjects)InstanceFinder.ServerManager.Objects).Spawned.TryGetValue(nobID2, out value2);
		}
		if (Object.op_Implicit((Object)(object)value))
		{
			((Component)value).gameObject.GetComponent<TPTrap>().Explode();
		}
		if (Object.op_Implicit((Object)(object)value2))
		{
			((Component)value2).gameObject.GetComponent<TPTrap>().Explode();
		}
	}

	[CustomRPC]
	public void TPPlayer(Vector3 position)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		FirstPersonController.instance.Teleport(position, 0f, false, (Transform)null, 0f, 0f, true);
	}
}
public static class UpdateTrapLinkOnPlace
{
	public static void Init()
	{
		CreatePlaceItemEvent.PlaceItemEvent += UpdateTrapLink;
	}

	public static void UpdateTrapLink(object sender, CreatePlaceItemEvent.PlaceItemEventArgs eventArgs)
	{
		WeaponHandSpawner spawner = eventArgs.spawner;
		GameObject spawnedObj = eventArgs.spawnedObj;
		TPLink tPLink = default(TPLink);
		if (!((Component)spawner).gameObject.TryGetComponent<TPLink>(ref tPLink))
		{
			eventArgs.runOriginalCode = true;
			return;
		}
		if (tPLink.otherTrapNob == -1)
		{
			tPLink.otherTrapNob = spawnedObj.GetComponent<NetworkObject>().ObjectId;
		}
		else
		{
			int objectId = spawnedObj.GetComponent<NetworkObject>().ObjectId;
			int otherTrapNob = tPLink.otherTrapNob;
			TPTrapNetworking.RPC("LinkMines", new object[2] { objectId, otherTrapNob });
		}
		spawnedObj.GetComponent<TPTrap>().owner = ((Component)spawner).transform.root;
	}
}
[HarmonyPatch(typeof(Weapon), "TriggerEnvironment")]
public static class ExplodeTPTrapOnHit
{
	public static void Prefix(GameObject obj)
	{
		GameObject gameObject = ((Component)obj.transform.root).gameObject;
		if (Object.op_Implicit((Object)(object)gameObject.GetComponent<TPTrap>()))
		{
			TPTrapNetworking.RPC("DestroyTrapPair", new object[2]
			{
				gameObject.GetComponent<NetworkObject>().ObjectId,
				-1
			});
		}
	}
}
namespace KokiWeapons
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "com.koki.kokiweapons";

		public const string PLUGIN_NAME = "Koki Weapons";

		public const string PLUGIN_VERSION = "2.1.1";
	}
}
[CompilerGenerated]
internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T>
{
	private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T>
	{
		object IEnumerator.Current => _item;

		T IEnumerator<T>.Current => _item;

		public Enumerator(T item)
		{
			_item = item;
		}

		bool IEnumerator.MoveNext()
		{
			return !_moveNextCalled && (_moveNextCalled = true);
		}

		void IEnumerator.Reset()
		{
			_moveNextCalled = false;
		}

		void IDisposable.Dispose()
		{
		}
	}

	int ICollection.Count => 1;

	bool ICollection.IsSynchronized => false;

	object ICollection.SyncRoot => this;

	object IList.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	bool IList.IsFixedSize => true;

	bool IList.IsReadOnly => true;

	int IReadOnlyCollection<T>.Count => 1;

	T IReadOnlyList<T>.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
	}

	int ICollection<T>.Count => 1;

	bool ICollection<T>.IsReadOnly => true;

	T IList<T>.this[int index]
	{
		get
		{
			if (index != 0)
			{
				throw new IndexOutOfRangeException();
			}
			return _item;
		}
		set
		{
			throw new NotSupportedException();
		}
	}

	public <>z__ReadOnlySingleElementList(T item)
	{
		_item = item;
	}

	IEnumerator IEnumerable.GetEnumerator()
	{
		return new Enumerator(_item);
	}

	void ICollection.CopyTo(Array array, int index)
	{
		array.SetValue(_item, index);
	}

	int IList.Add(object value)
	{
		throw new NotSupportedException();
	}

	void IList.Clear()
	{
		throw new NotSupportedException();
	}

	bool IList.Contains(object value)
	{
		return EqualityComparer<T>.Default.Equals(_item, (T)value);
	}

	int IList.IndexOf(object value)
	{
		return (!EqualityComparer<T>.Default.Equals(_item, (T)value)) ? (-1) : 0;
	}

	void IList.Insert(int index, object value)
	{
		throw new NotSupportedException();
	}

	void IList.Remove(object value)
	{
		throw new NotSupportedException();
	}

	void IList.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}

	IEnumerator<T> IEnumerable<T>.GetEnumerator()
	{
		return new Enumerator(_item);
	}

	void ICollection<T>.Add(T item)
	{
		throw new NotSupportedException();
	}

	void ICollection<T>.Clear()
	{
		throw new NotSupportedException();
	}

	bool ICollection<T>.Contains(T item)
	{
		return EqualityComparer<T>.Default.Equals(_item, item);
	}

	void ICollection<T>.CopyTo(T[] array, int arrayIndex)
	{
		array[arrayIndex] = _item;
	}

	bool ICollection<T>.Remove(T item)
	{
		throw new NotSupportedException();
	}

	int IList<T>.IndexOf(T item)
	{
		return (!EqualityComparer<T>.Default.Equals(_item, item)) ? (-1) : 0;
	}

	void IList<T>.Insert(int index, T item)
	{
		throw new NotSupportedException();
	}

	void IList<T>.RemoveAt(int index)
	{
		throw new NotSupportedException();
	}
}