Decompiled source of UtilityPylons v1.0.0

plugins/Reiko888.UtilityPylons.dll

Decompiled 7 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using Dawn.Utils;
using Dusk;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Reiko888.UtilityPylons.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using UnityEngine.VFX;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("DunGen")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")]
[assembly: IgnoresAccessChecksTo("Unity.XR.Management")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")]
[assembly: AssemblyCompany("Reiko888.UtilityPylons")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0beb3fe6750fadd37c6ae0f79f512cabcb3f0822")]
[assembly: AssemblyProduct("UtilityPylons")]
[assembly: AssemblyTitle("Reiko888.UtilityPylons")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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]
	[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]
	[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;
		}
	}
}
namespace PylonLC
{
	[BepInPlugin("reiko888.UtilityPylons", "UtilityPylons", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	internal class Plugin : BaseUnityPlugin
	{
		public const string modGUID = "reiko888.UtilityPylons";

		public const string modName = "UtilityPylons";

		public const string modVersion = "1.0.0";

		public static Plugin Instance = null;

		internal static ManualLogSource Logger = null;

		internal static readonly Harmony harmony = new Harmony("reiko888.UtilityPylons");

		internal static DuskMod mod = null;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Logger = ((BaseUnityPlugin)this).Logger;
			AssetBundle val = AssetBundleUtils.LoadBundle(Assembly.GetExecutingAssembly(), "utilpylon_cont");
			mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val);
			mod.RegisterContentHandlers();
			harmony.PatchAll(Assembly.GetExecutingAssembly());
			Logger.LogInfo((object)"Plugin UtilityPylons is loaded!");
		}
	}
	internal class PylonHandler : ContentHandler<PylonHandler>
	{
		public class PylonAssets : AssetBundleLoader<PylonAssets>
		{
			public PylonAssets(DuskMod mod, string filePath)
				: base(mod, filePath)
			{
			}
		}

		internal PylonAssets? pylonAssets;

		public PylonHandler(DuskMod mod)
			: base(mod)
		{
			((ContentHandler)this).RegisterContent<PylonAssets>("utilitypylons", ref pylonAssets, false);
		}
	}
	public class PylonItem : GrabbableObject
	{
		public enum PylonMode
		{
			Speed,
			Damage,
			Healing,
			DeathProtection,
			DanagingPylon,
			Sanity,
			Xray,
			Cloak
		}

		[Header("Machine SFX")]
		public AudioClip switchTurnOn;

		public AudioClip switchTurnOff;

		public AudioSource interactSFX;

		public AudioClip statusWarning;

		public AudioClip poweringOn;

		public AudioClip poweringOff;

		public AudioSource computerScreen;

		public AudioClip[] machineAmbience;

		public AudioClip[] machineOverloading;

		public AudioSource machineSFX;

		public AudioClip[] electricPulse;

		public AudioSource electricitySFX;

		public AudioClip[] modeSFXs;

		[Header("Robot Audio Settings")]
		public AudioSource robotAudio;

		public AudioClip[] modeVoicelines;

		public AudioClip[] overheatingVoicelines;

		public AudioClip[] powerOnVoicelines;

		public AudioClip[] powerOffVoicelines;

		public AudioClip[] playerSavedVoicelines;

		[Header("Components")]
		public Animator pylonAnimator;

		public GameObject screnPos;

		public InteractTrigger pylonTrigger;

		[Header("State")]
		public bool isPylonActive;

		[Header("Screen Settings")]
		public SkinnedMeshRenderer screenRenderer;

		public int screenMaterialIndex;

		public Texture2D[] screenTextures;

		private Material instantiatedScreenMaterial;

		[Header("VFX Settings")]
		public GameObject decalProjectorObj;

		public GameObject vfxParentObj;

		public ParticleSystem pylonParticleSystem;

		public VisualEffect middleVFX;

		public VisualEffect aoeVFX;

		[Header("Player Effects")]
		public ParticleSystem localPlayerElectricityPrefab;

		public static ParticleSystem playerElectricityPrefab;

		private static Dictionary<PlayerControllerB, ParticleSystem> playerElectricityEffects = new Dictionary<PlayerControllerB, ParticleSystem>();

		private static float electricityUpdateTimer = 0f;

		[Header("HUD Settings")]
		public GameObject pylonHUDPrefab;

		private static GameObject activeHUDInstance;

		private static Dictionary<PylonMode, GameObject> hudIcons = new Dictionary<PylonMode, GameObject>();

		[Header("Explosion Settings")]
		public GameObject burntCarcassPrefab;

		private float buffRange;

		private float buffHeightRange;

		private float speedBuffAmount;

		private float healRate;

		private float speedModeDrain;

		private float sanityModeDrain;

		private float xrayModeDrain;

		private float cloakModeDrain;

		private float healingModeDrain;

		private float deathProtectionDeduction;

		private float damagingModeDeduction;

		private float damageBoostDeduction;

		private float playerMultiplier1 = 1f;

		private float playerMultiplier2;

		private float playerMultiplier3;

		private float playerMultiplier4;

		private float pylonCooldown;

		private int protHealth;

		private int damageAreaVal;

		private float sanityRestVal;

		private float overheatThreshold;

		private int carryingPylonDmg;

		public static List<PylonItem> activePylons = new List<PylonItem>();

		public static List<PylonItem> allPylons = new List<PylonItem>();

		private static bool hasAppliedBuff = false;

		private static float originalSpeed = 0.5f;

		private float healAccumulator;

		private float damageTimer;

		public float stability = 100f;

		public bool isOverheating;

		public float cooldownTimer;

		private float syncTimer;

		private float heldDamageTimer;

		public PylonMode currentMode;

		public float DeathProtectionDeduction => deathProtectionDeduction;

		public override void Start()
		{
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Start();
			buffRange = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<float>("Pylon AOE Radius").Value;
			buffHeightRange = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<float>("Pylon AOE Height").Value;
			pylonCooldown = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<float>("Pylon Cooldown").Value;
			speedBuffAmount = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<float>("Speed Boost").Value;
			healRate = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<float>("Healing amount").Value;
			protHealth = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<int>("Death protection health restoration").Value;
			damageAreaVal = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<int>("Damaging area value").Value;
			sanityRestVal = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<float>("Sanity stabilisation").Value;
			speedModeDrain = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<float>("Speed mode drain rate").Value;
			sanityModeDrain = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<float>("Sanity mode drain rate").Value;
			damageBoostDeduction = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<float>("Damage boost mode drain rate").Value;
			healingModeDrain = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<float>("Healing mode drain rate").Value;
			xrayModeDrain = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<float>("Xray mode drain rate").Value;
			cloakModeDrain = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<float>("Cloak mode drain").Value;
			deathProtectionDeduction = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<float>("Death protection drain").Value;
			damagingModeDeduction = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<float>("Damaging mode drain rate").Value;
			playerMultiplier2 = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<float>("2 Players or Pylons multiplier").Value;
			playerMultiplier3 = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<float>("3 Players or Pylons multiplier").Value;
			playerMultiplier4 = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<float>("4 Players or Pylons multiplier").Value;
			overheatThreshold = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<float>("Overheat threshold").Value;
			carryingPylonDmg = ((AssetBundleLoader<PylonHandler.PylonAssets>)(object)ContentHandler<PylonHandler>.Instance.pylonAssets).GetConfig<int>("Carrying pylon damage").Value;
			if (!allPylons.Contains(this))
			{
				allPylons.Add(this);
			}
			if ((Object)(object)localPlayerElectricityPrefab != (Object)null)
			{
				playerElectricityPrefab = localPlayerElectricityPrefab;
			}
			if ((Object)(object)activeHUDInstance == (Object)null && (Object)(object)pylonHUDPrefab != (Object)null && (Object)(object)HUDManager.Instance != (Object)null && (Object)(object)HUDManager.Instance.HUDContainer != (Object)null)
			{
				activeHUDInstance = Object.Instantiate<GameObject>(pylonHUDPrefab, HUDManager.Instance.HUDContainer.transform, false);
				activeHUDInstance.transform.localScale = Vector3.one;
				hudIcons.Clear();
				Transform val = activeHUDInstance.transform.Find("PylonStatusPanel") ?? activeHUDInstance.transform;
				if ((Object)(object)val != (Object)null)
				{
					Dictionary<PylonMode, GameObject> dictionary = hudIcons;
					Transform obj = val.Find("SpeedIcon");
					dictionary[PylonMode.Speed] = ((obj != null) ? ((Component)obj).gameObject : null);
					Dictionary<PylonMode, GameObject> dictionary2 = hudIcons;
					Transform obj2 = val.Find("DamageBoostIcon");
					dictionary2[PylonMode.Damage] = ((obj2 != null) ? ((Component)obj2).gameObject : null);
					Dictionary<PylonMode, GameObject> dictionary3 = hudIcons;
					Transform obj3 = val.Find("HealingIcon");
					dictionary3[PylonMode.Healing] = ((obj3 != null) ? ((Component)obj3).gameObject : null);
					Dictionary<PylonMode, GameObject> dictionary4 = hudIcons;
					Transform obj4 = val.Find("DeathProtIcon");
					dictionary4[PylonMode.DeathProtection] = ((obj4 != null) ? ((Component)obj4).gameObject : null);
					Dictionary<PylonMode, GameObject> dictionary5 = hudIcons;
					Transform obj5 = val.Find("DamageAreaIcon");
					dictionary5[PylonMode.DanagingPylon] = ((obj5 != null) ? ((Component)obj5).gameObject : null);
					Dictionary<PylonMode, GameObject> dictionary6 = hudIcons;
					Transform obj6 = val.Find("SanityIcon");
					dictionary6[PylonMode.Sanity] = ((obj6 != null) ? ((Component)obj6).gameObject : null);
					Dictionary<PylonMode, GameObject> dictionary7 = hudIcons;
					Transform obj7 = val.Find("XrayIcon");
					dictionary7[PylonMode.Xray] = ((obj7 != null) ? ((Component)obj7).gameObject : null);
					Dictionary<PylonMode, GameObject> dictionary8 = hudIcons;
					Transform obj8 = val.Find("CloakIcon");
					dictionary8[PylonMode.Cloak] = ((obj8 != null) ? ((Component)obj8).gameObject : null);
					int num = 0;
					foreach (KeyValuePair<PylonMode, GameObject> hudIcon in hudIcons)
					{
						if ((Object)(object)hudIcon.Value != (Object)null)
						{
							num++;
						}
					}
				}
				ClearLocalPlayerHUD();
			}
			if ((Object)(object)pylonTrigger != (Object)null)
			{
				((UnityEvent<PlayerControllerB>)(object)pylonTrigger.onInteract).RemoveListener((UnityAction<PlayerControllerB>)OnInteractTriggered);
				((UnityEvent<PlayerControllerB>)(object)pylonTrigger.onInteract).AddListener((UnityAction<PlayerControllerB>)OnInteractTriggered);
				pylonTrigger.interactable = !base.isHeld && !base.isPocketed;
			}
			if ((Object)(object)screenRenderer != (Object)null && ((Renderer)screenRenderer).materials.Length > screenMaterialIndex)
			{
				Material[] materials = ((Renderer)screenRenderer).materials;
				instantiatedScreenMaterial = materials[screenMaterialIndex];
				((Renderer)screenRenderer).materials = materials;
			}
			UpdateScreenMaterial();
			UpdateVFXState();
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			RemoveFromActivePylons();
			if ((Object)(object)pylonTrigger != (Object)null)
			{
				pylonTrigger.interactable = false;
			}
			UpdateVFXState();
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			if ((!((Object)(object)StartOfRound.Instance != (Object)null) || !StartOfRound.Instance.inShipPhase) && (!used || !(cooldownTimer > 0f)))
			{
				((GrabbableObject)this).ItemActivate(used, buttonDown);
				TogglePylonLocal(used);
				TogglePylonServerRpc(used);
			}
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			RemoveFromActivePylons();
			if ((Object)(object)pylonTrigger != (Object)null)
			{
				pylonTrigger.interactable = false;
			}
			UpdateVFXState();
		}

		public override void DiscardItem()
		{
			((GrabbableObject)this).DiscardItem();
			if ((Object)(object)pylonTrigger != (Object)null)
			{
				pylonTrigger.interactable = true;
			}
			if (isPylonActive)
			{
				AddToActivePylons();
			}
			UpdateVFXState();
		}

		public void ChangeModeLocal(PylonMode mode)
		{
			if (!isPylonActive || stability <= overheatThreshold)
			{
				return;
			}
			currentMode = mode;
			UpdateScreenMaterial();
			if (modeSFXs != null && mode >= PylonMode.Speed && (int)mode < modeSFXs.Length && (Object)(object)modeSFXs[(int)mode] != (Object)null && (Object)(object)interactSFX != (Object)null)
			{
				interactSFX.PlayOneShot(modeSFXs[(int)mode]);
			}
			if ((Object)(object)robotAudio != (Object)null && modeVoicelines != null && mode >= PylonMode.Speed && (int)mode < modeVoicelines.Length)
			{
				AudioClip val = modeVoicelines[(int)mode];
				if ((Object)(object)val != (Object)null)
				{
					robotAudio.Stop();
					robotAudio.clip = val;
					robotAudio.Play();
				}
			}
			UpdateVFXState();
		}

		[ServerRpc(RequireOwnership = false)]
		public void ChangeModeServerRpc(PylonMode mode)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2647750659u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<PylonMode>(ref mode, default(ForEnums));
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 2647750659u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (isPylonActive && !(stability <= overheatThreshold))
				{
					ChangeModeClientRpc(mode);
				}
			}
		}

		[ClientRpc]
		public void ChangeModeClientRpc(PylonMode mode)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3308591578u, val2, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe<PylonMode>(ref mode, default(ForEnums));
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 3308591578u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					ChangeModeLocal(mode);
				}
			}
		}

		private void OnDisable()
		{
			RemoveFromActivePylons();
			if (allPylons.Contains(this))
			{
				allPylons.Remove(this);
			}
			CleanupLocalBuffIfLast();
		}

		public override void OnDestroy()
		{
			((GrabbableObject)this).OnDestroy();
			RemoveFromActivePylons();
			if (allPylons.Contains(this))
			{
				allPylons.Remove(this);
			}
			CleanupLocalBuffIfLast();
		}

		public void OnInteractTriggered(PlayerControllerB playerWhoInteracted)
		{
			if (isPylonActive && !(stability <= overheatThreshold))
			{
				int length = Enum.GetValues(typeof(PylonMode)).Length;
				PylonMode mode = (PylonMode)((int)(currentMode + 1) % length);
				ChangeModeLocal(mode);
				ChangeModeServerRpc(mode);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void TogglePylonServerRpc(bool active)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2754904381u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref active, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 2754904381u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				if (!active || !(cooldownTimer > 0f))
				{
					TogglePylonClientRpc(active);
				}
			}
		}

		[ClientRpc]
		public void TogglePylonClientRpc(bool active)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val2 = default(ClientRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2389651483u, val2, (RpcDelivery)0);
					((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref active, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val, 2389651483u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					TogglePylonLocal(active);
				}
			}
		}

		public void TogglePylonLocal(bool active)
		{
			if ((active && (Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.inShipPhase) || (active && cooldownTimer > 0f) || isPylonActive == active)
			{
				return;
			}
			if (!active && stability <= overheatThreshold)
			{
				cooldownTimer = pylonCooldown;
			}
			isPylonActive = active;
			if ((Object)(object)robotAudio != (Object)null)
			{
				AudioClip[] array = (active ? powerOnVoicelines : powerOffVoicelines);
				if (array != null && array.Length != 0)
				{
					AudioClip val = array[Random.Range(0, array.Length)];
					if ((Object)(object)val != (Object)null)
					{
						robotAudio.Stop();
						robotAudio.clip = val;
						robotAudio.Play();
					}
				}
			}
			if (!active)
			{
				isOverheating = false;
				if ((Object)(object)pylonAnimator != (Object)null)
				{
					pylonAnimator.SetBool("isOverheating", false);
				}
				if ((Object)(object)computerScreen != (Object)null)
				{
					computerScreen.Stop();
				}
			}
			if ((Object)(object)pylonAnimator != (Object)null)
			{
				pylonAnimator.SetBool("on", active);
			}
			if ((Object)(object)interactSFX != (Object)null)
			{
				AudioClip val2 = (active ? switchTurnOn : switchTurnOff);
				if ((Object)(object)val2 != (Object)null)
				{
					interactSFX.PlayOneShot(val2);
				}
			}
			if ((Object)(object)computerScreen != (Object)null)
			{
				AudioClip val3 = (active ? poweringOn : poweringOff);
				if ((Object)(object)val3 != (Object)null)
				{
					computerScreen.PlayOneShot(val3);
				}
			}
			if ((Object)(object)machineSFX != (Object)null)
			{
				if (active)
				{
					if (machineAmbience != null && machineAmbience.Length != 0 && (Object)(object)machineAmbience[0] != (Object)null)
					{
						machineSFX.clip = machineAmbience[0];
						machineSFX.loop = true;
						machineSFX.Play();
					}
				}
				else
				{
					machineSFX.Stop();
				}
			}
			if (active)
			{
				if (!base.isHeld && !base.isPocketed)
				{
					AddToActivePylons();
				}
			}
			else
			{
				RemoveFromActivePylons();
			}
			UpdateScreenMaterial();
			UpdateVFXState();
		}

		private void AddToActivePylons()
		{
			if (!activePylons.Contains(this))
			{
				activePylons.Add(this);
			}
		}

		private void RemoveFromActivePylons()
		{
			if (activePylons.Contains(this))
			{
				activePylons.Remove(this);
				CleanupLocalBuffIfLast();
			}
		}

		public static bool IsPlayerInPylonRange(PlayerControllerB player, PylonMode mode)
		{
			//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)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_006c: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < activePylons.Count; i++)
			{
				PylonItem pylonItem = activePylons[i];
				if ((Object)(object)pylonItem != (Object)null && pylonItem.isPylonActive && pylonItem.currentMode == mode && !((GrabbableObject)pylonItem).isHeld && !((GrabbableObject)pylonItem).isPocketed)
				{
					Vector3 position = ((Component)player).transform.position;
					Vector3 position2 = ((Component)pylonItem).transform.position;
					float num = Vector2.Distance(new Vector2(position.x, position.z), new Vector2(position2.x, position2.z));
					float num2 = Mathf.Abs(position.y - position2.y);
					if (num <= pylonItem.buffRange && num2 <= pylonItem.buffHeightRange)
					{
						return true;
					}
				}
			}
			return false;
		}

		public static int GetPylonCountInRange(PlayerControllerB player, PylonMode mode)
		{
			//IL_004e: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: 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_006d: 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_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			for (int i = 0; i < activePylons.Count; i++)
			{
				PylonItem pylonItem = activePylons[i];
				if ((Object)(object)pylonItem != (Object)null && pylonItem.isPylonActive && pylonItem.currentMode == mode && !((GrabbableObject)pylonItem).isHeld && !((GrabbableObject)pylonItem).isPocketed)
				{
					Vector3 position = ((Component)player).transform.position;
					Vector3 position2 = ((Component)pylonItem).transform.position;
					float num2 = Vector2.Distance(new Vector2(position.x, position.z), new Vector2(position2.x, position2.z));
					float num3 = Mathf.Abs(position.y - position2.y);
					if (num2 <= pylonItem.buffRange && num3 <= pylonItem.buffHeightRange)
					{
						num++;
					}
				}
			}
			return num;
		}

		public static void DeductDamageBoostStability(PlayerControllerB player)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < activePylons.Count; i++)
			{
				PylonItem pylonItem = activePylons[i];
				if ((Object)(object)pylonItem != (Object)null && pylonItem.isPylonActive && pylonItem.currentMode == PylonMode.Damage && !((GrabbableObject)pylonItem).isHeld && !((GrabbableObject)pylonItem).isPocketed)
				{
					Vector3 position = ((Component)player).transform.position;
					Vector3 position2 = ((Component)pylonItem).transform.position;
					float num = Vector2.Distance(new Vector2(position.x, position.z), new Vector2(position2.x, position2.z));
					float num2 = Mathf.Abs(position.y - position2.y);
					if (num <= pylonItem.buffRange && num2 <= pylonItem.buffHeightRange)
					{
						pylonItem.DeductStabilityServerRpc(pylonItem.damageBoostDeduction);
					}
				}
			}
		}

		public static PylonItem GetPylonSavingPlayer(PlayerControllerB player, PylonMode mode)
		{
			//IL_0052: 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_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			for (int i = 0; i < activePylons.Count; i++)
			{
				PylonItem pylonItem = activePylons[i];
				if ((Object)(object)pylonItem != (Object)null && pylonItem.isPylonActive && pylonItem.currentMode == mode && !((GrabbableObject)pylonItem).isHeld && !((GrabbableObject)pylonItem).isPocketed)
				{
					float num = Vector2.Distance(new Vector2(((Component)player).transform.position.x, ((Component)player).transform.position.z), new Vector2(((Component)pylonItem).transform.position.x, ((Component)pylonItem).transform.position.z));
					float num2 = Mathf.Abs(((Component)player).transform.position.y - ((Component)pylonItem).transform.position.y);
					if (num <= pylonItem.buffRange && num2 <= pylonItem.buffHeightRange)
					{
						return pylonItem;
					}
				}
			}
			return null;
		}

		public override void Update()
		{
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: 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_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Update();
			if (isPylonActive && (Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.inShipPhase)
			{
				TogglePylonLocal(active: false);
			}
			if (activePylons.Count > 0 && (Object)(object)activePylons[0] == (Object)(object)this)
			{
				electricityUpdateTimer += Time.deltaTime;
				if (electricityUpdateTimer >= 0.1f)
				{
					electricityUpdateTimer = 0f;
					UpdateAllPlayerElectricityEffects();
					if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
					{
						UpdateLocalPlayerHUD(GameNetworkManager.Instance.localPlayerController);
					}
				}
			}
			if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
				UpdatePlayerSpeedBuff(localPlayerController);
				UpdatePlayerHealingBuff(localPlayerController);
				UpdateSanityPylon(localPlayerController);
				UpdateDamagingPylon(localPlayerController);
				UpdateXrayPylon(localPlayerController);
				if (isPylonActive && base.isHeld && (Object)(object)base.playerHeldBy != (Object)null)
				{
					heldDamageTimer += Time.deltaTime;
					if (heldDamageTimer >= 3f)
					{
						heldDamageTimer = 0f;
						base.playerHeldBy.DamagePlayer(carryingPylonDmg, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
					}
				}
				else
				{
					heldDamageTimer = 0f;
				}
			}
			if ((Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsServer)
			{
				if (cooldownTimer > 0f)
				{
					cooldownTimer = Mathf.Max(0f, cooldownTimer - Time.deltaTime);
				}
				if (isPylonActive)
				{
					if ((Object)(object)StartOfRound.Instance == (Object)null || !StartOfRound.Instance.shipIsLeaving)
					{
						float baseStabilityDrain = GetBaseStabilityDrain();
						float playerMultiplier = GetPlayerMultiplier();
						stability = Mathf.Max(0f, stability - baseStabilityDrain * playerMultiplier * Time.deltaTime);
						if (stability <= overheatThreshold && !isOverheating)
						{
							SetOverheatingState(state: true);
						}
						if (stability <= 0f)
						{
							ExplodePylonServerRpc();
						}
					}
				}
				else
				{
					float num = ((pylonCooldown > 0f) ? (100f / pylonCooldown) : 5f);
					stability = Mathf.Min(100f, stability + num * Time.deltaTime);
					if (stability > overheatThreshold && isOverheating)
					{
						SetOverheatingState(state: false);
					}
				}
				syncTimer += Time.deltaTime;
				if (syncTimer >= 0.2f)
				{
					syncTimer = 0f;
					SyncStabilityClientRpc(stability, isOverheating, cooldownTimer);
				}
			}
			if (isPylonActive && (Object)(object)instantiatedScreenMaterial != (Object)null)
			{
				if (isOverheating)
				{
					float num2 = Mathf.Lerp(0f, 20f, Mathf.PingPong(Time.time * 5f, 1f));
					instantiatedScreenMaterial.SetColor("_EmissiveColor", Color.white * num2);
					instantiatedScreenMaterial.SetFloat("_EmissiveIntensity", num2);
				}
				else
				{
					Color val = default(Color);
					((Color)(ref val))..ctor(0.718f, 0.718f, 0.718f);
					float num3 = Random.Range(7f, 10f);
					instantiatedScreenMaterial.SetColor("_EmissiveColor", val * num3);
					instantiatedScreenMaterial.SetFloat("_EmissiveIntensity", num3);
				}
			}
		}

		private void UpdatePlayerSpeedBuff(PlayerControllerB localPlayer)
		{
			int pylonCountInRange = GetPylonCountInRange(localPlayer, PylonMode.Speed);
			if (pylonCountInRange > 0)
			{
				if (!hasAppliedBuff)
				{
					originalSpeed = localPlayer.movementSpeed;
					hasAppliedBuff = true;
				}
				localPlayer.movementSpeed = originalSpeed + (float)pylonCountInRange * speedBuffAmount;
			}
			else if (hasAppliedBuff)
			{
				localPlayer.movementSpeed = originalSpeed;
				hasAppliedBuff = false;
			}
		}

		private void UpdatePlayerHealingBuff(PlayerControllerB localPlayer)
		{
			int pylonCountInRange = GetPylonCountInRange(localPlayer, PylonMode.Healing);
			if (pylonCountInRange > 0 && !localPlayer.isPlayerDead && localPlayer.health < 100)
			{
				healAccumulator += healRate * (float)pylonCountInRange * Time.deltaTime;
				if (healAccumulator >= 1f)
				{
					int num = (int)healAccumulator;
					healAccumulator -= num;
					localPlayer.health = Mathf.Min(100, localPlayer.health + num);
					if (localPlayer.health >= 20 && (localPlayer.criticallyInjured || localPlayer.bleedingHeavily))
					{
						localPlayer.criticallyInjured = false;
						localPlayer.bleedingHeavily = false;
					}
					HUDManager.Instance.UpdateHealthUI(localPlayer.health, false);
					localPlayer.DamagePlayerServerRpc(0, localPlayer.health);
				}
			}
			else
			{
				healAccumulator = 0f;
			}
		}

		private void UpdateDamagingPylon(PlayerControllerB localPlayer)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			if (IsPlayerInPylonRange(localPlayer, PylonMode.DanagingPylon) && !localPlayer.isPlayerDead)
			{
				damageTimer += Time.deltaTime;
				if (damageTimer >= 2f)
				{
					damageTimer = 0f;
					localPlayer.DamagePlayer(damageAreaVal, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
					DeductStabilityServerRpc(damagingModeDeduction);
				}
			}
			if (!((Object)(object)NetworkManager.Singleton != (Object)null) || !NetworkManager.Singleton.IsServer || !isPylonActive || currentMode != PylonMode.DanagingPylon || base.isHeld || base.isPocketed || damageTimer != 0f || !((Object)(object)RoundManager.Instance != (Object)null) || RoundManager.Instance.SpawnedEnemies == null)
			{
				return;
			}
			for (int i = 0; i < RoundManager.Instance.SpawnedEnemies.Count; i++)
			{
				EnemyAI val = RoundManager.Instance.SpawnedEnemies[i];
				if (!((Object)(object)val != (Object)null) || val.isEnemyDead)
				{
					continue;
				}
				float num = Vector2.Distance(new Vector2(((Component)val).transform.position.x, ((Component)val).transform.position.z), new Vector2(((Component)this).transform.position.x, ((Component)this).transform.position.z));
				float num2 = Mathf.Abs(((Component)val).transform.position.y - ((Component)this).transform.position.y);
				if (num <= buffRange && num2 <= buffHeightRange)
				{
					val.HitEnemy(1, (PlayerControllerB)null, true, -1);
					stability = Mathf.Max(0f, stability - damagingModeDeduction);
					if (stability <= 0f)
					{
						ExplodePylonServerRpc();
					}
				}
			}
		}

		private void UpdateSanityPylon(PlayerControllerB localPlayer)
		{
			int pylonCountInRange = GetPylonCountInRange(localPlayer, PylonMode.Sanity);
			if (pylonCountInRange > 0 && !localPlayer.isPlayerDead && localPlayer.insanityLevel > 0f)
			{
				localPlayer.insanityLevel = Mathf.Max(0f, localPlayer.insanityLevel - sanityRestVal * (float)pylonCountInRange * Time.deltaTime);
			}
		}

		private void UpdateXrayPylon(PlayerControllerB localPlayer)
		{
			if (IsPlayerInPylonRange(localPlayer, PylonMode.Xray) && !localPlayer.isPlayerDead && (Object)(object)HUDManager.Instance != (Object)null)
			{
				HUDManager.Instance.playerPingingScan = 2f;
			}
		}

		public void UpdateScreenMaterial()
		{
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)instantiatedScreenMaterial == (Object)null)
			{
				return;
			}
			if (isPylonActive)
			{
				Color val = default(Color);
				((Color)(ref val))..ctor(0.718f, 0.718f, 0.718f);
				instantiatedScreenMaterial.SetColor("_BaseColor", val);
				instantiatedScreenMaterial.SetColor("_Color", val);
				if (isOverheating)
				{
					if (screenTextures != null && screenTextures.Length > 8)
					{
						instantiatedScreenMaterial.SetTexture("_BaseColorMap", (Texture)(object)screenTextures[8]);
					}
				}
				else
				{
					int num = (int)currentMode;
					if (screenTextures != null && num >= 0 && num < screenTextures.Length)
					{
						instantiatedScreenMaterial.SetTexture("_BaseColorMap", (Texture)(object)screenTextures[num]);
					}
				}
				instantiatedScreenMaterial.EnableKeyword("_EMISSIVE");
			}
			else
			{
				instantiatedScreenMaterial.SetColor("_BaseColor", Color.black);
				instantiatedScreenMaterial.SetColor("_Color", Color.black);
				instantiatedScreenMaterial.DisableKeyword("_EMISSIVE");
			}
		}

		private float GetBaseStabilityDrain()
		{
			switch (currentMode)
			{
			case PylonMode.Speed:
				return speedModeDrain;
			case PylonMode.Sanity:
				return sanityModeDrain;
			case PylonMode.Damage:
				return 0f;
			case PylonMode.Xray:
				return xrayModeDrain;
			case PylonMode.Cloak:
				return cloakModeDrain;
			case PylonMode.Healing:
				if (!IsAnyPlayerBeingHealed())
				{
					return 0f;
				}
				return healingModeDrain;
			default:
				return 0f;
			}
		}

		private bool IsAnyPlayerBeingHealed()
		{
			if ((Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayerScripts == null)
			{
				return false;
			}
			for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
			{
				PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i];
				if ((Object)(object)val != (Object)null && val.isPlayerControlled && !val.isPlayerDead && val.health < 100 && IsPlayerInPylonRange(val, PylonMode.Healing))
				{
					return true;
				}
			}
			return false;
		}

		private int GetOtherActivePylonsInRangeCount()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			for (int i = 0; i < activePylons.Count; i++)
			{
				PylonItem pylonItem = activePylons[i];
				if ((Object)(object)pylonItem != (Object)null && (Object)(object)pylonItem != (Object)(object)this && pylonItem.isPylonActive && !((GrabbableObject)pylonItem).isHeld && !((GrabbableObject)pylonItem).isPocketed)
				{
					float num2 = Vector2.Distance(new Vector2(((Component)pylonItem).transform.position.x, ((Component)pylonItem).transform.position.z), new Vector2(((Component)this).transform.position.x, ((Component)this).transform.position.z));
					float num3 = Mathf.Abs(((Component)pylonItem).transform.position.y - ((Component)this).transform.position.y);
					if (num2 <= buffRange && num3 <= buffHeightRange)
					{
						num++;
					}
				}
			}
			return num;
		}

		private float GetPlayerMultiplier()
		{
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: 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)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			if ((Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.allPlayerScripts != null)
			{
				for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
				{
					PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i];
					if ((Object)(object)val != (Object)null && val.isPlayerControlled && !val.isPlayerDead)
					{
						float num2 = Vector2.Distance(new Vector2(((Component)val).transform.position.x, ((Component)val).transform.position.z), new Vector2(((Component)this).transform.position.x, ((Component)this).transform.position.z));
						float num3 = Mathf.Abs(((Component)val).transform.position.y - ((Component)this).transform.position.y);
						if (num2 <= buffRange && num3 <= buffHeightRange)
						{
							num++;
						}
					}
				}
			}
			int otherActivePylonsInRangeCount = GetOtherActivePylonsInRangeCount();
			int num4 = num + otherActivePylonsInRangeCount;
			if (num4 <= 1)
			{
				return playerMultiplier1;
			}
			return num4 switch
			{
				2 => playerMultiplier2, 
				3 => playerMultiplier3, 
				_ => playerMultiplier4, 
			};
		}

		private void SetOverheatingState(bool state)
		{
			isOverheating = state;
			SetOverheatingClientRpc(state);
		}

		[ClientRpc]
		public void SetOverheatingClientRpc(bool state)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3751482577u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref state, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3751482577u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			isOverheating = state;
			if ((Object)(object)pylonAnimator != (Object)null)
			{
				pylonAnimator.SetBool("isOverheating", state);
			}
			if (state)
			{
				if ((Object)(object)robotAudio != (Object)null && overheatingVoicelines != null && overheatingVoicelines.Length != 0)
				{
					AudioClip val3 = overheatingVoicelines[Random.Range(0, overheatingVoicelines.Length)];
					if ((Object)(object)val3 != (Object)null)
					{
						robotAudio.Stop();
						robotAudio.clip = val3;
						robotAudio.Play();
					}
				}
				if ((Object)(object)computerScreen != (Object)null && (Object)(object)statusWarning != (Object)null)
				{
					computerScreen.clip = statusWarning;
					computerScreen.loop = true;
					computerScreen.Play();
				}
				if ((Object)(object)machineSFX != (Object)null && machineOverloading != null && machineOverloading.Length != 0 && (Object)(object)machineOverloading[0] != (Object)null)
				{
					machineSFX.clip = machineOverloading[0];
					machineSFX.loop = true;
					machineSFX.Play();
				}
				UpdateScreenMaterial();
				return;
			}
			if ((Object)(object)computerScreen != (Object)null)
			{
				computerScreen.Stop();
			}
			if ((Object)(object)machineSFX != (Object)null)
			{
				machineSFX.Stop();
				if (isPylonActive && machineAmbience != null && machineAmbience.Length != 0 && (Object)(object)machineAmbience[0] != (Object)null)
				{
					machineSFX.clip = machineAmbience[0];
					machineSFX.loop = true;
					machineSFX.Play();
				}
			}
			UpdateScreenMaterial();
		}

		[ClientRpc]
		public void SyncStabilityClientRpc(float newStability, bool overheatingState, float newCooldown)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(755763878u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref newStability, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref overheatingState, default(ForPrimitives));
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref newCooldown, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 755763878u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			stability = newStability;
			cooldownTimer = newCooldown;
			if (isOverheating != overheatingState)
			{
				isOverheating = overheatingState;
				if ((Object)(object)pylonAnimator != (Object)null)
				{
					pylonAnimator.SetBool("isOverheating", overheatingState);
				}
				UpdateScreenMaterial();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void DeductStabilityServerRpc(float amount)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(71179251u, val2, (RpcDelivery)0);
				((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref amount, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 71179251u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (((NetworkBehaviour)this).IsServer && (!((Object)(object)StartOfRound.Instance != (Object)null) || (!StartOfRound.Instance.shipIsLeaving && !StartOfRound.Instance.inShipPhase)))
			{
				stability = Mathf.Max(0f, stability - amount);
				if (stability <= 0f)
				{
					ExplodePylonServerRpc();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void ExplodePylonServerRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val2 = default(ServerRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(4115492691u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val, 4115492691u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			if (((NetworkBehaviour)this).IsServer)
			{
				ExplodePylonClientRpc();
				if ((Object)(object)((NetworkBehaviour)this).NetworkObject != (Object)null)
				{
					((NetworkBehaviour)this).NetworkObject.Despawn(true);
				}
				else
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
			}
		}

		public static void SavePlayerFromDeath(PlayerControllerB player, PylonItem savingPylon)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (((NetworkBehaviour)player).IsOwner)
			{
				Vector3 val = ((Component)savingPylon).transform.position + Vector3.up * 0.2f;
				player.TeleportPlayer(val, false, 0f, false, true);
				if ((Object)(object)player.beamOutParticle != (Object)null)
				{
					player.beamOutParticle.Play();
				}
				player.health = savingPylon.protHealth;
				player.criticallyInjured = true;
				player.bleedingHeavily = true;
				savingPylon.TogglePylonLocal(active: false);
				savingPylon.TogglePylonServerRpc(active: false);
				savingPylon.DeductStabilityServerRpc(savingPylon.DeathProtectionDeduction);
				savingPylon.SavePlayerServerRpc((int)player.playerClientId);
				Debug.Log((object)("[PylonMod] Saved " + player.playerUsername + "! Teleported to Pylon."));
			}
			else
			{
				Debug.Log((object)("[PylonMod] Prevented remote death/grab of player " + player.playerUsername + " due to saving pylon."));
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void SavePlayerServerRpc(int playerClientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val2 = default(ServerRpcParams);
					FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1838876173u, val2, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val, playerClientId);
					((NetworkBehaviour)this).__endSendServerRpc(ref val, 1838876173u, val2, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					SavePlayerClientRpc(playerClientId);
				}
			}
		}

		[ClientRpc]
		public void SavePlayerClientRpc(int playerClientId)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(782292837u, val2, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val, playerClientId);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 782292837u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
			{
				return;
			}
			((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
			PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerClientId];
			if (!((Object)(object)val3 != (Object)null))
			{
				return;
			}
			val3.health = 10;
			val3.criticallyInjured = true;
			val3.bleedingHeavily = true;
			val3.isPlayerDead = false;
			val3.inSpecialInteractAnimation = false;
			val3.inAnimationWithEnemy = null;
			val3.snapToServerPosition = false;
			if ((Object)(object)val3.deadBody != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)val3.deadBody).gameObject);
				val3.deadBody = null;
			}
			if ((Object)(object)robotAudio != (Object)null && playerSavedVoicelines != null && playerSavedVoicelines.Length != 0)
			{
				AudioClip val4 = playerSavedVoicelines[Random.Range(0, playerSavedVoicelines.Length)];
				if ((Object)(object)val4 != (Object)null)
				{
					robotAudio.Stop();
					robotAudio.clip = val4;
					robotAudio.Play();
				}
			}
		}

		[ClientRpc]
		public void ExplodePylonClientRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: 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)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val2 = default(ClientRpcParams);
				FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3913549475u, val2, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val, 3913549475u, val2, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
				Landmine.SpawnExplosion(((Component)this).transform.position + Vector3.up * 0.5f, true, 5.7f, 6f, 50, 80f, (GameObject)null, false);
				if ((Object)(object)burntCarcassPrefab != (Object)null)
				{
					GameObject val3 = Object.Instantiate<GameObject>(burntCarcassPrefab, ((Component)this).transform.position, ((Component)this).transform.rotation);
					val3.AddComponent<BurntCarcassCleanup>();
				}
			}
		}

		private static void CleanupLocalBuffIfLast()
		{
			if (activePylons.Count == 0)
			{
				ClearAllElectricityEffects();
				ClearLocalPlayerHUD();
				if (hasAppliedBuff && (Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
				{
					GameNetworkManager.Instance.localPlayerController.movementSpeed = originalSpeed;
					hasAppliedBuff = false;
				}
			}
			if (allPylons.Count == 0 && (Object)(object)activeHUDInstance != (Object)null)
			{
				Object.Destroy((Object)(object)activeHUDInstance);
				activeHUDInstance = null;
				hudIcons.Clear();
			}
		}

		private void UpdateVFXState()
		{
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Expected O, but got Unknown
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_027d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			bool flag = (Object)(object)base.playerHeldBy == (Object)null && !base.isPocketed;
			bool flag2 = isPylonActive && flag;
			bool flag3 = isPylonActive;
			if ((Object)(object)decalProjectorObj != (Object)null)
			{
				decalProjectorObj.SetActive(flag2);
			}
			if ((Object)(object)vfxParentObj != (Object)null)
			{
				vfxParentObj.SetActive(flag3);
			}
			if ((Object)(object)aoeVFX != (Object)null)
			{
				bool activeSelf = ((Component)aoeVFX).gameObject.activeSelf;
				((Component)aoeVFX).gameObject.SetActive(flag2);
				if (flag2 && !activeSelf)
				{
					aoeVFX.Play();
				}
			}
			if ((Object)(object)pylonParticleSystem != (Object)null)
			{
				if (flag3)
				{
					if (!pylonParticleSystem.isPlaying)
					{
						pylonParticleSystem.Play();
					}
				}
				else if (pylonParticleSystem.isPlaying)
				{
					pylonParticleSystem.Stop();
				}
			}
			Color modeColor = GetModeColor(currentMode);
			if ((Object)(object)pylonParticleSystem != (Object)null)
			{
				MainModule main = pylonParticleSystem.main;
				((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(modeColor);
			}
			if ((Object)(object)middleVFX != (Object)null && flag3)
			{
				float num = 1f;
				if (currentMode == PylonMode.Speed || currentMode == PylonMode.Healing)
				{
					num = 6f;
				}
				middleVFX.SetVector4("Noise Color 1", Color.op_Implicit(modeColor * num));
				middleVFX.SetVector4("Noise Color 2", Color.op_Implicit(modeColor * num * 0.8f));
				middleVFX.SetVector4("Noise Color 3", Color.op_Implicit(modeColor * num * 0.6f));
				middleVFX.SetVector4("Noise Color 4", Color.op_Implicit(modeColor * num * 0.4f));
			}
			if ((Object)(object)aoeVFX != (Object)null && flag2)
			{
				aoeVFX.SetFloat("(Blocks) Lifetime", buffRange);
				aoeVFX.SetFloat("Spark radius", buffRange);
				Gradient val = new Gradient();
				val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2]
				{
					new GradientColorKey(modeColor, 0f),
					new GradientColorKey(modeColor, 1f)
				}, (GradientAlphaKey[])(object)new GradientAlphaKey[2]
				{
					new GradientAlphaKey(1f, 0f),
					new GradientAlphaKey(0f, 1f)
				});
				aoeVFX.SetGradient("Color Gradient", val);
				aoeVFX.SetGradient("(Blocks) Color Gradient", val);
			}
		}

		private Color GetModeColor(PylonMode mode)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			return (Color)(mode switch
			{
				PylonMode.Speed => new Color(0.051f, 0.349f, 0.341f), 
				PylonMode.Damage => new Color(1f, 0.1f, 0.1f), 
				PylonMode.Healing => new Color(0.031f, 0.227f, 0.02f), 
				PylonMode.DeathProtection => new Color(1f, 0.8f, 0.3f), 
				PylonMode.DanagingPylon => new Color(1f, 0.4f, 0f), 
				PylonMode.Sanity => new Color(0.7f, 0.3f, 1f), 
				PylonMode.Xray => new Color(0.1f, 1f, 0.2f), 
				PylonMode.Cloak => new Color(0.1f, 0.2f, 0.8f), 
				_ => Color.white, 
			});
		}

		private static void UpdateAllPlayerElectricityEffects()
		{
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayerScripts == null)
			{
				ClearAllElectricityEffects();
				return;
			}
			for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
			{
				PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i];
				if ((Object)(object)val == (Object)null || !val.isPlayerControlled || val.isPlayerDead)
				{
					RemoveElectricityFromPlayer(val);
					continue;
				}
				bool flag = false;
				PylonItem pylonItem = null;
				float num = 99999f;
				for (int j = 0; j < activePylons.Count; j++)
				{
					PylonItem pylonItem2 = activePylons[j];
					if (!((Object)(object)pylonItem2 != (Object)null) || !pylonItem2.isPylonActive || ((GrabbableObject)pylonItem2).isHeld || ((GrabbableObject)pylonItem2).isPocketed)
					{
						continue;
					}
					float num2 = Vector2.Distance(new Vector2(((Component)val).transform.position.x, ((Component)val).transform.position.z), new Vector2(((Component)pylonItem2).transform.position.x, ((Component)pylonItem2).transform.position.z));
					float num3 = Mathf.Abs(((Component)val).transform.position.y - ((Component)pylonItem2).transform.position.y);
					if (num2 <= pylonItem2.buffRange && num3 <= pylonItem2.buffHeightRange)
					{
						flag = true;
						float num4 = Vector3.Distance(((Component)val).transform.position, ((Component)pylonItem2).transform.position);
						if (num4 < num)
						{
							num = num4;
							pylonItem = pylonItem2;
						}
					}
				}
				if (flag && (Object)(object)pylonItem != (Object)null)
				{
					ApplyElectricityToPlayer(val, pylonItem.GetModeColor(pylonItem.currentMode));
				}
				else
				{
					RemoveElectricityFromPlayer(val);
				}
			}
		}

		private static void ApplyElectricityToPlayer(PlayerControllerB player, Color color)
		{
			//IL_0019: 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)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Expected O, but got Unknown
			if (playerElectricityEffects.TryGetValue(player, out ParticleSystem value))
			{
				if ((Object)(object)value != (Object)null)
				{
					MainModule main = value.main;
					((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color);
					return;
				}
				playerElectricityEffects.Remove(player);
			}
			if ((Object)(object)playerElectricityPrefab != (Object)null)
			{
				Transform playerGlobalHead = player.playerGlobalHead;
				if ((Object)(object)playerGlobalHead != (Object)null)
				{
					ParticleSystem val = Object.Instantiate<ParticleSystem>(playerElectricityPrefab, playerGlobalHead);
					((Component)val).transform.localPosition = new Vector3(0f, 0.35f, 0f);
					((Component)val).transform.localRotation = Quaternion.identity;
					if ((Object)(object)player == (Object)(object)GameNetworkManager.Instance.localPlayerController)
					{
						((Component)val).gameObject.layer = 23;
						foreach (Transform item in ((Component)val).transform)
						{
							Transform val2 = item;
							((Component)val2).gameObject.layer = 23;
						}
					}
					MainModule main2 = val.main;
					((MainModule)(ref main2)).startColor = MinMaxGradient.op_Implicit(color);
					val.Play();
					playerElectricityEffects[player] = val;
				}
				else
				{
					Debug.LogWarning((object)("[Pylon] Player head container is null for player " + player.playerUsername + "! Cannot attach electricity."));
				}
			}
			else
			{
				Debug.LogWarning((object)"[Pylon] Container is null! Cannot spawn head effect.");
			}
		}

		private static void RemoveElectricityFromPlayer(PlayerControllerB player)
		{
			if (playerElectricityEffects.TryGetValue(player, out ParticleSystem value))
			{
				if ((Object)(object)value != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)value).gameObject);
				}
				playerElectricityEffects.Remove(player);
			}
		}

		private static void ClearAllElectricityEffects()
		{
			foreach (KeyValuePair<PlayerControllerB, ParticleSystem> playerElectricityEffect in playerElectricityEffects)
			{
				if ((Object)(object)playerElectricityEffect.Value != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)playerElectricityEffect.Value).gameObject);
				}
			}
			playerElectricityEffects.Clear();
		}

		private static void UpdateLocalPlayerHUD(PlayerControllerB localPlayer)
		{
			if ((Object)(object)activeHUDInstance == (Object)null)
			{
				return;
			}
			foreach (KeyValuePair<PylonMode, GameObject> hudIcon in hudIcons)
			{
				if ((Object)(object)hudIcon.Value != (Object)null)
				{
					int pylonCountInRange = GetPylonCountInRange(localPlayer, hudIcon.Key);
					bool flag = pylonCountInRange > 0;
					if (hudIcon.Value.activeSelf != flag)
					{
						hudIcon.Value.SetActive(flag);
					}
				}
			}
		}

		private static void ClearLocalPlayerHUD()
		{
			if ((Object)(object)activeHUDInstance == (Object)null)
			{
				return;
			}
			foreach (KeyValuePair<PylonMode, GameObject> hudIcon in hudIcons)
			{
				if ((Object)(object)hudIcon.Value != (Object)null)
				{
					hudIcon.Value.SetActive(false);
				}
			}
		}

		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0061: 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_008c: Expected O, but got Unknown
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(2647750659u, new RpcReceiveHandler(__rpc_handler_2647750659), "ChangeModeServerRpc");
			((NetworkBehaviour)this).__registerRpc(3308591578u, new RpcReceiveHandler(__rpc_handler_3308591578), "ChangeModeClientRpc");
			((NetworkBehaviour)this).__registerRpc(2754904381u, new RpcReceiveHandler(__rpc_handler_2754904381), "TogglePylonServerRpc");
			((NetworkBehaviour)this).__registerRpc(2389651483u, new RpcReceiveHandler(__rpc_handler_2389651483), "TogglePylonClientRpc");
			((NetworkBehaviour)this).__registerRpc(3751482577u, new RpcReceiveHandler(__rpc_handler_3751482577), "SetOverheatingClientRpc");
			((NetworkBehaviour)this).__registerRpc(755763878u, new RpcReceiveHandler(__rpc_handler_755763878), "SyncStabilityClientRpc");
			((NetworkBehaviour)this).__registerRpc(71179251u, new RpcReceiveHandler(__rpc_handler_71179251), "DeductStabilityServerRpc");
			((NetworkBehaviour)this).__registerRpc(4115492691u, new RpcReceiveHandler(__rpc_handler_4115492691), "ExplodePylonServerRpc");
			((NetworkBehaviour)this).__registerRpc(1838876173u, new RpcReceiveHandler(__rpc_handler_1838876173), "SavePlayerServerRpc");
			((NetworkBehaviour)this).__registerRpc(782292837u, new RpcReceiveHandler(__rpc_handler_782292837), "SavePlayerClientRpc");
			((NetworkBehaviour)this).__registerRpc(3913549475u, new RpcReceiveHandler(__rpc_handler_3913549475), "ExplodePylonClientRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_2647750659(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				PylonMode mode = default(PylonMode);
				((FastBufferReader)(ref reader)).ReadValueSafe<PylonMode>(ref mode, default(ForEnums));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PylonItem)(object)target).ChangeModeServerRpc(mode);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3308591578(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				PylonMode mode = default(PylonMode);
				((FastBufferReader)(ref reader)).ReadValueSafe<PylonMode>(ref mode, default(ForEnums));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PylonItem)(object)target).ChangeModeClientRpc(mode);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2754904381(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool active = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref active, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PylonItem)(object)target).TogglePylonServerRpc(active);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2389651483(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool active = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref active, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PylonItem)(object)target).TogglePylonClientRpc(active);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3751482577(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool overheatingClientRpc = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref overheatingClientRpc, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PylonItem)(object)target).SetOverheatingClientRpc(overheatingClientRpc);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_755763878(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float newStability = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref newStability, default(ForPrimitives));
				bool overheatingState = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref overheatingState, default(ForPrimitives));
				float newCooldown = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref newCooldown, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PylonItem)(object)target).SyncStabilityClientRpc(newStability, overheatingState, newCooldown);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_71179251(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				float amount = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref amount, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PylonItem)(object)target).DeductStabilityServerRpc(amount);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4115492691(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PylonItem)(object)target).ExplodePylonServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1838876173(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerClientId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PylonItem)(object)target).SavePlayerServerRpc(playerClientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_782292837(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int playerClientId = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PylonItem)(object)target).SavePlayerClientRpc(playerClientId);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3913549475(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: 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)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((PylonItem)(object)target).ExplodePylonClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining)]
		protected internal override string __getTypeName()
		{
			return "PylonItem";
		}
	}
	public class BurntCarcassCleanup : MonoBehaviour
	{
		private void Update()
		{
			if ((Object)(object)StartOfRound.Instance != (Object)null && (StartOfRound.Instance.shipIsLeaving || StartOfRound.Instance.inShipPhase))
			{
				Object.Destroy((Object)(object)((Component)this).gameObject);
			}
		}
	}
	[HarmonyPatch(typeof(EnemyAI))]
	internal class EnemyDamagePatch
	{
		[HarmonyPatch("HitEnemyOnLocalClient")]
		[HarmonyPrefix]
		private static void DoublePlayerDamagePrefix(ref int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID)
		{
			if ((Object)(object)playerWhoHit != (Object)null && ((NetworkBehaviour)playerWhoHit).IsOwner)
			{
				int pylonCountInRange = PylonItem.GetPylonCountInRange(playerWhoHit, PylonItem.PylonMode.Damage);
				if (pylonCountInRange > 0)
				{
					force *= 1 + pylonCountInRange;
					PylonItem.DeductDamageBoostStability(playerWhoHit);
				}
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerDamagePatch
	{
		[HarmonyPatch("DamagePlayerFromOtherClientServerRpc")]
		[HarmonyPrefix]
		private static void DoublePlayer2PDamagePrefix(ref int damageAmount, Vector3 hitDirection, int playerWhoHit)
		{
			if (!((Object)(object)GameNetworkManager.Instance != (Object)null) || !((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null))
			{
				return;
			}
			int num = (int)GameNetworkManager.Instance.localPlayerController.playerClientId;
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (playerWhoHit == num)
			{
				int pylonCountInRange = PylonItem.GetPylonCountInRange(localPlayerController, PylonItem.PylonMode.Damage);
				if (pylonCountInRange > 0)
				{
					damageAmount *= 1 + pylonCountInRange;
					PylonItem.DeductDamageBoostStability(localPlayerController);
				}
			}
		}
	}
	[HarmonyPatch(typeof(EnemyAI))]
	internal class EnemyTargetingCloakPatch
	{
		[HarmonyPatch("PlayerIsTargetable")]
		[HarmonyPostfix]
		private static void PreventTargeting(ref bool __result, PlayerControllerB playerScript)
		{
			if (__result && PylonItem.IsPlayerInPylonRange(playerScript, PylonItem.PylonMode.Cloak))
			{
				__result = false;
			}
		}

		[HarmonyPatch("CheckLineOfSightForClosestPlayer")]
		[HarmonyPostfix]
		private static void PreventLineOfSight(ref PlayerControllerB __result)
		{
			if ((Object)(object)__result != (Object)null && PylonItem.IsPlayerInPylonRange(__result, PylonItem.PylonMode.Cloak))
			{
				__result = null;
			}
		}

		[HarmonyPatch("CheckLineOfSightForPlayer")]
		[HarmonyPostfix]
		private static void PreventSpecificLineOfSight(ref PlayerControllerB __result)
		{
			if ((Object)(object)__result != (Object)null && PylonItem.IsPlayerInPylonRange(__result, PylonItem.PylonMode.Cloak))
			{
				__result = null;
			}
		}

		[HarmonyPatch("GetClosestPlayer")]
		[HarmonyPostfix]
		private static void PreventProximity(ref PlayerControllerB __result)
		{
			if ((Object)(object)__result != (Object)null && PylonItem.IsPlayerInPylonRange(__result, PylonItem.PylonMode.Cloak))
			{
				__result = null;
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class DeathProtectionPatch
	{
		[HarmonyPatch("KillPlayer")]
		[HarmonyPrefix]
		priv