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 CruiserTerminal v1.1.4
CruiserTerminal.dll
Decompiled 7 months agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using CruiserTerminal.CTerminal; using CruiserTerminal.Compatibility; using CruiserTerminal.Methods; using CruiserTerminal.NetcodePatcher; using CruiserTerminal.Patches; using GameNetcodeStuff; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using Malfunctions; using Malfunctions.Patches; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [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("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Malfunctions")] [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("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CruiserTerminal")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+6b7ff9e69151a6bb9c357c7a5e7c559e4aef4497")] [assembly: AssemblyProduct("CruiserTerminal")] [assembly: AssemblyTitle("CruiserTerminal")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace CruiserTerminal { internal class CTConfig { internal static ConfigEntry<bool> canDestroy; internal static ConfigEntry<int> maxHealth; internal static ConfigEntry<float> invTime; internal static ConfigEntry<bool> enablePenalty; internal static ConfigEntry<float> penalty; internal static ConfigEntry<bool> canCruiserDamage; internal static ConfigEntry<int> cruiserDamage; internal static void Config(ConfigFile cfg) { canDestroy = cfg.Bind<bool>("Health", "Can be destroyed", true, "Enables cruiser terminal damage"); maxHealth = cfg.Bind<int>("Health", "Maximum terminal health", 2, "Maximum terminal health.\nIf the value is below 1, it will set the value to 2."); invTime = cfg.Bind<float>("Health", "Terminal invulnerability time", 1f, "The terminal's invulnerability time after receiving a hit.\nSetting 0 will result in the possibility of one hit being triggered multiple times.\nIf the value is below 0, it will set the value to 1."); enablePenalty = cfg.Bind<bool>("Health", "Enable penalty for destruction", true, (ConfigDescription)null); penalty = cfg.Bind<float>("Health", "Penalty amount", 0.05f, "Penalty amount.\nIf the value is below 0.01 or above 0.33, it will set the value to 0.05."); canCruiserDamage = cfg.Bind<bool>("Health", "Can cruiser damage terminal", true, "Enables Cruiser Terminal damage from your driving skills."); cruiserDamage = cfg.Bind<int>("Health", "Cruiser damage", 1, "Damage from cruiser to terminal.\nIf the value is below 1, it will set the value to 1."); ConfigCheck(); } internal static void ConfigCheck() { if (maxHealth.Value < 1) { maxHealth.Value = 2; } if (invTime.Value < 0f) { invTime.Value = 1f; } if (penalty.Value < 0.01f || penalty.Value > 0.33f) { penalty.Value = 0.05f; } if (cruiserDamage.Value < 1) { cruiserDamage.Value = 1; } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("mborsh.CruiserTerminal", "CruiserTerminal", "1.1.3")] public class CTPlugin : BaseUnityPlugin { private const string modGUID = "mborsh.CruiserTerminal"; private const string modName = "CruiserTerminal"; private const string modVersion = "1.1.3"; private readonly Harmony harmony = new Harmony("mborsh.CruiserTerminal"); public static ManualLogSource mls; public static AssetBundle mainAssetBundle; private static CTPlugin Instance; public static GameObject terminalPrefab; private static void NetcodePatcher() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } private void Awake() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown NetcodePatcher(); Instance = this; mls = Logger.CreateLogSource("Cruiser Terminal"); mls = ((BaseUnityPlugin)this).Logger; ConfigFile cfg = new ConfigFile(Path.Combine(Paths.ConfigPath, "mborsh.CruiserTerminal.cfg"), true); CTConfig.Config(cfg); if (Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig")) { LethalConfigCompat.LethalConfigSetup(); } if (!LoadAssetBundle()) { mls.LogError((object)"Failed to load asset bundle! Abort mission!"); return; } mls.LogInfo((object)"Cruiser Terminal loaded. Patching."); if (Chainloader.PluginInfos.ContainsKey("com.zealsprince.malfunctions")) { harmony.PatchAll(typeof(MalfunctionsCompat)); } harmony.PatchAll(typeof(CTPatches)); static bool LoadAssetBundle() { mls.LogInfo((object)"Loading AssetBundle..."); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); mainAssetBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "CruiserTerminal")); if ((Object)(object)mainAssetBundle == (Object)null) { return false; } mls.LogInfo((object)("AssetBundle " + ((Object)mainAssetBundle).name + " loaded from " + directoryName + ".")); return true; } } } } namespace CruiserTerminal.Patches { public static class CTPatches { public static CruiserTerminalScript cterminal; [HarmonyPostfix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] private static void AddPrefabsToNetwork() { CTPlugin.terminalPrefab = CTPlugin.mainAssetBundle.LoadAsset<GameObject>("CruiserTerminal.prefab"); CTPlugin.terminalPrefab.AddComponent<CruiserTerminalScript>(); NetworkManager.Singleton.AddNetworkPrefab(CTPlugin.terminalPrefab); } [HarmonyPostfix] [HarmonyPatch(typeof(VehicleController), "Awake")] private static void AwakePatch(VehicleController __instance) { if (__instance.vehicleID == 0) { CTMethods.Init(); CTMethods.Spawn(); } } [HarmonyPostfix] [HarmonyPatch(typeof(VehicleController), "DestroyCarServerRpc")] private static void DestroyCarServerRpcPatch(VehicleController __instance) { if (__instance.vehicleID == 0) { cterminal.TerminalExplosionServerRpc(cterminal.health); } } [HarmonyPostfix] [HarmonyPatch(typeof(VehicleController), "DealDamageServerRpc")] private static void DealDamageServerRpcPatch(VehicleController __instance) { if (__instance.vehicleID == 0) { cterminal.TerminalExplosionServerRpc(CTConfig.cruiserDamage.Value); } } [HarmonyPostfix] [HarmonyPatch(typeof(VehicleController), "OnDisable")] private static void OnDisablePatch(VehicleController __instance) { try { if (__instance.vehicleID == 0) { CTMethods.Despawn(); } } catch { CTPlugin.mls.LogError((object)"Tried to despawn the terminal but it doesn't exist. If nothing broke then everything is ok =)"); } } [HarmonyPostfix] [HarmonyPatch(typeof(Terminal), "SetTerminalInUseClientRpc")] private static void SetTerminalInUsePatch(ref bool ___terminalInUse) { if (!((Object)(object)cterminal == (Object)null)) { cterminal.SetTerminalBusyServerRpc(___terminalInUse); CTPlugin.mls.LogInfo((object)("cruiser terminal interactable:" + !___terminalInUse)); } } [HarmonyPostfix] [HarmonyPatch(typeof(ManualCameraRenderer), "MeetsCameraEnabledConditions")] [HarmonyPriority(0)] private static void MeetsCameraEnabledConditionsPatch(ref bool __result) { if (!((Object)(object)StartOfRound.Instance == (Object)null) && !((Object)(object)cterminal == (Object)null) && cterminal.cruiserTerminalInUse) { __result = true; } } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "ShipHasLeft")] private static void ShipHasLeftPatch() { if (!((Object)(object)cterminal == (Object)null)) { cterminal.SetTerminalBusyServerRpc(busy: false); cterminal.ResetHp(); } } } } namespace CruiserTerminal.Methods { internal class CTMethods { private static bool isSpawned; private static bool isHostOrServer; private static NetworkObject terminalNO; internal static void Init() { isHostOrServer = NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer; isSpawned = false; } internal static void Spawn() { //IL_009d: Unknown result type (might be due to invalid IL or missing references) if (!isSpawned) { if (isHostOrServer) { GameObject val = Object.Instantiate<GameObject>(CTPlugin.terminalPrefab); CTPatches.cterminal = val.GetComponent<CruiserTerminalScript>(); terminalNO = val.GetComponent<NetworkObject>(); terminalNO.Spawn(false); } Object obj = CTPlugin.mainAssetBundle.LoadAsset("terminalPosition.prefab"); GameObject val2 = Object.Instantiate<GameObject>((GameObject)(object)((obj is GameObject) ? obj : null)); ((Object)val2).name = "terminalPosition"; val2.transform.SetParent(GameObject.Find("CompanyCruiser(Clone)").transform); val2.transform.localPosition = new Vector3(1.293f, 0.938f, -3.274f); isSpawned = true; } } internal static void Despawn() { if (isHostOrServer) { terminalNO.Despawn(true); } isSpawned = false; } } } namespace CruiserTerminal.CTerminal { internal class CruiserTerminalPosition : MonoBehaviour { } public class CruiserTerminalScript : NetworkBehaviour, IHittable { private int maxHealth; internal int health; private float invTime; private bool canBeHit; private bool canDestroy; internal bool isDestroyed; private bool punishment; private float penalty; internal bool shipPowerSurge = false; public bool cruiserTerminalInUse; private InteractTrigger interactTrigger; private Transform canvasMainContainer; private float timeSinceLastKeyboardPress; private PlayerActions playerActions; private Transform cruiserTerminal; private Transform cruiserTerminalPos; private Transform terminal; private Terminal terminalScript; private InteractTrigger terminalInteractTrigger; private AudioSource audioSource; private AudioClip enterTerminalAudioClip; private AudioClip exitTerminalAudioClip; private AudioClip[] keyboardAudioClips; private Light terminalLight; private VehicleController cruiserController; bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID) { if (isDestroyed) { return true; } CTPlugin.mls.LogInfo((object)$"Terminal hit! Force: {force}"); TerminalExplosionServerRpc(force); return true; } [ServerRpc(RequireOwnership = false)] internal void TerminalExplosionServerRpc(int force) { //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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(485009299u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, force); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 485009299u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (force <= 0 || !canBeHit || isDestroyed || !canDestroy) { return; } if (canBeHit) { health -= force; ((MonoBehaviour)this).StartCoroutine(InvulnerabilityTime()); } if (health <= 0 && !isDestroyed) { TerminalExplosionClientRpc(punishment); if (punishment) { StartOfRound instance = StartOfRound.Instance; instance.companyBuyingRate -= penalty; StartOfRound.Instance.SyncCompanyBuyingRateServerRpc(); } } } [ClientRpc] private void TerminalExplosionClientRpc(bool punish) { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(365707709u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref punish, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 365707709u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (cruiserTerminalInUse) { QuitCruiserTerminal(); } ((MonoBehaviour)this).StartCoroutine(TerminalMalfunction()); if (punish) { HUDManager.Instance.DisplayTip("Cruiser Terminal", "The Company's property was damaged. You will be punished for this.", false, false, "LC_Tip1"); } isDestroyed = true; } } private IEnumerator TerminalMalfunction() { yield return (object)new WaitForSeconds(0.1f); Landmine.SpawnExplosion(((Component)this).gameObject.transform.position, true, 0f, 2f, 5, 1f, (GameObject)null, false); yield return (object)new WaitForSeconds(0.6f); Landmine.SpawnExplosion(((Component)this).gameObject.transform.position, true, 0f, 3f, 5, 1f, (GameObject)null, false); yield return (object)new WaitForSeconds(1.6f); Landmine.SpawnExplosion(((Component)this).gameObject.transform.position, true, 0f, 3f, 5, 1f, (GameObject)null, false); } private IEnumerator InvulnerabilityTime() { canBeHit = false; yield return (object)new WaitForSeconds(invTime); canBeHit = true; } internal void ResetHp() { maxHealth = CTConfig.maxHealth.Value; health = maxHealth; invTime = CTConfig.invTime.Value; canBeHit = true; canDestroy = CTConfig.canDestroy.Value; isDestroyed = false; punishment = CTConfig.enablePenalty.Value; penalty = CTConfig.penalty.Value; shipPowerSurge = false; } private void Start() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0029: 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) CTConfig.ConfigCheck(); cruiserTerminal = ((Component)this).gameObject.transform; playerActions = new PlayerActions(); MovementActions movement = playerActions.Movement; ((MovementActions)(ref movement)).Enable(); cruiserController = Object.FindAnyObjectByType<VehicleController>(); interactTrigger = ((Component)cruiserTerminal.Find("TerminalTrigger")).gameObject.GetComponent<InteractTrigger>(); ((UnityEvent<PlayerControllerB>)(object)interactTrigger.onInteractEarly).AddListener((UnityAction<PlayerControllerB>)BeginUsingCruiserTerminal); ((UnityEvent<PlayerControllerB>)(object)interactTrigger.onCancelAnimation).AddListener((UnityAction<PlayerControllerB>)SetTerminalNoLongerInUse); terminalScript = Object.FindAnyObjectByType<Terminal>(); terminalInteractTrigger = ((Component)terminalScript).gameObject.GetComponent<InteractTrigger>(); terminal = ((Component)terminalScript).transform.parent.parent; cruiserTerminalPos = ((Component)Object.FindAnyObjectByType<CruiserTerminalPosition>()).transform; cruiserTerminalInUse = false; canvasMainContainer = terminal.Find("Canvas"); audioSource = ((Component)cruiserTerminal.Find("TerminalTrigger/TerminalAudio")).gameObject.GetComponent<AudioSource>(); enterTerminalAudioClip = terminalScript.enterTerminalSFX; exitTerminalAudioClip = terminalScript.leaveTerminalSFX; keyboardAudioClips = terminalScript.keyboardClips; terminalLight = ((Component)cruiserTerminal.Find("terminalLight")).GetComponent<Light>(); ResetHp(); } private void Update() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) cruiserTerminal.position = cruiserTerminalPos.position; cruiserTerminal.rotation = cruiserTerminalPos.rotation; if (cruiserTerminalInUse) { if (((ButtonControl)Keyboard.current.anyKey).wasPressedThisFrame && timeSinceLastKeyboardPress > 0.07f) { timeSinceLastKeyboardPress = 0f; RoundManager.PlayRandomClip(audioSource, keyboardAudioClips, true, 1f, 0, 1000); } timeSinceLastKeyboardPress += Time.deltaTime; } } public void BeginUsingCruiserTerminal(PlayerControllerB nullPlayer) { //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) cruiserController.SetVehicleCollisionForPlayer(false, GameNetworkManager.Instance.localPlayerController); MovementActions movement = playerActions.Movement; ((MovementActions)(ref movement)).OpenMenu.performed += PressESC; if (!isDestroyed) { audioSource.PlayOneShot(enterTerminalAudioClip); SetTerminalBusyServerRpc(busy: true); cruiserTerminalInUse = true; ((MonoBehaviour)this).StartCoroutine(waitUntilFrameEndAndParent(active: true)); terminalScript.BeginUsingTerminal(); CTPlugin.mls.LogInfo((object)"Begin using cruiser terminal."); } } public void QuitCruiserTerminal() { //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) cruiserController.SetVehicleCollisionForPlayer(true, GameNetworkManager.Instance.localPlayerController); MovementActions movement = playerActions.Movement; ((MovementActions)(ref movement)).OpenMenu.performed -= PressESC; if (!isDestroyed) { terminalScript.QuitTerminal(true); } audioSource.PlayOneShot(exitTerminalAudioClip); interactTrigger.StopSpecialAnimation(); } public void SetTerminalNoLongerInUse(PlayerControllerB nullPlayer) { cruiserTerminalInUse = false; SetTerminalBusyServerRpc(busy: false, shipPowerSurge); ((MonoBehaviour)this).StartCoroutine(waitUntilFrameEndAndParent(active: false)); CTPlugin.mls.LogInfo((object)"Stop using cruiser terminal."); } private void PressESC(CallbackContext context) { if (((CallbackContext)(ref context)).performed) { QuitCruiserTerminal(); } } private IEnumerator waitUntilFrameEndAndParent(bool active) { if (active) { canvasMainContainer.SetParent(cruiserTerminal); canvasMainContainer.localPosition = new Vector3(-0.03f, 1.4f, 0.011f); canvasMainContainer.localScale = new Vector3(0.004f, 0.0043f, 0.0016f); canvasMainContainer.localRotation = Quaternion.Euler(new Vector3(0f, 90f, 0f)); } else { canvasMainContainer.SetParent(terminal); canvasMainContainer.localPosition = new Vector3(-0.516f, 0.284f, 1.284f); canvasMainContainer.localScale = new Vector3(0.0015f, 0.0015f, 0.0016f); canvasMainContainer.localRotation = Quaternion.Euler(new Vector3(0f, 78.0969f, 90f)); } yield return (object)new WaitForEndOfFrame(); } [ServerRpc(RequireOwnership = false)] internal void SetTerminalBusyServerRpc(bool busy, bool powerSurge = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00b2: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2309568785u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref busy, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref powerSurge, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2309568785u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; SetTerminalBusyClientRpc(busy, powerSurge); } } } [ClientRpc] internal void SetTerminalBusyClientRpc(bool busy, bool powerSurge) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00b2: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1172566531u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref busy, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref powerSurge, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1172566531u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; CTPlugin.mls.LogInfo((object)$"Set interaction: {busy}, power surge: {powerSurge}"); if (powerSurge) { interactTrigger.interactable = false; terminalInteractTrigger.interactable = false; ((Behaviour)terminalLight).enabled = false; } else { interactTrigger.interactable = !busy; terminalInteractTrigger.interactable = !busy; ((Behaviour)terminalLight).enabled = busy; } } } protected override void __initializeVariables() { ((NetworkBehaviour)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 ((NetworkBehaviour)this).__registerRpc(485009299u, new RpcReceiveHandler(__rpc_handler_485009299), "TerminalExplosionServerRpc"); ((NetworkBehaviour)this).__registerRpc(365707709u, new RpcReceiveHandler(__rpc_handler_365707709), "TerminalExplosionClientRpc"); ((NetworkBehaviour)this).__registerRpc(2309568785u, new RpcReceiveHandler(__rpc_handler_2309568785), "SetTerminalBusyServerRpc"); ((NetworkBehaviour)this).__registerRpc(1172566531u, new RpcReceiveHandler(__rpc_handler_1172566531), "SetTerminalBusyClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_485009299(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 force = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref force); target.__rpc_exec_stage = (__RpcExecStage)1; ((CruiserTerminalScript)(object)target).TerminalExplosionServerRpc(force); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_365707709(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 punish = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref punish, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CruiserTerminalScript)(object)target).TerminalExplosionClientRpc(punish); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2309568785(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_005f: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool busy = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref busy, default(ForPrimitives)); bool powerSurge = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref powerSurge, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CruiserTerminalScript)(object)target).SetTerminalBusyServerRpc(busy, powerSurge); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1172566531(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_005f: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool busy = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref busy, default(ForPrimitives)); bool powerSurge = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref powerSurge, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((CruiserTerminalScript)(object)target).SetTerminalBusyClientRpc(busy, powerSurge); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "CruiserTerminalScript"; } } } namespace CruiserTerminal.Compatibility { internal class LethalConfigCompat { internal static void LethalConfigSetup() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(CTConfig.canDestroy); IntInputFieldConfigItem val2 = new IntInputFieldConfigItem(CTConfig.maxHealth); FloatInputFieldConfigItem val3 = new FloatInputFieldConfigItem(CTConfig.invTime); BoolCheckBoxConfigItem val4 = new BoolCheckBoxConfigItem(CTConfig.enablePenalty); FloatInputFieldConfigItem val5 = new FloatInputFieldConfigItem(CTConfig.penalty); BoolCheckBoxConfigItem val6 = new BoolCheckBoxConfigItem(CTConfig.canCruiserDamage); IntInputFieldConfigItem val7 = new IntInputFieldConfigItem(CTConfig.cruiserDamage); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val2); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val3); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val4); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val5); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val6); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val7); } } internal class MalfunctionsCompat { [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRoundPatches), "HandleLevelStart")] private static void PowerSurgeEvent() { if (((MalfunctionWithTrigger)State.MalfunctionPower).Triggered && (Object)(object)CTPatches.cterminal != (Object)null) { CTPatches.cterminal.shipPowerSurge = true; if (CTPatches.cterminal.cruiserTerminalInUse) { CTPatches.cterminal.QuitCruiserTerminal(); } CTPatches.cterminal.isDestroyed = true; } } [HarmonyPostfix] [HarmonyPatch(typeof(TimeOfDayPatches), "CheckMalfunctionDistortionTrigger")] private static void ElectroMagneticDistortionEvent() { if (((MalfunctionWithTrigger)State.MalfunctionDistortion).Triggered && (Object)(object)CTPatches.cterminal != (Object)null) { CTPatches.cterminal.shipPowerSurge = true; if (CTPatches.cterminal.cruiserTerminalInUse) { CTPatches.cterminal.QuitCruiserTerminal(); } CTPatches.cterminal.isDestroyed = true; } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace CruiserTerminal.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }