Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of UAVDroneMod v1.0.0
UAVDroneMod.dll
Decompiled 18 hours agousing System; using System.Collections; 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 HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [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("")] [assembly: AssemblyCompany("nuke_land")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("UAVDroneMod")] [assembly: AssemblyTitle("UAVDroneMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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 UAVDroneMod { [BepInPlugin("nuke_land.UAVDroneMod", "UAV Drone Mod", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class DronePlugin : BaseUnityPlugin { private Harmony _harmony; private void Awake() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"UAV Drone Mod Loaded!"); _harmony = new Harmony("nuke_land.UAVDroneMod"); _harmony.PatchAll(); } } [HarmonyPatch(typeof(EnemyParent), "Despawn")] internal class PatchEnemyDespawn { private static void Prefix(EnemyParent __instance) { if (__instance.Enemy.HasHealth && __instance.Enemy.Health.healthCurrent <= 0 && __instance.Enemy.Health.spawnValuable) { FieldInfo field = typeof(EnemyParent).GetField("valuableSpawnTimer", BindingFlags.Instance | BindingFlags.NonPublic); if (field != null) { field.SetValue(__instance, 10f); } } } } [HarmonyPatch(typeof(SpectateCamera))] public class SpectateCameraFreeWatchPatches { private static Transform originalSpectatePoint; private static PlayerAvatar currentPlayer; private static bool isPatched; [HarmonyPatch("StateNormal")] [HarmonyPrefix] public static void StateNormal_Prefix(SpectateCamera __instance) { RestoreSpectatePoint(); PlayerAvatar value = Traverse.Create((object)__instance).Field("player").GetValue<PlayerAvatar>(); if (!((Object)(object)value == (Object)null)) { Transform projection = FreeWatchManager.GetProjection(value); if ((Object)(object)projection != (Object)null && ((Component)projection).gameObject.activeInHierarchy && (Object)(object)value.spectatePoint != (Object)null) { currentPlayer = value; originalSpectatePoint = value.spectatePoint; value.spectatePoint = projection; isPatched = true; } } } [HarmonyPatch("StateNormal")] [HarmonyPostfix] public static void StateNormal_Postfix(SpectateCamera __instance) { RestoreSpectatePoint(); PlayerAvatar value = Traverse.Create((object)__instance).Field("player").GetValue<PlayerAvatar>(); if ((Object)(object)value != (Object)null) { Transform projection = FreeWatchManager.GetProjection(value); if ((Object)(object)projection != (Object)null && ((Component)projection).gameObject.activeInHierarchy && new Action<Transform>(SemiFunc.LightManagerSetCullTargetTransform) != null) { SemiFunc.LightManagerSetCullTargetTransform(projection); } } } [HarmonyPatch("PlayerSwitch")] [HarmonyPrefix] public static void PlayerSwitch_Prefix(SpectateCamera __instance) { RestoreSpectatePoint(); PlayerAvatar value = Traverse.Create((object)__instance).Field("player").GetValue<PlayerAvatar>(); if (!((Object)(object)value == (Object)null)) { Transform projection = FreeWatchManager.GetProjection(value); if ((Object)(object)projection != (Object)null && ((Component)projection).gameObject.activeInHierarchy && (Object)(object)value.spectatePoint != (Object)null) { currentPlayer = value; originalSpectatePoint = value.spectatePoint; value.spectatePoint = projection; isPatched = true; } } } [HarmonyPatch("PlayerSwitch")] [HarmonyPostfix] public static void PlayerSwitch_Postfix(SpectateCamera __instance) { RestoreSpectatePoint(); } private static void RestoreSpectatePoint() { if (isPatched && (Object)(object)currentPlayer != (Object)null && (Object)(object)originalSpectatePoint != (Object)null) { currentPlayer.spectatePoint = originalSpectatePoint; currentPlayer = null; originalSpectatePoint = null; isPatched = false; } } } public class CombatDroneBehaviour : MonoBehaviour { private Rigidbody rb; private ItemToggle itemToggle; private Animator animator; private AudioSource propellerSound; private CameraGlitch cameraGlitch; private ItemBattery itemBattery; private PhysGrabObject physGrab; [Header("Движение")] public float constantForwardSpeed = 9.5f; public float boostMultiplier = 1.85f; public float brakeMultiplier = 0.35f; [Header("Управление мышью")] public float yawSpeed = 260f; public float pitchSpeed = 240f; public bool invertMouseY = true; [Header("Крен")] public float rollSpeed = 190f; [Header("Стабилизация")] public float stabilization = 0.87f; [Header("Камера")] public Transform cameraAnchor; [Header("Взрыв")] public float explosionForce = 1400f; public float minCrashSpeed = 11.5f; [Header("Сирена")] public GameObject sirenSourceObject; private AudioSource sirenAudioSource; private Coroutine sirenFadeCoroutine; [Header("Дроп душ")] public PlayerAvatar ownerPlayer; [Header("Возрождение")] public float respawnDelay = 2.5f; public float respawnHeightOffset = 1.8f; public float respawnForwardDistance = 1.4f; [Header("Сигнализация")] public AudioClip criticalSpeedSFX; public AudioSource localUISource; [Header("Обнаружение ценностей (Valuables)")] public float detectionRange = 30f; public float detectionAngle = 120f; private LayerMask valuableMask; private LayerMask obstructMask; [Header("Мини-карта дрона")] public float miniMapSize = 300f; public float miniMapPadding = 20f; public float miniMapCameraHeight = 50f; public float miniMapOrthoSize = 0.45f; private GameObject miniMapPanel; private Camera miniMapCamera; private RenderTexture miniMapRT; private GameObject droneMapIcon; private float lastMapRenderTime; private float mapRenderInterval = 0.05f; private bool wasCritical; private ParticleScriptExplosion particleExplosion; private bool isControlled; private Camera playerCamera; private Transform originalCameraParent; private Vector3 originalCameraPos; private Quaternion originalCameraRot; private GameObject speedUIObject; private TextMeshProUGUI speedText; private GameObject criticalSpeedUIObject; private TextMeshProUGUI criticalSpeedText; private float currentSpeedKmh; private PhotonTransformView photonTransformView; private PhotonRigidbodyView photonRigidbodyView; private float lastSyncTime; private void Awake() { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown rb = ((Component)this).GetComponent<Rigidbody>(); itemToggle = ((Component)this).GetComponent<ItemToggle>(); animator = ((Component)this).GetComponent<Animator>() ?? ((Component)this).GetComponentInChildren<Animator>(); propellerSound = ((Component)this).GetComponent<AudioSource>() ?? ((Component)this).GetComponentInChildren<AudioSource>(); cameraGlitch = ((Component)Camera.main).GetComponent<CameraGlitch>() ?? Object.FindObjectOfType<CameraGlitch>(); itemBattery = ((Component)this).GetComponent<ItemBattery>(); physGrab = ((Component)this).GetComponent<PhysGrabObject>(); valuableMask = LayerMask.op_Implicit(LayerMask.GetMask(new string[3] { "PhysGrabObject", "PhysGrabObjectBoxCollider", "PhysGrabObjectSphereCollider" })); obstructMask = SemiFunc.LayerMaskGetVisionObstruct(); particleExplosion = ((Component)this).GetComponent<ParticleScriptExplosion>() ?? ((Component)this).GetComponentInChildren<ParticleScriptExplosion>(); photonTransformView = ((Component)this).GetComponent<PhotonTransformView>(); photonRigidbodyView = ((Component)this).GetComponent<PhotonRigidbodyView>(); if ((Object)(object)rb != (Object)null) { rb.drag = 1.4f; rb.angularDrag = 5f; } if ((Object)(object)itemToggle != (Object)null) { itemToggle.onToggle.AddListener(new UnityAction(OnToggle)); } if ((Object)(object)sirenSourceObject != (Object)null) { sirenAudioSource = sirenSourceObject.GetComponent<AudioSource>(); if ((Object)(object)sirenAudioSource != (Object)null) { sirenAudioSource.loop = true; sirenAudioSource.spatialBlend = 0f; } } } private void OnToggle() { bool flag = false; if ((Object)(object)physGrab != (Object)null && physGrab.grabbedLocal) { flag = true; } if (!flag && (Object)(object)itemToggle != (Object)null) { try { FieldInfo field = typeof(ItemToggle).GetField("playerTogglePhotonID", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { int num = (int)field.GetValue(itemToggle); PlayerAvatar val = SemiFunc.PlayerAvatarGetFromPhotonID(num); if ((Object)(object)val != (Object)null && val.isLocal) { flag = true; } } } catch { } } if (flag) { if (itemToggle.toggleState && !isControlled) { TakeControl(); } else if (!itemToggle.toggleState && isControlled) { ReleaseControl(); } } } private void TakeControl() { //IL_002c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)itemBattery != (Object)null && itemBattery.batteryLifeInt <= 0) { AssetManager.instance.batteryLowWarning.Play(((Component)this).transform.position, 1f, 1f, 1f, 1f); itemToggle.ToggleItem(false, -1); return; } PhotonView component = ((Component)this).GetComponent<PhotonView>(); if (!((Object)(object)component == (Object)null)) { if (component.IsMine) { ActualTakeControl(); } else if (!PhotonNetwork.IsMasterClient) { component.RPC("RequestDroneControlRPC", (RpcTarget)2, new object[1] { PhotonNetwork.LocalPlayer.ActorNumber }); ((MonoBehaviour)this).StartCoroutine(WaitForOwnershipAndTakeControl()); } else { component.TransferOwnership(PhotonNetwork.MasterClient); ActualTakeControl(); } } } private IEnumerator WaitForOwnershipAndTakeControl() { PhotonView pv = ((Component)this).GetComponent<PhotonView>(); float timeout = 8f; float timer = 0f; float retryInterval = 1f; float nextRetry = retryInterval; while ((Object)(object)pv != (Object)null && !pv.IsMine && timer < timeout) { timer += Time.deltaTime; if (timer >= nextRetry) { pv.RPC("RequestDroneControlRPC", (RpcTarget)2, new object[1] { PhotonNetwork.LocalPlayer.ActorNumber }); nextRetry += retryInterval; } yield return null; } if ((Object)(object)pv != (Object)null && pv.IsMine) { ActualTakeControl(); yield break; } Debug.LogError((object)"[Drone] Failed to get ownership after 8 seconds! Turning off."); if ((Object)(object)itemToggle != (Object)null) { itemToggle.ToggleItem(false, -1); } } [PunRPC] private void RequestDroneControlRPC(int requestingActorNumber, PhotonMessageInfo info) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsMasterClient) { return; } PhotonView component = ((Component)this).GetComponent<PhotonView>(); if (!((Object)(object)component == (Object)null)) { if ((Object)(object)physGrab != (Object)null) { physGrab.playerGrabbing.Clear(); physGrab.grabbed = false; physGrab.grabbedLocal = false; physGrab.heldByLocalPlayer = false; ((Behaviour)physGrab).enabled = false; } if ((Object)(object)rb != (Object)null) { rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; rb.isKinematic = false; rb.useGravity = false; } Player player = PhotonNetwork.CurrentRoom.GetPlayer(requestingActorNumber, false); if (player != null) { component.TransferOwnership(player); } component.RPC("ControlGrantedRPC", (RpcTarget)0, Array.Empty<object>()); } } [PunRPC] private void ControlGrantedRPC() { } [PunRPC] private void ForceReleaseDroneRPC() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)physGrab != (Object)null) { physGrab.playerGrabbing.Clear(); physGrab.grabbed = false; physGrab.grabbedLocal = false; physGrab.heldByLocalPlayer = false; } if ((Object)(object)rb != (Object)null) { rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; rb.isKinematic = false; } } private void ActualTakeControl() { //IL_0084: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) isControlled = true; ReleaseGrab(); rb.useGravity = false; rb.isKinematic = false; if (!PhotonNetwork.IsMasterClient && (Object)(object)photonTransformView != (Object)null) { ((Behaviour)photonTransformView).enabled = false; } playerCamera = Camera.main; if ((Object)(object)playerCamera != (Object)null) { originalCameraParent = ((Component)playerCamera).transform.parent; originalCameraPos = ((Component)playerCamera).transform.localPosition; originalCameraRot = ((Component)playerCamera).transform.localRotation; if ((Object)(object)cameraAnchor != (Object)null) { ((Component)playerCamera).transform.SetParent(cameraAnchor); ((Component)playerCamera).transform.localPosition = Vector3.zero; ((Component)playerCamera).transform.localRotation = Quaternion.Euler(0f, 180f, 0f); } } PlayerController.instance.InputDisable(999f); PlayerController.instance.playerAvatarScript.rotationDisabled = true; if ((Object)(object)ownerPlayer == (Object)null) { ownerPlayer = PlayerController.instance.playerAvatarScript; } CreateSpeedUI(); TriggerGlitch(0.25f); PhotonView component = ((Component)this).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null) { component.RPC("Rpc_StartDrone", (RpcTarget)0, Array.Empty<object>()); } else { StartDroneLocal(); } if ((Object)(object)LightManager.instance != (Object)null) { SemiFunc.LightManagerSetCullTargetTransform(((Component)this).transform); } CreateDroneMiniMap(); if ((Object)(object)component != (Object)null && component.IsMine) { PhotonView component2 = ((Component)ownerPlayer).GetComponent<PhotonView>(); if ((Object)(object)component2 != (Object)null) { component.RPC("RPC_ActivateProjection", (RpcTarget)0, new object[1] { component2.ViewID }); } else { Debug.LogError((object)"У PlayerAvatar нет компонента PhotonView! Невозможно синхронизировать."); } } } private void ReleaseGrab() { //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)physGrab == (Object)null) { return; } PhotonView component = ((Component)this).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null && !PhotonNetwork.IsMasterClient) { component.RPC("ForceReleaseDroneRPC", (RpcTarget)2, Array.Empty<object>()); } PhysGrabber val = null; if ((Object)(object)PlayerController.instance != (Object)null && (Object)(object)PlayerController.instance.playerAvatarScript != (Object)null) { val = ((Component)PlayerController.instance.playerAvatarScript).GetComponent<PhysGrabber>(); } if ((Object)(object)val == (Object)null) { val = Object.FindObjectOfType<PhysGrabber>(); } if ((Object)(object)val != (Object)null) { MethodInfo method = ((object)val).GetType().GetMethod("ReleaseObject", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { try { method.Invoke(val, new object[2] { physGrab.photonView.ViewID, 0.1f }); } catch (Exception ex) { Debug.LogWarning((object)("[Drone] Failed to invoke ReleaseObject: " + ex.Message)); } } else if (physGrab.grabbedLocal) { physGrab.GrabEnded(val); } } try { FieldInfo field = typeof(PhysGrabObject).GetField("playerGrabbing", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { (field.GetValue(physGrab) as IList)?.Clear(); } FieldInfo field2 = typeof(PhysGrabObject).GetField("grabbed", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field2 != null) { field2.SetValue(physGrab, false); } FieldInfo field3 = typeof(PhysGrabObject).GetField("grabbedLocal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field3 != null) { field3.SetValue(physGrab, false); } FieldInfo field4 = typeof(PhysGrabObject).GetField("heldByLocalPlayer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field4 != null) { field4.SetValue(physGrab, false); } } catch { } ((Behaviour)physGrab).enabled = false; if ((Object)(object)rb != (Object)null) { rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; } } [PunRPC] private void Rpc_StartDrone() { if ((Object)(object)rb != (Object)null) { rb.useGravity = false; } StartDroneLocal(); } private void StartDroneLocal() { animator.SetBool("IsSpinning", true); if ((Object)(object)propellerSound != (Object)null) { ((Behaviour)propellerSound).enabled = true; propellerSound.Play(); } PlaySirenWithFade(0.7f, 4.2f); } private void ReleaseControl(bool fromCrash = false) { //IL_0052: 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) isControlled = false; PhotonView component = ((Component)this).GetComponent<PhotonView>(); if ((Object)(object)component == (Object)null || component.IsMine) { if ((Object)(object)playerCamera != (Object)null) { ((Component)playerCamera).transform.SetParent(originalCameraParent); ((Component)playerCamera).transform.localPosition = originalCameraPos; ((Component)playerCamera).transform.localRotation = originalCameraRot; } PlayerController.instance.InputDisable(0f); PlayerController.instance.playerAvatarScript.rotationDisabled = false; DestroySpeedUI(); CleanupDroneMiniMap(); CleanupDroneMapIcon(); if ((Object)(object)LightManager.instance != (Object)null && (Object)(object)PlayerAvatar.instance != (Object)null) { SemiFunc.LightManagerSetCullTargetTransform(((Component)PlayerAvatar.instance).transform); } if ((Object)(object)component != (Object)null && component.IsMine) { component.RPC("RPC_DeactivateProjection", (RpcTarget)0, Array.Empty<object>()); } } if ((Object)(object)rb != (Object)null) { rb.useGravity = true; rb.isKinematic = false; } if (!fromCrash) { TriggerGlitch(0.25f); } else { TriggerGlitch(1.25f); } if ((Object)(object)component != (Object)null) { component.RPC("Rpc_StopDrone", (RpcTarget)0, Array.Empty<object>()); component.RPC("Rpc_ResetPhysGrabState", (RpcTarget)0, Array.Empty<object>()); if (!PhotonNetwork.IsMasterClient) { if ((Object)(object)photonTransformView != (Object)null) { ((Behaviour)photonTransformView).enabled = true; } component.RPC("Rpc_ServerTakeControlBack", (RpcTarget)2, Array.Empty<object>()); } } else { StopDroneLocal(); if ((Object)(object)physGrab != (Object)null) { physGrab.playerGrabbing.Clear(); physGrab.grabbed = false; physGrab.grabbedLocal = false; physGrab.heldByLocalPlayer = false; ((Behaviour)physGrab).enabled = true; } } } [PunRPC] private void RPC_ActivateProjection(int ownerViewID) { PhotonView val = PhotonView.Find(ownerViewID); if ((Object)(object)val != (Object)null) { PlayerAvatar component = ((Component)val).GetComponent<PlayerAvatar>(); if ((Object)(object)component != (Object)null) { ownerPlayer = component; FreeWatchManager.ActivateProjection(ownerPlayer, ((Component)this).transform); } } } [PunRPC] private void RPC_DeactivateProjection() { if ((Object)(object)ownerPlayer != (Object)null) { FreeWatchManager.DeactivateProjection(ownerPlayer); } ownerPlayer = null; } private IEnumerator TransferOwnershipToServer(PhotonView pv) { pv.TransferOwnership(PhotonNetwork.MasterClient); float timeout = 3f; float timer = 0f; while (pv.IsMine && timer < timeout) { timer += Time.deltaTime; yield return null; } if (pv.IsMine) { Debug.LogWarning((object)"[Drone] Failed to transfer ownership back to server!"); if ((Object)(object)photonTransformView != (Object)null) { ((Behaviour)photonTransformView).enabled = true; } } } [PunRPC] private void Rpc_ServerTakeControlBack(PhotonMessageInfo info) { //IL_00a5: 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) if (PhotonNetwork.IsMasterClient) { PhotonView component = ((Component)this).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null && !component.IsMine) { component.TransferOwnership(PhotonNetwork.MasterClient); } if ((Object)(object)physGrab != (Object)null) { physGrab.playerGrabbing.Clear(); physGrab.grabbed = false; physGrab.grabbedLocal = false; physGrab.heldByLocalPlayer = false; ((Behaviour)physGrab).enabled = true; } if ((Object)(object)rb != (Object)null) { rb.isKinematic = false; rb.useGravity = true; rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; } } } [PunRPC] private void Rpc_StopDrone() { if ((Object)(object)rb != (Object)null) { rb.useGravity = true; } StopDroneLocal(); } [PunRPC] private void Rpc_ResetPhysGrabState() { //IL_007a: 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) if ((Object)(object)physGrab != (Object)null) { physGrab.playerGrabbing.Clear(); physGrab.grabbed = false; physGrab.grabbedLocal = false; physGrab.heldByLocalPlayer = false; ((Behaviour)physGrab).enabled = true; } if ((Object)(object)rb != (Object)null) { rb.isKinematic = false; rb.useGravity = true; rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; } } private void StopDroneLocal() { animator.SetBool("IsSpinning", false); if ((Object)(object)propellerSound != (Object)null) { propellerSound.Stop(); } StopSirenWithFade(1f); } private void FixedUpdate() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) if (!isControlled || (Object)(object)rb == (Object)null) { return; } PhotonView component = ((Component)this).GetComponent<PhotonView>(); if (!((Object)(object)component != (Object)null) || component.IsMine) { if (rb.isKinematic) { rb.isKinematic = false; } float num = Input.GetAxis("Mouse X") * yawSpeed * Time.fixedDeltaTime; float num2 = Input.GetAxis("Mouse Y") * pitchSpeed * Time.fixedDeltaTime; if (invertMouseY) { num2 = 0f - num2; } rb.AddTorque(((Component)this).transform.up * num, (ForceMode)5); rb.AddTorque(-((Component)this).transform.right * num2, (ForceMode)5); float num3 = 0f; if (Input.GetKey((KeyCode)101)) { num3 = -1f; } if (Input.GetKey((KeyCode)113)) { num3 = 1f; } rb.AddTorque(((Component)this).transform.forward * num3 * rollSpeed, (ForceMode)5); Vector3 forward = ((Component)this).transform.forward; float num4 = constantForwardSpeed; if (Input.GetKey((KeyCode)119)) { num4 *= boostMultiplier; } if (Input.GetKey((KeyCode)115)) { num4 *= brakeMultiplier; } rb.AddForce(forward * num4, (ForceMode)5); Rigidbody obj = rb; obj.angularVelocity *= stabilization; Vector3 velocity = rb.velocity; currentSpeedKmh = ((Vector3)(ref velocity)).magnitude * 3.6f; if (!PhotonNetwork.IsMasterClient && Time.time - lastSyncTime > 0.05f) { component.RPC("Rpc_SyncDronePhysics", (RpcTarget)2, new object[4] { rb.position, rb.rotation, rb.velocity, rb.angularVelocity }); lastSyncTime = Time.time; } if (Input.GetKeyDown((KeyCode)102)) { itemToggle.ToggleItem(false, -1); ReleaseControl(); ((MonoBehaviour)this).StartCoroutine(RespawnAfterDelay()); } if (Time.frameCount % 8 == 0) { SemiFunc.EnemyInvestigate(((Component)this).transform.position, 12f, false); } } } [PunRPC] private void Rpc_SyncDronePhysics(Vector3 pos, Quaternion rot, Vector3 vel, Vector3 angVel) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (PhotonNetwork.IsMasterClient) { rb.position = pos; rb.rotation = rot; rb.velocity = vel; rb.angularVelocity = angVel; } } private void Update() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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) if (!isControlled || (Object)(object)speedText == (Object)null) { return; } Vector3 velocity = rb.velocity; currentSpeedKmh = ((Vector3)(ref velocity)).magnitude * 3.6f; float num = minCrashSpeed * 3.6f; bool flag = currentSpeedKmh >= num; ((TMP_Text)speedText).text = $"{currentSpeedKmh:F0} <size=22>km/h</size>"; if (flag) { ((Graphic)speedText).color = Color.red; } else { ((Graphic)speedText).color = new Color(0.9f, 0.95f, 1f); } if ((Object)(object)criticalSpeedText != (Object)null) { if (flag) { bool flag2 = Mathf.FloorToInt(Time.time * 8f) % 2 == 0; ((Component)criticalSpeedText).gameObject.SetActive(flag2); if (flag2) { PhotonView component = ((Component)this).GetComponent<PhotonView>(); if (((Object)(object)component == (Object)null || component.IsMine) && (Object)(object)localUISource != (Object)null && (Object)(object)criticalSpeedSFX != (Object)null) { localUISource.PlayOneShot(criticalSpeedSFX); } } } else { ((Component)criticalSpeedText).gameObject.SetActive(false); } } wasCritical = flag; if (Time.frameCount % 10 == 0) { DetectValuables(); } UpdateDroneMiniMap(); } private void OnCollisionEnter(Collision collision) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!isControlled) { return; } if (!IsEnemy(collision.gameObject)) { Vector3 relativeVelocity = collision.relativeVelocity; if (!(((Vector3)(ref relativeVelocity)).magnitude > minCrashSpeed)) { return; } } Explode(); } private void OnTriggerEnter(Collider other) { if (isControlled && ((Object)(object)((Component)other).GetComponent<HurtCollider>() != (Object)null || IsEnemy(((Component)other).gameObject))) { Explode(); } } public void Explode() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (isControlled) { PhotonView component = ((Component)this).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null) { component.RPC("Rpc_Explode", (RpcTarget)0, new object[1] { ((Component)this).transform.position }); } else { ExplodeLogic(((Component)this).transform.position); } } } [PunRPC] private void Rpc_Explode(Vector3 pos) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)particleExplosion != (Object)null) { if ((Object)(object)ownerPlayer != (Object)null) { particleExplosion.playerCausingHurtOverride = ownerPlayer; } particleExplosion.playerHitFullRuckusOverride = true; particleExplosion.Spawn(pos, 1.95f, 250, 600, 1.6f, false, false, 1.9f); } PhotonView component = ((Component)this).GetComponent<PhotonView>(); if (component.IsMine) { TriggerGlitch(1.6f); } if ((Object)(object)component == (Object)null || component.IsMine) { ReleaseControl(fromCrash: true); DrainBattery(); ((MonoBehaviour)this).StartCoroutine(RespawnAfterDelay()); } } private void ExplodeLogic(Vector3 pos) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)particleExplosion != (Object)null) { if ((Object)(object)ownerPlayer != (Object)null) { particleExplosion.playerCausingHurtOverride = ownerPlayer; } particleExplosion.playerHitFullRuckusOverride = true; particleExplosion.Spawn(pos, 1.95f, 250, 600, 1.6f, false, false, 1.9f); } TriggerGlitch(1.6f); PhotonView component = ((Component)this).GetComponent<PhotonView>(); if ((Object)(object)component == (Object)null || component.IsMine) { ReleaseControl(fromCrash: true); DrainBattery(); ((MonoBehaviour)this).StartCoroutine(RespawnAfterDelay()); } } private void DrainBattery() { if (!((Object)(object)itemBattery == (Object)null)) { PhotonView component = ((Component)this).GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null && !PhotonNetwork.IsMasterClient) { component.RPC("Rpc_DrainBattery", (RpcTarget)2, Array.Empty<object>()); } else { itemBattery.RemoveFullBar(1); } } } [PunRPC] private void Rpc_DrainBattery() { if ((Object)(object)itemBattery != (Object)null) { itemBattery.RemoveFullBar(1); } } private bool IsEnemy(GameObject obj) { if ((Object)(object)obj == (Object)null) { return false; } if ((Object)(object)obj.GetComponent<EnemyParent>() != (Object)null || (Object)(object)obj.GetComponentInParent<EnemyParent>() != (Object)null) { return true; } Transform val = obj.transform; for (int i = 0; i < 6; i++) { if ((Object)(object)val == (Object)null) { break; } if ((Object)(object)((Component)val).GetComponent<EnemyParent>() != (Object)null) { return true; } val = val.parent; } return false; } private void CreateSpeedUI() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_00ad: 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) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0236: 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_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)speedUIObject != (Object)null)) { speedUIObject = new GameObject("DroneSpeedUI"); Canvas val = speedUIObject.AddComponent<Canvas>(); val.renderMode = (RenderMode)0; val.sortingOrder = 9999; GameObject val2 = new GameObject("SpeedText"); speedText = val2.AddComponent<TextMeshProUGUI>(); ((TMP_Text)speedText).transform.SetParent(((Component)val).transform, false); ((TMP_Text)speedText).fontSize = 52f; ((TMP_Text)speedText).alignment = (TextAlignmentOptions)516; ((TMP_Text)speedText).fontStyle = (FontStyles)1; ((TMP_Text)speedText).outlineWidth = 0.35f; ((TMP_Text)speedText).outlineColor = Color32.op_Implicit(Color.black); ((Graphic)speedText).color = new Color(0.9f, 0.95f, 1f); RectTransform component = ((Component)speedText).GetComponent<RectTransform>(); component.anchorMin = new Vector2(1f, 0f); component.anchorMax = new Vector2(1f, 0f); component.pivot = new Vector2(1f, 0f); component.anchoredPosition = new Vector2(-25f, 45f); component.sizeDelta = new Vector2(400f, 100f); criticalSpeedUIObject = new GameObject("CriticalSpeedText"); criticalSpeedText = criticalSpeedUIObject.AddComponent<TextMeshProUGUI>(); ((TMP_Text)criticalSpeedText).transform.SetParent(((Component)val).transform, false); ((TMP_Text)criticalSpeedText).text = "CRITICAL SPEED!"; ((TMP_Text)criticalSpeedText).fontSize = 42f; ((TMP_Text)criticalSpeedText).alignment = (TextAlignmentOptions)514; ((TMP_Text)criticalSpeedText).fontStyle = (FontStyles)1; ((TMP_Text)criticalSpeedText).outlineWidth = 0.4f; ((TMP_Text)criticalSpeedText).outlineColor = Color32.op_Implicit(Color.black); ((Graphic)criticalSpeedText).color = Color.red; ((Component)criticalSpeedText).gameObject.SetActive(false); RectTransform component2 = ((Component)criticalSpeedText).GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0.5f, 0f); component2.anchorMax = new Vector2(0.5f, 0f); component2.pivot = new Vector2(0.5f, 0f); component2.anchoredPosition = new Vector2(0f, 100f); component2.sizeDelta = new Vector2(600f, 80f); } } private void DestroySpeedUI() { if ((Object)(object)speedUIObject != (Object)null) { Object.Destroy((Object)(object)speedUIObject); speedUIObject = null; speedText = null; criticalSpeedText = null; criticalSpeedUIObject = null; } } private void TriggerGlitch(float duration) { if (!((Object)(object)cameraGlitch == (Object)null)) { if (duration < 0.5f) { cameraGlitch.PlayShort(); } else { cameraGlitch.PlayLong(); } } } private void PlaySirenWithFade(float targetVolume, float duration) { if (!((Object)(object)sirenAudioSource == (Object)null)) { if (sirenFadeCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(sirenFadeCoroutine); } sirenAudioSource.volume = 0f; sirenAudioSource.Play(); sirenFadeCoroutine = ((MonoBehaviour)this).StartCoroutine(FadeAudio(sirenAudioSource, targetVolume, duration)); } } private void StopSirenWithFade(float duration) { if (!((Object)(object)sirenAudioSource == (Object)null) && sirenAudioSource.isPlaying) { if (sirenFadeCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(sirenFadeCoroutine); } sirenFadeCoroutine = ((MonoBehaviour)this).StartCoroutine(FadeAudio(sirenAudioSource, 0f, duration, stopAfter: true)); } } private IEnumerator FadeAudio(AudioSource source, float targetVolume, float duration, bool stopAfter = false) { float startVolume = source.volume; float time = 0f; while (time < duration) { time += Time.deltaTime; source.volume = Mathf.Lerp(startVolume, targetVolume, time / duration); yield return null; } source.volume = targetVolume; if (stopAfter && targetVolume <= 0.01f) { source.Stop(); } } private IEnumerator RespawnAfterDelay() { yield return (object)new WaitForSeconds(respawnDelay); if ((Object)(object)ownerPlayer == (Object)null) { ownerPlayer = PlayerController.instance.playerAvatarScript; } Vector3 val = FindBestRespawnPosition(); if ((Object)(object)rb != (Object)null) { rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; } if ((Object)(object)physGrab != (Object)null) { physGrab.Teleport(val, Quaternion.Euler(0f, ((Component)ownerPlayer).transform.eulerAngles.y, 0f)); physGrab.grabDisableTimer = 0.5f; } ((Component)this).transform.position = val; ((Component)this).transform.rotation = Quaternion.Euler(0f, ((Component)ownerPlayer).transform.eulerAngles.y, 0f); if ((Object)(object)rb != (Object)null) { rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; } } private Vector3 FindBestRespawnPosition() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_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_006c: 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_0076: 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_0058: 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_0085: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)ownerPlayer).transform.position; Vector3 forward = ((Component)ownerPlayer).transform.forward; Vector3 val = position + forward * respawnForwardDistance + Vector3.up * respawnHeightOffset; if (IsPositionFree(val, 0.6f)) { return val; } Vector3 val2 = position + Vector3.up * (respawnHeightOffset + 1.2f); if (IsPositionFree(val2, 0.6f)) { return val2; } return ((Component)this).transform.position; } private bool IsPositionFree(Vector3 position, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return !Physics.CheckSphere(position, radius, LayerMask.GetMask(new string[2] { "Default", "PhysGrabObject" }), (QueryTriggerInteraction)1); } private void OnDestroy() { if ((Object)(object)LightManager.instance != (Object)null && (Object)(object)PlayerAvatar.instance != (Object)null && (Object)(object)LightManager.instance.lightCullTarget == (Object)(object)((Component)this).transform) { SemiFunc.LightManagerSetCullTargetTransform(((Component)PlayerAvatar.instance).transform); } } private void CreateDroneMiniMap() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Expected O, but got Unknown //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_021e: 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_024a: 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_0270: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Expected O, but got Unknown //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)miniMapPanel != (Object)null)) { if ((Object)(object)Map.Instance == (Object)null || (Object)(object)Map.Instance.OverLayerParent == (Object)null) { Debug.LogWarning((object)"[Drone] Map.Instance not found, skipping minimap."); return; } int num = 512; miniMapRT = new RenderTexture(num, num, 24, (RenderTextureFormat)0); ((Object)miniMapRT).name = "DroneMiniMapRT"; miniMapRT.antiAliasing = 2; miniMapRT.Create(); GameObject val = new GameObject("DroneMiniMapCamera"); miniMapCamera = val.AddComponent<Camera>(); miniMapCamera.orthographic = true; miniMapCamera.orthographicSize = miniMapOrthoSize; miniMapCamera.clearFlags = (CameraClearFlags)2; miniMapCamera.backgroundColor = new Color(0.05f, 0.05f, 0.08f, 1f); miniMapCamera.targetTexture = miniMapRT; miniMapCamera.depth = -100f; miniMapCamera.nearClipPlane = 0.1f; miniMapCamera.farClipPlane = miniMapCameraHeight + 10f; ((Behaviour)miniMapCamera).enabled = false; miniMapCamera.cullingMask = 1 << ((Component)Map.Instance.OverLayerParent).gameObject.layer; val.transform.rotation = Quaternion.Euler(90f, 0f, 0f); float num2 = miniMapSize + 6f; float num3 = 3f; miniMapPanel = new GameObject("DroneMiniMapPanel"); Canvas val2 = miniMapPanel.AddComponent<Canvas>(); val2.renderMode = (RenderMode)0; val2.sortingOrder = 9997; ((Component)val2).gameObject.AddComponent<CanvasScaler>(); ((Component)val2).gameObject.AddComponent<GraphicRaycaster>(); GameObject val3 = new GameObject("Border"); val3.transform.SetParent(miniMapPanel.transform, false); Image val4 = val3.AddComponent<Image>(); ((Graphic)val4).color = Color.white; RectTransform component = val3.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 0f); component.anchorMax = new Vector2(0f, 0f); component.pivot = new Vector2(0f, 0f); component.anchoredPosition = new Vector2(miniMapPadding, miniMapPadding); component.sizeDelta = new Vector2(num2, num2); GameObject val5 = new GameObject("MapImage"); val5.transform.SetParent(val3.transform, false); RawImage val6 = val5.AddComponent<RawImage>(); val6.texture = (Texture)(object)miniMapRT; ((Graphic)val6).color = Color.white; RectTransform component2 = val5.GetComponent<RectTransform>(); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.offsetMin = new Vector2(num3, num3); component2.offsetMax = new Vector2(0f - num3, 0f - num3); CreateTriangleIndicator(val3.transform, "▼", new Vector2(0.5f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -2f)); CreateTriangleIndicator(val3.transform, "▲", new Vector2(0.5f, 0f), new Vector2(0.5f, 0f), new Vector2(0f, 2f)); CreateTriangleIndicator(val3.transform, "►", new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(2f, 0f)); CreateTriangleIndicator(val3.transform, "◄", new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-2f, 0f)); CreateDroneMapIcon(); miniMapPanel.SetActive(true); } } private void CreateTriangleIndicator(Transform parent, string symbol, Vector2 anchorMin, Vector2 anchorMax, Vector2 offset) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Tri_" + symbol); val.transform.SetParent(parent, false); TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>(); ((TMP_Text)val2).text = symbol; ((TMP_Text)val2).fontSize = 16f; ((TMP_Text)val2).alignment = (TextAlignmentOptions)514; ((Graphic)val2).color = Color.white; ((TMP_Text)val2).outlineWidth = 0.2f; ((TMP_Text)val2).outlineColor = Color32.op_Implicit(Color.black); ((Graphic)val2).raycastTarget = false; ((TMP_Text)val2).fontStyle = (FontStyles)1; RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = anchorMin; component.anchorMax = anchorMax; component.pivot = anchorMax; component.anchoredPosition = offset; component.sizeDelta = new Vector2(24f, 24f); } private void CreateDroneMapIcon() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)droneMapIcon != (Object)null) { return; } droneMapIcon = new GameObject("DroneMapIcon"); droneMapIcon.transform.SetParent(Map.Instance.OverLayerParent); SpriteRenderer val = droneMapIcon.AddComponent<SpriteRenderer>(); Texture2D val2 = new Texture2D(16, 16, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[256]; for (int i = 0; i < 16; i++) { for (int j = 0; j < 16; j++) { float num = ((float)j - 8f) / 8f; float num2 = ((float)i - 8f) / 8f; float num3 = Mathf.Sqrt(num * num + num2 * num2); if (num3 <= 1f) { array[i * 16 + j] = Color.cyan; } else { array[i * 16 + j] = Color.clear; } } } val2.SetPixels(array); val2.Apply(); val.sprite = Sprite.Create(val2, new Rect(0f, 0f, 16f, 16f), new Vector2(0.5f, 0.5f), 100f); val.color = Color.cyan; droneMapIcon.layer = ((Component)Map.Instance.OverLayerParent).gameObject.layer; } private void UpdateDroneMiniMap() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0078: 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_008f: 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) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)miniMapCamera == (Object)null || (Object)(object)Map.Instance == (Object)null || (Object)(object)Map.Instance.OverLayerParent == (Object)null) { return; } Vector3 val = ((Component)this).transform.position * Map.Instance.Scale + Map.Instance.OverLayerParent.position; ((Component)miniMapCamera).transform.position = new Vector3(val.x, Map.Instance.OverLayerParent.position.y + miniMapCameraHeight, val.z); if ((Object)(object)droneMapIcon != (Object)null) { droneMapIcon.transform.position = new Vector3(val.x, Map.Instance.OverLayerParent.position.y + 0.1f, val.z); droneMapIcon.transform.rotation = Quaternion.Euler(90f, 0f, 0f); } if (Time.time - lastMapRenderTime >= mapRenderInterval) { lastMapRenderTime = Time.time; bool activeSelf = Map.Instance.ActiveParent.activeSelf; if (!activeSelf) { Map.Instance.ActiveParent.SetActive(true); } miniMapCamera.Render(); if (!activeSelf) { Map.Instance.ActiveParent.SetActive(false); } } } private void CleanupDroneMapIcon() { if ((Object)(object)droneMapIcon != (Object)null) { Object.Destroy((Object)(object)droneMapIcon); droneMapIcon = null; } } private void CleanupDroneMiniMap() { if ((Object)(object)miniMapCamera != (Object)null) { Object.Destroy((Object)(object)((Component)miniMapCamera).gameObject); } if ((Object)(object)miniMapRT != (Object)null) { miniMapRT.Release(); Object.Destroy((Object)(object)miniMapRT); } if ((Object)(object)miniMapPanel != (Object)null) { Object.Destroy((Object)(object)miniMapPanel); } if ((Object)(object)droneMapIcon != (Object)null) { Object.Destroy((Object)(object)droneMapIcon); } miniMapCamera = null; miniMapRT = null; miniMapPanel = null; droneMapIcon = null; } private void DetectValuables() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = (((Object)(object)cameraAnchor != (Object)null) ? cameraAnchor.position : ((Component)this).transform.position); Collider[] array = Physics.OverlapSphere(val, detectionRange, LayerMask.op_Implicit(valuableMask)); Collider[] array2 = array; RaycastHit val4 = default(RaycastHit); RaycastHit val5 = default(RaycastHit); foreach (Collider val2 in array2) { ValuableObject componentInParent = ((Component)val2).GetComponentInParent<ValuableObject>(); CosmeticWorldObject componentInParent2 = ((Component)val2).GetComponentInParent<CosmeticWorldObject>(); Vector3 val3; if ((Object)(object)componentInParent != (Object)null && !componentInParent.discovered) { val3 = ((Component)componentInParent).transform.position - val; Vector3 normalized = ((Vector3)(ref val3)).normalized; float num = Vector3.Distance(val, ((Component)componentInParent).transform.position); float num2 = Vector3.Angle(((Component)this).transform.forward, normalized); if (num2 < detectionAngle / 2f && Physics.Raycast(val, normalized, ref val4, num) && (Object)(object)((Component)((RaycastHit)(ref val4)).collider).GetComponentInParent<ValuableObject>() == (Object)(object)componentInParent) { componentInParent.Discover((State)0); } } else if ((Object)(object)componentInParent2 != (Object)null && (Object)(object)componentInParent2.discoverCustom != (Object)null && !componentInParent2.discoverCustom.discovered) { val3 = ((Component)componentInParent2).transform.position - val; Vector3 normalized2 = ((Vector3)(ref val3)).normalized; float num3 = Vector3.Distance(val, ((Component)componentInParent2).transform.position); float num4 = Vector3.Angle(((Component)this).transform.forward, normalized2); if (num4 < detectionAngle / 2f && Physics.Raycast(val, normalized2, ref val5, num3) && (Object)(object)((Component)((RaycastHit)(ref val5)).collider).GetComponentInParent<CosmeticWorldObject>() == (Object)(object)componentInParent2) { componentInParent2.discoverCustom.Discover(); } } } } } public class DroneMapExplorer : MonoBehaviour { [Header("Зона проверки дрона")] public Vector3 checkSize = new Vector3(3f, 3f, 3f); private LayerMask mask; private void Start() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) mask = LayerMask.op_Implicit(LayerMask.GetMask(new string[1] { "RoomVolume" })); } private void Update() { //IL_0010: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (Time.frameCount % 12 != 0) { return; } Collider[] array = Physics.OverlapBox(((Component)this).transform.position, checkSize / 2f, ((Component)this).transform.rotation, LayerMask.op_Implicit(mask)); Collider[] array2 = array; foreach (Collider val in array2) { RoomVolume val2 = ((Component)val).GetComponent<RoomVolume>(); if ((Object)(object)val2 == (Object)null) { val2 = ((Component)val).GetComponentInParent<RoomVolume>(); } if ((Object)(object)val2 != (Object)null) { val2.SetExplored(); } } } } public static class FreeWatchManager { private static readonly Dictionary<PlayerAvatar, Transform> _activeProjections = new Dictionary<PlayerAvatar, Transform>(); public static void ActivateProjection(PlayerAvatar alivePlayer, Transform customObject) { if (!((Object)(object)alivePlayer == (Object)null) && !((Object)(object)customObject == (Object)null)) { _activeProjections[alivePlayer] = customObject; } } public static void DeactivateProjection(PlayerAvatar alivePlayer) { if (!((Object)(object)alivePlayer == (Object)null)) { _activeProjections.Remove(alivePlayer); } } public static Transform GetProjection(PlayerAvatar alivePlayer) { if ((Object)(object)alivePlayer != (Object)null && _activeProjections.TryGetValue(alivePlayer, out Transform value)) { return value; } return null; } } }