Decompiled source of Beanie Lib v1.0.6

LethalGravityControl.dll

Decompiled a week ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLevelLoader;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("LethalGravityControl")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Project1")]
[assembly: AssemblyTitle("LethalGravityControl")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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;
		}
	}
}
public class BreakerBoxCustom : NetworkBehaviour
{
	[Header("Breaker Settings")]
	public int leversSwitchedOff = 2;

	public bool isPowerOn = false;

	[Header("References")]
	public Animator[] breakerSwitches;

	public AudioSource thisAudioSource;

	public AudioSource breakerBoxHum;

	public AudioClip switchPowerSFX;

	[Header("Events")]
	public UnityEvent onBreakerActivated;

	public UnityEvent onBreakerDeactivated;

	private void Start()
	{
		isPowerOn = false;
		SetSwitchesOff();
		if ((Object)(object)breakerBoxHum != (Object)null && breakerBoxHum.isPlaying)
		{
			breakerBoxHum.Stop();
		}
	}

	public void SetSwitchesOff()
	{
		int num = Mathf.Clamp(leversSwitchedOff, 0, breakerSwitches.Length);
		leversSwitchedOff = 0;
		Random random = new Random(StartOfRound.Instance.randomMapSeed);
		HashSet<int> hashSet = new HashSet<int>();
		while (hashSet.Count < num && hashSet.Count < breakerSwitches.Length)
		{
			int num2 = random.Next(0, breakerSwitches.Length);
			if (!hashSet.Contains(num2))
			{
				hashSet.Add(num2);
				AnimatedObjectTrigger component = ((Component)breakerSwitches[num2]).GetComponent<AnimatedObjectTrigger>();
				if (component.boolValue)
				{
					breakerSwitches[num2].SetBool("turnedLeft", false);
					component.boolValue = false;
					component.setInitialState = false;
					leversSwitchedOff++;
				}
			}
		}
	}

	public void SwitchBreaker(bool on)
	{
		if (on)
		{
			leversSwitchedOff--;
		}
		else
		{
			leversSwitchedOff++;
		}
		if (((NetworkBehaviour)this).IsServer)
		{
			if (leversSwitchedOff <= 0 && !isPowerOn)
			{
				isPowerOn = true;
				UnityEvent obj = onBreakerActivated;
				if (obj != null)
				{
					obj.Invoke();
				}
				if ((Object)(object)thisAudioSource != (Object)null && (Object)(object)switchPowerSFX != (Object)null)
				{
					thisAudioSource.PlayOneShot(switchPowerSFX);
				}
			}
			else if (leversSwitchedOff > 0 && isPowerOn)
			{
				isPowerOn = false;
				UnityEvent obj2 = onBreakerDeactivated;
				if (obj2 != null)
				{
					obj2.Invoke();
				}
				if ((Object)(object)thisAudioSource != (Object)null && (Object)(object)switchPowerSFX != (Object)null)
				{
					thisAudioSource.PlayOneShot(switchPowerSFX);
				}
			}
		}
		if (leversSwitchedOff <= 0)
		{
			if (!breakerBoxHum.isPlaying)
			{
				breakerBoxHum.Play();
			}
		}
		else if (leversSwitchedOff == 1)
		{
			breakerBoxHum.Stop();
		}
	}
}
public class CustomShotgun : GrabbableObject
{
	[Serializable]
	public class PlayerDamageAndRangeSettings
	{
		public float PlayerSuperCloseRange = 5f;

		public float PlayerCloseRange = 15f;

		public float PlayerMediumRange = 23f;

		public float PlayerFarRange = 30f;

		public int PlayerSuperCloseDamage = 100;

		public int PlayerCloseDamage = 100;

		public int PlayerMediumDamage = 40;

		public int PlayerFarDamage = 20;

		[Tooltip("The Force at which the player ragdoll is thrown when dying of the shotgun blast")]
		public float RagdollForce = 30f;
	}

	[Serializable]
	public class EnemyDamageAndRangeSettings
	{
		[Tooltip("The Maximum Range of the shotgun blast for enemies. Must always be HIGHER than EnemyCloseRange and EnemyFarRange.")]
		public float EnemiesMaximumRange = 15f;

		public int EnemyFullDamage = 5;

		public int EnemyMediumDamage = 3;

		public int EnemyLowDamage = 2;

		[Tooltip("Enemies within THIS range from the shotgun will take (what you set as EnemyFullDamage). Past wherever this range ENDS is when the (EnemyMediumDamage) area begins. For example, if its set as 4, anything within 4 units of the shotgun takes full damage and past that it is considered medium.")]
		public float EnemyCloseRange = 3.7f;

		[Tooltip("Enemies between THIS range and the edge of the CLOSE range will take (EnemyMediumDamage) and anything PAST this range will take (EnemyLowDamage) So this basically sets the endpoint for medium damage and the start point for low damage. For example if the close range is 4 and t range is 8, anything within 4 units of the shotgun takes full damage, Anything within 4-8 units takes medium damage, and anything past 8 takes low damage.")]
		public float EnemyFarRange = 6f;
	}

	[CompilerGenerated]
	private sealed class <delayedEarsRinging>d__51 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public float effectSeverity;

		public CustomShotgun <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <delayedEarsRinging>d__51(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>2__current = (object)new WaitForSeconds(0.6f);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				SoundManager.Instance.earsRingingTimer = effectSeverity;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <reloadGunAnimation>d__58 : IEnumerator<object>, IEnumerator, IDisposable
	{
		private int <>1__state;

		private object <>2__current;

		public CustomShotgun <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <reloadGunAnimation>d__58(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Expected O, but got Unknown
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Expected O, but got Unknown
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0310: Expected O, but got Unknown
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<>4__this.isReloading = true;
				if (<>4__this.shellsLoaded <= 0 || <>4__this.UseLeftReloadAnimOnly)
				{
					((GrabbableObject)<>4__this).playerHeldBy.playerBodyAnimator.SetBool("ReloadShotgun", true);
					((Renderer)<>4__this.shotgunShellLeft).enabled = false;
					((Renderer)<>4__this.shotgunShellRight).enabled = false;
				}
				else
				{
					((GrabbableObject)<>4__this).playerHeldBy.playerBodyAnimator.SetBool("ReloadShotgun2", true);
					((Renderer)<>4__this.shotgunShellRight).enabled = false;
				}
				<>2__current = (object)new WaitForSeconds(0.3f * <>4__this.ReloadSpeed);
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>4__this.gunAudio.PlayOneShot(<>4__this.gunReloadSFX);
				<>4__this.gunAnimator.SetBool("Reloading", true);
				<>4__this.ReloadGunEffectsServerRpc();
				<>2__current = (object)new WaitForSeconds(0.95f * <>4__this.ReloadSpeed);
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				((Renderer)<>4__this.shotgunShellInHand).enabled = true;
				<>4__this.shotgunShellInHandTransform.SetParent(((GrabbableObject)<>4__this).playerHeldBy.leftHandItemTarget);
				<>4__this.shotgunShellInHandTransform.localPosition = new Vector3(-0.0555f, 0.1469f, -0.0655f);
				<>4__this.shotgunShellInHandTransform.localEulerAngles = new Vector3(-1.956f, 143.856f, -16.427f);
				<>2__current = (object)new WaitForSeconds(0.95f * <>4__this.ReloadSpeed);
				<>1__state = 3;
				return true;
			case 3:
				<>1__state = -1;
				((GrabbableObject)<>4__this).playerHeldBy.DestroyItemInSlotAndSync(<>4__this.ammoSlotToUse);
				<>4__this.ammoSlotToUse = -1;
				<>4__this.shellsLoaded = Mathf.Clamp(<>4__this.shellsLoaded + 1, 0, <>4__this.maxShells);
				((Renderer)<>4__this.shotgunShellLeft).enabled = true;
				if (<>4__this.shellsLoaded >= 2)
				{
					((Renderer)<>4__this.shotgunShellRight).enabled = true;
				}
				else
				{
					((Renderer)<>4__this.shotgunShellRight).enabled = false;
				}
				((Renderer)<>4__this.shotgunShellInHand).enabled = false;
				<>4__this.shotgunShellInHandTransform.SetParent(((Component)<>4__this).transform);
				<>2__current = (object)new WaitForSeconds(0.45f * <>4__this.ReloadSpeed);
				<>1__state = 4;
				return true;
			case 4:
				<>1__state = -1;
				<>4__this.gunAudio.PlayOneShot(<>4__this.gunReloadFinishSFX);
				<>4__this.gunAnimator.SetBool("Reloading", false);
				((GrabbableObject)<>4__this).playerHeldBy.playerBodyAnimator.SetBool("ReloadShotgun", false);
				((GrabbableObject)<>4__this).playerHeldBy.playerBodyAnimator.SetBool("ReloadShotgun2", false);
				<>4__this.isReloading = false;
				<>4__this.ReloadGunEffectsServerRpc(start: false);
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	public UnityEvent ShotFired = new UnityEvent();

	public int gunCompatibleAmmoID = 211;

	public bool isReloading;

	public int shellsLoaded;

	public Animator gunAnimator;

	public AudioSource gunAudio;

	public AudioSource gunShootAudio;

	public AudioSource gunBulletsRicochetAudio;

	private Coroutine gunCoroutine;

	public AudioClip[] gunShootSFX;

	public AudioClip gunReloadSFX;

	public AudioClip gunReloadFinishSFX;

	public AudioClip noAmmoSFX;

	public AudioClip gunSafetySFX;

	public AudioClip switchSafetyOnSFX;

	public AudioClip switchSafetyOffSFX;

	public bool safetyOn;

	private float misfireTimer = 30f;

	private bool hasHitGroundWithSafetyOff = true;

	private int ammoSlotToUse = -1;

	private bool localClientSendingShootGunRPC;

	private PlayerControllerB previousPlayerHeldBy;

	public ParticleSystem gunShootParticle;

	public Transform shotgunRayPoint;

	public MeshRenderer shotgunShellLeft;

	public MeshRenderer shotgunShellRight;

	public MeshRenderer shotgunShellInHand;

	public Transform shotgunShellInHandTransform;

	private RaycastHit[] enemyColliders;

	private EnemyAI heldByEnemy;

	[Tooltip("If true, vanilla shotgun blast will occur alongside running the unity event")]
	public bool usegunblast = true;

	[Tooltip("If true, the left barrel reload animation will always play regardless of ammo count")]
	public bool UseLeftReloadAnimOnly = false;

	[Tooltip("Set Max Ammo that can be loaded")]
	public int maxShells = 2;

	[Tooltip("The Width of the blasts area of damage, this is NOT range. Only Width.")]
	public float ShotgunRadius = 5f;

	[Tooltip("What to multiply the time it takes to reload by. Higher number = takes longer. For example 2 means twice as long and 0.5 means half as long")]
	public float ReloadSpeed = 1f;

	public PlayerDamageAndRangeSettings playerStuff;

	public EnemyDamageAndRangeSettings enemyStuff;

	public override void Start()
	{
		((GrabbableObject)this).Start();
		misfireTimer = 30f;
		hasHitGroundWithSafetyOff = true;
	}

	public override int GetItemDataToSave()
	{
		((GrabbableObject)this).GetItemDataToSave();
		return shellsLoaded;
	}

	public override void LoadItemSaveData(int saveData)
	{
		((GrabbableObject)this).LoadItemSaveData(saveData);
		safetyOn = true;
		shellsLoaded = saveData;
	}

	public override void Update()
	{
		((GrabbableObject)this).Update();
		if (!((NetworkBehaviour)this).IsOwner || shellsLoaded <= 0 || isReloading || (Object)(object)heldByEnemy != (Object)null || base.isPocketed)
		{
			return;
		}
		if (base.hasHitGround && !safetyOn && !hasHitGroundWithSafetyOff && !base.isHeld)
		{
			if (Random.Range(0, 100) < 5)
			{
				ShootGunAndSync(heldByPlayer: false);
			}
			hasHitGroundWithSafetyOff = true;
		}
		else if (!safetyOn && misfireTimer <= 0f && !StartOfRound.Instance.inShipPhase)
		{
			if (Random.Range(0, 100) < 4)
			{
				ShootGunAndSync(base.isHeld);
			}
			if (Random.Range(0, 100) < 5)
			{
				misfireTimer = 2f;
			}
			else
			{
				misfireTimer = Random.Range(28f, 50f);
			}
		}
		else if (!safetyOn)
		{
			misfireTimer -= Time.deltaTime;
		}
	}

	public override void EquipItem()
	{
		((GrabbableObject)this).EquipItem();
		previousPlayerHeldBy = base.playerHeldBy;
		previousPlayerHeldBy.equippedUsableItemQE = true;
		hasHitGroundWithSafetyOff = false;
	}

	public override void GrabItemFromEnemy(EnemyAI enemy)
	{
		((GrabbableObject)this).GrabItemFromEnemy(enemy);
		heldByEnemy = enemy;
		hasHitGroundWithSafetyOff = false;
	}

	public override void DiscardItemFromEnemy()
	{
		((GrabbableObject)this).DiscardItemFromEnemy();
		heldByEnemy = null;
	}

	public override void ItemActivate(bool used, bool buttonDown = true)
	{
		((GrabbableObject)this).ItemActivate(used, buttonDown);
		if (!isReloading)
		{
			if (shellsLoaded == 0)
			{
				StartReloadGun();
			}
			else if (safetyOn)
			{
				gunAudio.PlayOneShot(gunSafetySFX);
			}
			else if (((NetworkBehaviour)this).IsOwner)
			{
				ShootGunAndSync(heldByPlayer: true);
			}
		}
	}

	public void ShootGunAndSync(bool heldByPlayer)
	{
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: 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_007c: 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_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: 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_008f: 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_00aa: 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)
		Vector3 shotgunPosition;
		Vector3 forward;
		if (!heldByPlayer)
		{
			shotgunPosition = shotgunRayPoint.position;
			forward = shotgunRayPoint.forward;
		}
		else
		{
			shotgunPosition = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.position - ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.up * 0.45f;
			forward = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.forward;
		}
		Debug.Log((object)"Calling shoot gun....");
		ShootGun(shotgunPosition, forward);
		Debug.Log((object)"Calling shoot gun and sync");
		localClientSendingShootGunRPC = true;
		ShootGunServerRpc(shotgunPosition, forward);
	}

	[ServerRpc(RequireOwnership = false)]
	public void ShootGunServerRpc(Vector3 shotgunPosition, Vector3 shotgunForward)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		ShootGunClientRpc(shotgunPosition, shotgunForward);
	}

	[ClientRpc]
	public void ShootGunClientRpc(Vector3 shotgunPosition, Vector3 shotgunForward)
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		Debug.Log((object)"Shoot gun client rpc received");
		if (localClientSendingShootGunRPC)
		{
			localClientSendingShootGunRPC = false;
			Debug.Log((object)"localClientSendingShootGunRPC was true");
		}
		else
		{
			ShootGun(shotgunPosition, shotgunForward);
		}
	}

	public void ShootGun(Vector3 shotgunPosition, Vector3 shotgunForward)
	{
		//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_0119: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_011f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Unknown result type (might be due to invalid IL or missing references)
		//IL_013a: 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_013d: 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_0259: Unknown result type (might be due to invalid IL or missing references)
		//IL_025f: Unknown result type (might be due to invalid IL or missing references)
		//IL_029f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_02de: Unknown result type (might be due to invalid IL or missing references)
		//IL_031f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0320: Unknown result type (might be due to invalid IL or missing references)
		//IL_0326: Unknown result type (might be due to invalid IL or missing references)
		//IL_032b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0330: Unknown result type (might be due to invalid IL or missing references)
		//IL_0336: Unknown result type (might be due to invalid IL or missing references)
		//IL_0410: Unknown result type (might be due to invalid IL or missing references)
		//IL_041e: Unknown result type (might be due to invalid IL or missing references)
		//IL_045d: Unknown result type (might be due to invalid IL or missing references)
		//IL_046b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0502: Unknown result type (might be due to invalid IL or missing references)
		isReloading = false;
		bool flag = false;
		if (base.isHeld && (Object)(object)base.playerHeldBy != (Object)null && (Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)
		{
			base.playerHeldBy.playerBodyAnimator.SetTrigger("ShootShotgun");
			flag = true;
		}
		RoundManager.PlayRandomClip(gunShootAudio, gunShootSFX, true, 1f, 1840, 1000);
		WalkieTalkie.TransmitOneShotAudio(gunShootAudio, gunShootSFX[0], 1f);
		gunShootParticle.Play(true);
		shellsLoaded = Mathf.Clamp(shellsLoaded - 1, 0, maxShells);
		PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
		if ((Object)(object)localPlayerController == (Object)null)
		{
			return;
		}
		if (usegunblast)
		{
			float num = Vector3.Distance(((Component)localPlayerController).transform.position, ((Component)shotgunRayPoint).transform.position);
			bool flag2 = false;
			int num2 = 0;
			float num3 = 0f;
			Vector3 val = localPlayerController.playerCollider.ClosestPoint(shotgunPosition);
			if (!flag && !Physics.Linecast(shotgunPosition, val, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) && Vector3.Angle(shotgunForward, val - shotgunPosition) < 30f)
			{
				flag2 = true;
			}
			if (num < playerStuff.PlayerSuperCloseRange)
			{
				num3 = 0.8f;
				HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
				num2 = playerStuff.PlayerSuperCloseDamage;
			}
			if (num < playerStuff.PlayerCloseRange)
			{
				num3 = 0.5f;
				HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
				num2 = playerStuff.PlayerCloseDamage;
			}
			else if (num < playerStuff.PlayerMediumRange)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
				num2 = playerStuff.PlayerMediumDamage;
			}
			else if (num < playerStuff.PlayerFarRange)
			{
				num2 = playerStuff.PlayerFarDamage;
			}
			if (num3 > 0f && SoundManager.Instance.timeSinceEarsStartedRinging > 16f)
			{
				((MonoBehaviour)this).StartCoroutine(delayedEarsRinging(num3));
			}
			Ray val2 = default(Ray);
			((Ray)(ref val2))..ctor(shotgunPosition, shotgunForward);
			RaycastHit val3 = default(RaycastHit);
			if (Physics.Raycast(val2, ref val3, playerStuff.PlayerFarRange, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
			{
				((Component)gunBulletsRicochetAudio).transform.position = ((Ray)(ref val2)).GetPoint(((RaycastHit)(ref val3)).distance - 0.5f);
				gunBulletsRicochetAudio.Play();
			}
			if (flag2)
			{
				localPlayerController.DamagePlayer(num2, true, true, (CauseOfDeath)7, 0, false, shotgunRayPoint.forward * playerStuff.RagdollForce);
			}
			if (!((NetworkBehaviour)this).IsOwner)
			{
				return;
			}
			if (enemyColliders == null)
			{
				enemyColliders = (RaycastHit[])(object)new RaycastHit[10];
			}
			((Ray)(ref val2))..ctor(shotgunPosition - shotgunForward * 10f, shotgunForward);
			int num4 = Physics.SphereCastNonAlloc(val2, ShotgunRadius, enemyColliders, enemyStuff.EnemiesMaximumRange, 524288, (QueryTriggerInteraction)2);
			List<EnemyAI> list = new List<EnemyAI>();
			IHittable val4 = default(IHittable);
			for (int i = 0; i < num4; i++)
			{
				if (!Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref enemyColliders[i])).transform).GetComponent<EnemyAICollisionDetect>()))
				{
					continue;
				}
				EnemyAI mainScript = ((Component)((RaycastHit)(ref enemyColliders[i])).transform).GetComponent<EnemyAICollisionDetect>().mainScript;
				if ((Object)(object)heldByEnemy != (Object)null && (Object)(object)heldByEnemy == (Object)(object)mainScript)
				{
					continue;
				}
				if (((RaycastHit)(ref enemyColliders[i])).distance == 0f)
				{
					Debug.Log((object)"Spherecast started inside enemy collider");
				}
				else if (!Physics.Linecast(shotgunPosition, ((RaycastHit)(ref enemyColliders[i])).point, ref val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1) && ((Component)((RaycastHit)(ref enemyColliders[i])).transform).TryGetComponent<IHittable>(ref val4))
				{
					float num5 = Vector3.Distance(shotgunPosition, ((RaycastHit)(ref enemyColliders[i])).point);
					int num6 = ((num5 < enemyStuff.EnemyCloseRange) ? enemyStuff.EnemyFullDamage : ((!(num5 < enemyStuff.EnemyFarRange)) ? enemyStuff.EnemyLowDamage : enemyStuff.EnemyMediumDamage));
					EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref enemyColliders[i])).collider).GetComponent<EnemyAICollisionDetect>();
					if ((!((Object)(object)component != (Object)null) || (!((Object)(object)component.mainScript == (Object)null) && !list.Contains(component.mainScript))) && val4.Hit(num6, shotgunForward, base.playerHeldBy, true, -1) && (Object)(object)component != (Object)null)
					{
						list.Add(component.mainScript);
					}
				}
			}
		}
		ShotFired.Invoke();
	}

	[IteratorStateMachine(typeof(<delayedEarsRinging>d__51))]
	private IEnumerator delayedEarsRinging(float effectSeverity)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <delayedEarsRinging>d__51(0)
		{
			<>4__this = this,
			effectSeverity = effectSeverity
		};
	}

	public override void ItemInteractLeftRight(bool right)
	{
		((GrabbableObject)this).ItemInteractLeftRight(right);
		if ((Object)(object)base.playerHeldBy == (Object)null)
		{
			return;
		}
		Debug.Log((object)$"r/l activate: {right}");
		if (!right)
		{
			if (safetyOn)
			{
				safetyOn = false;
				gunAudio.PlayOneShot(switchSafetyOffSFX);
				WalkieTalkie.TransmitOneShotAudio(gunAudio, switchSafetyOffSFX, 1f);
				SetSafetyControlTip();
			}
			else
			{
				safetyOn = true;
				gunAudio.PlayOneShot(switchSafetyOnSFX);
				WalkieTalkie.TransmitOneShotAudio(gunAudio, switchSafetyOnSFX, 1f);
				SetSafetyControlTip();
			}
			base.playerHeldBy.playerBodyAnimator.SetTrigger("SwitchGunSafety");
		}
		else if (!isReloading && shellsLoaded < maxShells)
		{
			StartReloadGun();
		}
	}

	public override void SetControlTipsForItem()
	{
		string[] toolTips = base.itemProperties.toolTips;
		if (toolTips.Length <= 2)
		{
			Debug.LogError((object)"Shotgun control tips array length is too short to set tips!");
			return;
		}
		if (safetyOn)
		{
			toolTips[2] = "Turn safety off: [Q]";
		}
		else
		{
			toolTips[2] = "Turn safety on: [Q]";
		}
		HUDManager.Instance.ChangeControlTipMultiple(toolTips, true, base.itemProperties);
	}

	private void SetSafetyControlTip()
	{
		string text = ((!safetyOn) ? "Turn safety on: [Q]" : "Turn safety off: [Q]");
		if (((NetworkBehaviour)this).IsOwner)
		{
			HUDManager.Instance.ChangeControlTip(3, text, false);
		}
	}

	private void StartReloadGun()
	{
		if (ReloadedGun())
		{
			if (((NetworkBehaviour)this).IsOwner)
			{
				if (gunCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(gunCoroutine);
				}
				gunCoroutine = ((MonoBehaviour)this).StartCoroutine(reloadGunAnimation());
			}
		}
		else
		{
			gunAudio.PlayOneShot(noAmmoSFX);
		}
	}

	[ServerRpc]
	public void ReloadGunEffectsServerRpc(bool start = true)
	{
		ReloadGunEffectsClientRpc(start);
	}

	[ClientRpc]
	public void ReloadGunEffectsClientRpc(bool start = true)
	{
		if (!((NetworkBehaviour)this).IsOwner)
		{
			if (start)
			{
				gunAudio.PlayOneShot(gunReloadSFX);
				WalkieTalkie.TransmitOneShotAudio(gunAudio, gunReloadSFX, 1f);
				gunAnimator.SetBool("Reloading", true);
				isReloading = true;
			}
			else
			{
				shellsLoaded = Mathf.Clamp(shellsLoaded + 1, 0, maxShells);
				gunAudio.PlayOneShot(gunReloadFinishSFX);
				gunAnimator.SetBool("Reloading", false);
				isReloading = false;
			}
		}
	}

	[IteratorStateMachine(typeof(<reloadGunAnimation>d__58))]
	private IEnumerator reloadGunAnimation()
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <reloadGunAnimation>d__58(0)
		{
			<>4__this = this
		};
	}

	private bool ReloadedGun()
	{
		int num = FindAmmoInInventory();
		if (num == -1)
		{
			Debug.Log((object)"not reloading");
			return false;
		}
		Debug.Log((object)"reloading!");
		ammoSlotToUse = num;
		return true;
	}

	private int FindAmmoInInventory()
	{
		for (int i = 0; i < base.playerHeldBy.ItemSlots.Length; i++)
		{
			if (!((Object)(object)base.playerHeldBy.ItemSlots[i] == (Object)null))
			{
				GrabbableObject obj = base.playerHeldBy.ItemSlots[i];
				GunAmmo val = (GunAmmo)(object)((obj is GunAmmo) ? obj : null);
				Debug.Log((object)$"Ammo null in slot #{i}?: {(Object)(object)val == (Object)null}");
				if ((Object)(object)val != (Object)null)
				{
					Debug.Log((object)$"Ammo in slot #{i} id: {val.ammoType}");
				}
				if ((Object)(object)val != (Object)null && val.ammoType == gunCompatibleAmmoID)
				{
					return i;
				}
			}
		}
		return -1;
	}

	public override void PocketItem()
	{
		((GrabbableObject)this).PocketItem();
		StopUsingGun();
	}

	public override void DiscardItem()
	{
		((GrabbableObject)this).DiscardItem();
		StopUsingGun();
	}

	private void StopUsingGun()
	{
		previousPlayerHeldBy.equippedUsableItemQE = false;
		if (isReloading)
		{
			if (gunCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(gunCoroutine);
			}
			gunAnimator.SetBool("Reloading", false);
			gunAudio.Stop();
			if ((Object)(object)previousPlayerHeldBy != (Object)null)
			{
				previousPlayerHeldBy.playerBodyAnimator.SetBool("ReloadShotgun", false);
				previousPlayerHeldBy.playerBodyAnimator.SetBool("ReloadShotgun2", false);
			}
			((Renderer)shotgunShellInHand).enabled = false;
			shotgunShellInHandTransform.SetParent(((Component)this).transform);
			isReloading = false;
		}
	}
}
[Serializable]
public class ThresholdEvent
{
	public int threshold = 1;

	public UnityEvent OnThresholdReached = new UnityEvent();

	[HideInInspector]
	public bool triggered = false;
}
public class TriggerCounter : MonoBehaviour
{
	public ThresholdEvent[] thresholds;

	public UnityEvent OnResetCounter = new UnityEvent();

	public UnityEvent OnTurnOffCounter = new UnityEvent();

	private int currentCount = 0;

	private bool isActive = true;

	public void IncreaseCount()
	{
		IncreaseCount(1);
	}

	public void IncreaseCount(int amount)
	{
		if (!isActive)
		{
			return;
		}
		currentCount += amount;
		ThresholdEvent[] array = thresholds;
		foreach (ThresholdEvent thresholdEvent in array)
		{
			if (!thresholdEvent.triggered && currentCount >= thresholdEvent.threshold)
			{
				thresholdEvent.triggered = true;
				thresholdEvent.OnThresholdReached.Invoke();
			}
		}
	}

	public void ResetCounter()
	{
		currentCount = 0;
		ThresholdEvent[] array = thresholds;
		foreach (ThresholdEvent thresholdEvent in array)
		{
			thresholdEvent.triggered = false;
		}
		isActive = true;
	}

	public void TurnOffCounter()
	{
		isActive = false;
	}

	private void Awake()
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Expected O, but got Unknown
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		OnResetCounter.AddListener(new UnityAction(ResetCounter));
		OnTurnOffCounter.AddListener(new UnityAction(TurnOffCounter));
	}
}
public class PhysicsCollisionDetector : MonoBehaviour
{
	private Rigidbody itemrb;

	public UnityEvent Collided = new UnityEvent();

	public float colThreshold = 1f;

	private void Start()
	{
		itemrb = ((Component)this).GetComponent<Rigidbody>();
	}

	private void Update()
	{
	}

	private void OnCollisionEnter(Collision col)
	{
		//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)
		if (col.gameObject.layer == LayerMask.NameToLayer("Room"))
		{
			Vector3 velocity = itemrb.velocity;
			if (((Vector3)(ref velocity)).magnitude > colThreshold)
			{
				Collided.Invoke();
			}
		}
	}
}
public class RigidbodyLauncher : MonoBehaviour
{
	public Vector3 LaunchForce;

	private void Start()
	{
	}

	private void Update()
	{
	}

	public void LaunchObject(GameObject LaunchPrefab)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = Object.Instantiate<GameObject>(LaunchPrefab);
		val.transform.position = ((Component)this).transform.position;
		val.transform.rotation = ((Component)this).transform.rotation;
		Rigidbody component = val.GetComponent<Rigidbody>();
		component.AddForce(LaunchForce);
	}
}
[Serializable]
public class CountingThresholdEvent
{
	public int threshold = 1;

	public UnityEvent OnThresholdReached = new UnityEvent();

	[HideInInspector]
	public bool triggered = false;
}
public class CountingText : MonoBehaviour
{
	public ThresholdEvent[] thresholds;

	public UnityEvent OnResetCounter = new UnityEvent();

	public UnityEvent OnTurnOffCounter = new UnityEvent();

	private int currentCount = 0;

	private bool isActive = true;

	public TMP_Text scorevisual;

	public void IncreaseCount()
	{
		IncreaseCount(1);
		scorevisual.text = currentCount.ToString();
	}

	public void IncreaseCount(int amount)
	{
		if (!isActive)
		{
			return;
		}
		currentCount += amount;
		scorevisual.text = currentCount.ToString();
		ThresholdEvent[] array = thresholds;
		foreach (ThresholdEvent thresholdEvent in array)
		{
			if (!thresholdEvent.triggered && currentCount >= thresholdEvent.threshold)
			{
				thresholdEvent.triggered = true;
				thresholdEvent.OnThresholdReached.Invoke();
			}
		}
	}

	public void ResetCounter()
	{
		currentCount = 0;
		ThresholdEvent[] array = thresholds;
		foreach (ThresholdEvent thresholdEvent in array)
		{
			thresholdEvent.triggered = false;
		}
		isActive = true;
	}

	public void TurnOffCounter()
	{
		isActive = false;
	}

	private void Awake()
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Expected O, but got Unknown
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Expected O, but got Unknown
		OnResetCounter.AddListener(new UnityAction(ResetCounter));
		OnTurnOffCounter.AddListener(new UnityAction(TurnOffCounter));
	}
}
namespace MyProject.Signals
{
	public static class SignalHub
	{
		private static Dictionary<string, List<SignalReceiverHub>> receiversByWordID = new Dictionary<string, List<SignalReceiverHub>>();

		public static void Register(string wordID, SignalReceiverHub receiver)
		{
			if (!((Object)(object)receiver == (Object)null))
			{
				if (!receiversByWordID.TryGetValue(wordID, out List<SignalReceiverHub> value))
				{
					value = new List<SignalReceiverHub>();
					receiversByWordID[wordID] = value;
				}
				if (!value.Contains(receiver))
				{
					value.Add(receiver);
				}
			}
		}

		public static void Unregister(string wordID, SignalReceiverHub receiver)
		{
			if (!((Object)(object)receiver == (Object)null) && receiversByWordID.TryGetValue(wordID, out List<SignalReceiverHub> value))
			{
				value.Remove(receiver);
				if (value.Count == 0)
				{
					receiversByWordID.Remove(wordID);
				}
			}
		}

		public static void Send(string wordID)
		{
			if (!receiversByWordID.TryGetValue(wordID, out List<SignalReceiverHub> value))
			{
				return;
			}
			List<SignalReceiverHub> list = new List<SignalReceiverHub>(value);
			foreach (SignalReceiverHub item in list)
			{
				if ((Object)(object)item != (Object)null)
				{
					item.ReceiveSignal();
				}
				else
				{
					value.Remove(item);
				}
			}
			if (value.Count == 0)
			{
				receiversByWordID.Remove(wordID);
			}
		}
	}
	public class SignalSenderHub : MonoBehaviour
	{
		public string wordID;

		public UnityEvent onSend;

		public void SendSignal()
		{
			SignalHub.Send(wordID);
			UnityEvent obj = onSend;
			if (obj != null)
			{
				obj.Invoke();
			}
		}
	}
	public class SignalReceiverHub : MonoBehaviour
	{
		public string wordID;

		public UnityEvent onReceive;

		private void OnEnable()
		{
			SignalHub.Register(wordID, this);
		}

		private void OnDisable()
		{
			SignalHub.Unregister(wordID, this);
		}

		public void ReceiveSignal()
		{
			UnityEvent obj = onReceive;
			if (obj != null)
			{
				obj.Invoke();
			}
		}
	}
}
namespace Project1
{
	[BepInPlugin("LethalGravityControl", "Project1", "1.0.0")]
	public class Project1 : BaseUnityPlugin
	{
		public static Project1 Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		internal static Harmony? Harmony { get; set; }

		private void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			Patch();
			Logger.LogInfo((object)"LethalGravityControl v1.0.0 has loaded!");
		}

		internal static void Patch()
		{
			//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)
			//IL_0018: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony = new Harmony("LethalGravityControl");
			}
			Logger.LogDebug((object)"Patching...");
			Harmony.PatchAll();
			Logger.LogDebug((object)"Finished patching!");
		}

		internal static void Unpatch()
		{
			Logger.LogDebug((object)"Unpatching...");
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			Logger.LogDebug((object)"Finished unpatching!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LethalGravityControl";

		public const string PLUGIN_NAME = "Project1";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace Project1.Patches
{
	public enum ActiveCondition
	{
		None,
		ActiveOutdoors,
		ActiveIndoors,
		ActiveOutdoorsOutsideShip
	}
	public class JClientParentToView : MonoBehaviour
	{
		public GameObject target;

		public ActiveCondition enableCondition = ActiveCondition.ActiveOutdoors;

		[Header("Player Attatchment")]
		[Tooltip("When disabled the player will not attach to the target and isntead just enable / disable it's self based on the Enable Condition.")]
		public bool attachToLocalPlayer = false;

		public bool lerpPosition = false;

		private bool attached;

		public void Update()
		{
			if (!((Object)(object)target == (Object)null))
			{
				switch (enableCondition)
				{
				case ActiveCondition.ActiveOutdoors:
					target.SetActive(!RoundManager.Instance.playersManager.localPlayerController.isInsideFactory);
					break;
				case ActiveCondition.ActiveIndoors:
					target.SetActive(RoundManager.Instance.playersManager.localPlayerController.isInsideFactory);
					break;
				case ActiveCondition.ActiveOutdoorsOutsideShip:
					target.SetActive(!RoundManager.Instance.playersManager.localPlayerController.isInsideFactory && !RoundManager.Instance.playersManager.localPlayerController.isInHangarShipRoom);
					break;
				}
				if (target.activeSelf && attachToLocalPlayer && !attached)
				{
					Transform transform = ((Component)RoundManager.Instance.playersManager.localPlayerController.headCostumeContainerLocal).transform;
					target.transform.SetParent(transform, false);
					attached = true;
				}
			}
		}
	}
	public class XTextureReplaceBasedOnTags : MonoBehaviour
	{
		public MaterialsWithNames[] materialsWithNames = Array.Empty<MaterialsWithNames>();

		public Renderer renderer => ((Component)this).GetComponent<Renderer>();

		public void Start()
		{
			foreach (ContentTag contentTag in ((ExtendedContent)LevelManager.CurrentExtendedLevel).ContentTags)
			{
				ReplaceTextureBasedOnTagName(contentTag.contentTagName);
			}
		}

		public void ReplaceTextureBasedOnTagName(string contentTagName)
		{
			MaterialsWithNames[] array = this.materialsWithNames;
			foreach (MaterialsWithNames materialsWithNames in array)
			{
				if (materialsWithNames.contentTagNames.Contains(contentTagName))
				{
					renderer.SetMaterials(materialsWithNames.materials);
					break;
				}
			}
		}
	}
	[Serializable]
	public class MaterialsWithNames
	{
		public List<Material> materials = new List<Material>();

		public string[] contentTagNames = Array.Empty<string>();
	}
}