using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLevelLoader; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace Palinode; [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("local.palinode.moon", "Palinode", "0.1.0")] public sealed class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; internal static SelectableLevel Moon; internal static Exterior World; internal static bool Active { get { if ((Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)Moon != (Object)null) { return (Object)(object)StartOfRound.Instance.currentLevel == (Object)(object)Moon; } return false; } } private void Awake() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; Plugin.onBeforeSetup += Register; new Harmony("local.palinode.moon").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"PALINODE 0.1.0 loaded. Experimental procedural moon; all clients require this DLL."); } private static void Register() { //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Expected O, but got Unknown //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Expected O, but got Unknown //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Moon != (Object)null) { return; } try { SelectableLevel[] source = Resources.FindObjectsOfTypeAll(); SelectableLevel val = source.First((SelectableLevel x) => x.PlanetName.IndexOf("Experimentation", StringComparison.OrdinalIgnoreCase) >= 0); SelectableLevel val2 = ((IEnumerable)source).FirstOrDefault((Func)((SelectableLevel x) => x.PlanetName.IndexOf("Titan", StringComparison.OrdinalIgnoreCase) >= 0)) ?? val; Moon = Object.Instantiate(val); ((Object)Moon).name = "PalinodeLevel"; Moon.PlanetName = "074 Palinode"; Moon.riskLevel = "SS"; Moon.LevelDescription = "POPULATION: awaiting correction.\nAn ocean hangs overhead. Its sun is beneath your feet.\nRISK: SS. Negative tides and hostile wildlife.\nMain entrance and fire exit beside landing site.\nAmber shelters block the tide. Interiors vary.\n"; Moon.minScrap = 26; Moon.maxScrap = 33; Moon.minTotalScrapValue = 0; Moon.maxTotalScrapValue = 10000; Moon.factorySizeMultiplier = 1.3f; Moon.spawnableScrap = ((IEnumerable)val2.spawnableScrap).Select((Func)((SpawnableItemWithRarity x) => new SpawnableItemWithRarity(x.spawnableItem, Math.Max(1, x.rarity)))).ToList(); foreach (SpawnableItemWithRarity item in Moon.spawnableScrap) { if (item.spawnableItem.maxValue >= 150) { item.rarity *= 3; } } Moon.Enemies = new List(val2.Enemies); Moon.maxEnemyPowerCount = 12; Moon.maxOutsideEnemyPowerCount = 12; Moon.maxOutsideDiversityPowerCount = 5; Moon.maxDaytimeEnemyPowerCount = 0; Moon.DaytimeEnemies = new List(); Moon.OutsideEnemies = (from x in source.SelectMany((SelectableLevel x) => x.OutsideEnemies) where (Object)(object)x.enemyType != (Object)null group x by x.enemyType.enemyName into x select x.First() into x where x.enemyType.enemyName == "MouthDog" || x.enemyType.enemyName == "ForestGiant" select x).Select((Func)((SpawnableEnemyWithRarity x) => new SpawnableEnemyWithRarity(x.enemyType, (x.enemyType.enemyName == "MouthDog") ? 80 : 20))).ToList(); if (Moon.OutsideEnemies.Count == 0) { Moon.OutsideEnemies = new List(val2.OutsideEnemies); } Moon.outsideEnemySpawnChanceThroughDay = new AnimationCurve((Keyframe[])(object)new Keyframe[4] { new Keyframe(0f, -3f), new Keyframe(0.15f, 1f), new Keyframe(0.4f, 5f), new Keyframe(1f, 12f) }); Moon.enemySpawnChanceThroughoutDay = new AnimationCurve(val2.enemySpawnChanceThroughoutDay.keys); Moon.spawnableOutsideObjects = (SpawnableOutsideObjectWithRarity[])(object)new SpawnableOutsideObjectWithRarity[0]; Moon.canSpawnMold = false; Moon.randomWeathers = (RandomWeatherWithVariables[])(object)new RandomWeatherWithVariables[0]; Moon.currentWeather = (LevelWeatherType)(-1); Moon.overrideWeather = true; Moon.overrideWeatherType = (LevelWeatherType)(-1); Object.DontDestroyOnLoad((Object)(object)Moon); ExtendedLevel val3 = ScriptableObject.CreateInstance(); val3.SelectableLevel = Moon; ((Object)val3).name = "PalinodeExtendedLevel"; val3.RoutePrice = 1250; val3.OverrideDynamicRiskLevelAssignment = true; val3.GenerateAutomaticConfigurationOptions = false; val3.OverrideCameraFarPlaneDistanceOutside = 450f; Object.DontDestroyOnLoad((Object)(object)val3); ExtendedMod val4 = ExtendedMod.Create("Palinode", "Palinode", (ExtendedContent[])(object)new ExtendedContent[1] { (ExtendedContent)val3 }); Object.DontDestroyOnLoad((Object)(object)val4); if (!PatchedContent.ExtendedMods.Contains(val4)) { PatchedContent.ExtendedMods.Add(val4); } Log.LogInfo((object)"Registered PALINODE: SS / 1250 credits / 26-32 scrap / 2.5x scrap value. Dungeon selection is left to Random_Interiors."); } catch (Exception ex) { Moon = null; Log.LogError((object)("Palinode registration failed: " + ex)); } } } [HarmonyPatch(typeof(RoundManager), "GenerateNewFloor")] internal static class BuildExterior { [HarmonyPriority(800)] private static void Prefix() { if (!Plugin.Active || (Object)(object)Plugin.World != (Object)null) { return; } try { Exterior.Build(); } catch (Exception ex) { Plugin.Log.LogError((object)("Palinode exterior build failed: " + ex)); } } } [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] internal static class ValuableScrap { private static void Prefix(RoundManager __instance, out float? __state) { __state = null; if (Plugin.Active) { __state = __instance.scrapValueMultiplier; __instance.scrapValueMultiplier *= 2.5f; } } private static Exception Finalizer(RoundManager __instance, float? __state, Exception __exception) { if (__state.HasValue) { __instance.scrapValueMultiplier = __state.Value; } return __exception; } } public sealed class Exterior : MonoBehaviour { private readonly List materials = new List(); private readonly List navData = new List(); private readonly List navInstances = new List(); private readonly List navSources = new List(); private readonly List shelters = new List(); private readonly List movingRings = new List(); private EntranceTeleport[] entrances; private Vector3 origin; private Vector3 ramp; private Vector3 forward; private Vector3 right; private Material dark; private Material concrete; private Material ivory; private Material amber; private Material red; private Material ocean; private Material glow; private GameObject sun; private AudioSource hum; private AudioClip tone; private float damageTimer; private float exposure; private float landedAt; private bool anchored; private bool announced; private bool tideWarned; private int lastStage = -1; public static void Build() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) Scene scene = SceneManager.GetSceneByName(Plugin.Moon.sceneName); if (!((Scene)(ref scene)).IsValid() || !((Scene)(ref scene)).isLoaded) { throw new InvalidOperationException("Base exterior scene not loaded."); } EntranceTeleport[] source = (from x in Object.FindObjectsOfType() where ((Component)x).gameObject.scene == scene && x.isEntranceToBuilding select x).ToArray(); if (!source.Any((EntranceTeleport x) => x.entranceId == 0) || !source.Any((EntranceTeleport x) => x.entranceId == 1)) { throw new InvalidOperationException("Expected main and fire entrance components were not found."); } GameObject val = new GameObject("PALINODE_Exterior"); SceneManager.MoveGameObjectToScene(val, scene); Exterior exterior = (Plugin.World = val.AddComponent()); exterior.entrances = source; exterior.Create(scene); } private Material Mat(string name, Color color, bool emissive) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) Shader val = Shader.Find("HDRP/Lit") ?? Shader.Find("Standard"); if ((Object)(object)val == (Object)null) { throw new InvalidOperationException("No compatible surface shader loaded."); } Material val2 = new Material(val); ((Object)val2).name = name; Material val3 = val2; if (val3.HasProperty("_BaseColor")) { val3.SetColor("_BaseColor", color); } if (val3.HasProperty("_Color")) { val3.SetColor("_Color", color); } if (val3.HasProperty("_Smoothness")) { val3.SetFloat("_Smoothness", 0.25f); } if (val3.HasProperty("_Glossiness")) { val3.SetFloat("_Glossiness", 0.25f); } if (emissive) { val3.EnableKeyword("_EMISSION"); val3.EnableKeyword("_EMISSIVE_COLOR_MAP"); if (val3.HasProperty("_EmissiveColor")) { val3.SetColor("_EmissiveColor", color * 3f); } if (val3.HasProperty("_EmissionColor")) { val3.SetColor("_EmissionColor", color * 3f); } } materials.Add(val3); return val3; } private GameObject Shape(string name, PrimitiveType shape, Vector3 pos, Vector3 scale, Material mat, bool solid) { //IL_0000: 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) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Invalid comparison between Unknown and I4 //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) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive(shape); ((Object)val).name = name; val.transform.SetParent(((Component)this).transform, false); val.transform.position = pos; val.transform.localScale = scale; val.GetComponent().sharedMaterial = mat; Collider component = val.GetComponent(); component.enabled = solid; if (solid) { int num = LayerMask.NameToLayer("Room"); if (num >= 0) { val.layer = num; } if ((int)shape == 3) { List list = navSources; NavMeshBuildSource item = default(NavMeshBuildSource); ((NavMeshBuildSource)(ref item)).shape = (NavMeshBuildSourceShape)2; ((NavMeshBuildSource)(ref item)).transform = Matrix4x4.TRS(pos, Quaternion.identity, Vector3.one); ((NavMeshBuildSource)(ref item)).size = scale; ((NavMeshBuildSource)(ref item)).area = 0; list.Add(item); } } return val; } private void Create(Scene scene) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0265: 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_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: 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_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Expected O, but got Unknown //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_057c: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_05c2: Unknown result type (might be due to invalid IL or missing references) //IL_066c: Unknown result type (might be due to invalid IL or missing references) //IL_068a: Unknown result type (might be due to invalid IL or missing references) //IL_068f: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; origin = instance.shipLandingPosition.position; dark = Mat("Obsidian", new Color(0.025f, 0.045f, 0.055f), emissive: false); concrete = Mat("Porcelain concrete", new Color(0.48f, 0.52f, 0.47f), emissive: false); ivory = Mat("Bone", new Color(0.7f, 0.72f, 0.6f), emissive: false); amber = Mat("Shelter amber", new Color(1f, 0.42f, 0.08f), emissive: true); red = Mat("Fire exit red", new Color(0.8f, 0.045f, 0.03f), emissive: true); ocean = Mat("Suspended ocean", new Color(0.06f, 0.18f, 0.21f), emissive: true); glow = Mat("Buried sun", new Color(0.8f, 0.92f, 1f), emissive: true); GameObject[] rootGameObjects = ((Scene)(ref scene)).GetRootGameObjects(); foreach (GameObject val in rootGameObjects) { if ((Object)(object)val == (Object)(object)((Component)this).gameObject) { continue; } Renderer[] componentsInChildren = val.GetComponentsInChildren(true); foreach (Renderer val2 in componentsInChildren) { val2.enabled = false; } Terrain[] componentsInChildren2 = val.GetComponentsInChildren(true); foreach (Terrain val3 in componentsInChildren2) { val3.drawHeightmap = false; val3.drawTreesAndFoliage = false; } Collider[] componentsInChildren3 = val.GetComponentsInChildren(true); foreach (Collider c in componentsInChildren3) { EntranceTeleport[] source = entrances; Func predicate = (EntranceTeleport e) => ((Component)c).transform.IsChildOf(((Component)e).transform) || ((Object)(object)Trigger(e) != (Object)null && ((Component)c).transform.IsChildOf(((Component)Trigger(e)).transform)); if (!source.Any(predicate)) { c.enabled = false; } } } Shape("Black glass basin", (PrimitiveType)3, origin + Vector3.down * 1f, new Vector3(240f, 2f, 240f), dark, solid: true); Shape("Landing island", (PrimitiveType)3, origin + Vector3.down * 0.15f, new Vector3(46f, 0.3f, 46f), concrete, solid: false); Shape("The ocean above", (PrimitiveType)3, origin + Vector3.up * 105f, new Vector3(390f, 2f, 390f), ocean, solid: false); sun = Shape("Sun below the horizon", (PrimitiveType)0, origin + new Vector3(0f, 11f, 108f), new Vector3(22f, 22f, 2f), glow, solid: false); Random random = new Random(74074); for (int num = 0; num < 22; num++) { float num2 = (float)((double)num * Math.PI * 2.0 / 22.0); float num3 = 66 + random.Next(35); float num4 = 18 + random.Next(39); Vector3 val4 = origin + new Vector3(Mathf.Cos(num2) * num3, 104f - num4 / 2f, Mathf.Sin(num2) * num3); Shape("Inverted archive " + num, (PrimitiveType)3, val4, new Vector3(9f, num4, 11f), concrete, solid: false); for (int num5 = 0; num5 < (int)(num4 / 4f); num5++) { Shape("Archive window", (PrimitiveType)3, val4 + new Vector3(0f, num4 / 2f - 3f - (float)(num5 * 4), -5.55f), new Vector3(6f, 0.6f, 0.12f), amber, solid: false); } Shape("Suspension cable", (PrimitiveType)2, val4 + Vector3.up * (num4 / 2f + 2f), new Vector3(0.25f, 2f, 0.25f), ivory, solid: false); } for (int num6 = 0; num6 < 3; num6++) { GameObject val5 = new GameObject("Ocean ripple " + num6); val5.transform.SetParent(((Component)this).transform); val5.transform.position = origin + Vector3.up * (99f - (float)num6 * 1.5f); for (int num7 = 0; num7 < 48; num7++) { float num8 = (float)num7 * (float)Math.PI * 2f / 48f; float num9 = 30 + num6 * 23; GameObject val6 = Shape("Ripple", (PrimitiveType)3, val5.transform.position + new Vector3(Mathf.Cos(num8) * num9, 0f, Mathf.Sin(num8) * num9), new Vector3(3f, 0.2f, 0.45f), glow, solid: false); val6.transform.rotation = Quaternion.Euler(0f, (0f - num8) * 57.29578f, 0f); val6.transform.SetParent(val5.transform, true); } movingRings.Add(val5.transform); } GameObject[] array = (from x in GameObject.FindGameObjectsWithTag("OutsideAINode") where x.scene == scene select x).ToArray(); for (int num10 = 0; num10 < array.Length; num10++) { float num11 = (float)num10 * (float)Math.PI * 2f / (float)Math.Max(1, array.Length); float num12 = 48 + num10 % 4 * 13; array[num10].transform.position = origin + new Vector3(Mathf.Cos(num11) * num12, 0.1f, Mathf.Sin(num11) * num12); } BakeNavMesh(); float[] array2 = new float[22050]; for (int num13 = 0; num13 < array2.Length; num13++) { array2[num13] = 0.12f * Mathf.Sin((float)(num13 * 2) * (float)Math.PI * 92f / 22050f) * (0.65f + 0.35f * Mathf.Sin((float)(num13 * 2) * (float)Math.PI * 4f / 22050f)); } tone = AudioClip.Create("Negative tide warning", array2.Length, 1, 22050, false); tone.SetData(array2, 0); hum = ((Component)this).gameObject.AddComponent(); hum.clip = tone; hum.loop = true; hum.spatialBlend = 0f; hum.volume = 0f; hum.Play(); Plugin.Log.LogInfo((object)("PALINODE basin created; exterior AI nodes: " + array.Length + ". Waiting for ship landing to anchor entrances.")); } private void BakeNavMesh() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) Bounds val = default(Bounds); ((Bounds)(ref val))..ctor(origin, new Vector3(245f, 20f, 245f)); for (int i = 0; i < NavMesh.GetSettingsCount(); i++) { NavMeshBuildSettings settingsByIndex = NavMesh.GetSettingsByIndex(i); NavMeshData val2 = NavMeshBuilder.BuildNavMeshData(settingsByIndex, navSources, val, Vector3.zero, Quaternion.identity); if (!((Object)(object)val2 == (Object)null)) { navData.Add(val2); navInstances.Add(NavMesh.AddNavMeshData(val2)); } } } private void AnchorDoors() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_004e: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: 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_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: 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_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_0245: 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_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) StartOfRound instance = StartOfRound.Instance; ramp = instance.groundOutsideShipSpawnPosition.position; ramp.y = origin.y; Vector3 val = Vector3.ProjectOnPlane(ramp - instance.middleOfShipNode.position, Vector3.up); forward = ((Vector3)(ref val)).normalized; if (((Vector3)(ref forward)).sqrMagnitude < 0.5f) { forward = Vector3.forward; } right = Vector3.Cross(Vector3.up, forward); EntranceTeleport[] array = entrances; foreach (EntranceTeleport val2 in array) { Vector3 val3 = ramp + ((val2.entranceId == 0) ? (forward * 25f) : (right * 15f)); Vector3 val4 = val3 - forward * 1.7f + Vector3.up * 0.3f; Vector3 val5 = val4 - val2.entrancePoint.position; Transform entrancePoint = val2.entrancePoint; bool flag = entrancePoint.IsChildOf(((Component)val2).transform); InteractTrigger val6 = Trigger(val2); Transform val7 = (((Object)(object)val6 != (Object)null) ? ((Component)val6).transform : ((Component)val2).transform); bool flag2 = val7.IsChildOf(((Component)val2).transform); Transform transform = ((Component)val2).transform; transform.position += val5; if (!flag) { entrancePoint.position += val5; } if (!flag2) { val7.position += val5; } entrancePoint.rotation = Quaternion.LookRotation(-forward, Vector3.up); Collider[] componentsInChildren = ((Component)val2).GetComponentsInChildren(true); foreach (Collider val8 in componentsInChildren) { val8.enabled = true; } DoorFrame(val3, val2.entranceId == 0); Shelter(val3 - forward * 2.5f); Vector3 val9 = val3 - ramp; Vector3 normalized = ((Vector3)(ref val9)).normalized; for (float num = 3f; num < Vector3.Distance(val3, ramp) - 2f; num += 2f) { Shape("Route marker", (PrimitiveType)3, ramp + normalized * num + Vector3.up * 0.035f, new Vector3(0.35f, 0.06f, 0.35f), (val2.entranceId == 0) ? amber : red, solid: false); } } Shelter(ramp + forward * 12f); Shelter(ramp + right * 7f); anchored = true; landedAt = Time.time; Plugin.Log.LogInfo((object)"PALINODE doors anchored: main 25 m, fire 15 m from ramp marker. Arrival points 1.7 m in front of door."); } private void DoorFrame(Vector3 p, bool main) { //IL_0023: 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) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_0089: 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_0098: 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_00b1: 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_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) Material mat = (main ? amber : red); GameObject val = Shape(main ? "MAIN ENTRANCE" : "FIRE EXIT", (PrimitiveType)3, p + Vector3.up * 1.6f, new Vector3(2.5f, 3.2f, 0.15f), mat, solid: false); val.transform.rotation = Quaternion.LookRotation(forward); for (int i = -1; i <= 1; i += 2) { Shape("Door pillar", (PrimitiveType)3, p + right * ((float)i * 1.6f) + Vector3.up * 2f, new Vector3(0.5f, 4f, 0.6f), ivory, solid: false); } Shape("Door lintel", (PrimitiveType)3, p + Vector3.up * 4f, new Vector3(4f, 0.7f, 1f), ivory, solid: false).transform.rotation = Quaternion.LookRotation(forward); } private static InteractTrigger Trigger(EntranceTeleport e) { object? value = AccessTools.Field(typeof(EntranceTeleport), "triggerScript").GetValue(e); return (InteractTrigger)((value is InteractTrigger) ? value : null); } private void Shelter(Vector3 p) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0051: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) shelters.Add(p); Shape("Amber refuge floor", (PrimitiveType)3, p + Vector3.up * 0.025f, new Vector3(5f, 0.05f, 5f), amber, solid: false); Shape("Tide shelter canopy", (PrimitiveType)3, p + Vector3.up * 4.2f, new Vector3(6f, 0.4f, 6f), concrete, solid: false); for (int i = -1; i <= 1; i += 2) { for (int j = -1; j <= 1; j += 2) { Shape("Shelter column", (PrimitiveType)2, p + new Vector3((float)i * 2.8f, 2.1f, (float)j * 2.8f), new Vector3(0.22f, 2.1f, 0.22f), ivory, solid: false); } } } private bool Sheltered(PlayerControllerB p) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_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) if (!p.isInHangarShipRoom && !p.isInsideFactory) { Bounds bounds = StartOfRound.Instance.shipBounds.bounds; if (!((Bounds)(ref bounds)).Contains(((Component)p).transform.position)) { foreach (Vector3 shelter in shelters) { Vector3 val = ((Component)p).transform.position - shelter; if (Mathf.Abs(val.x) <= 2.5f && Mathf.Abs(val.z) <= 2.5f) { return true; } } return false; } } return true; } private void Update() { //IL_00d3: 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_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.Active || (Object)(object)StartOfRound.Instance == (Object)null) { return; } StartOfRound instance = StartOfRound.Instance; if (!anchored && instance.shipHasLanded) { AnchorDoors(); } if (!anchored || !instance.shipHasLanded || instance.shipIsLeaving) { if ((Object)(object)hum != (Object)null) { hum.volume = 0f; } return; } PlayerControllerB localPlayerController = instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null || !localPlayerController.isPlayerControlled || localPlayerController.isPlayerDead) { hum.volume = 0f; return; } if (!announced) { HUDManager.Instance.DisplayTip("074 PALINODE / SS", "Main entrance ahead. Fire exit right.\nNegative tides begin after midday. Amber platforms are safe.", false, false, "Palinode"); announced = true; } float normalizedTimeOfDay = TimeOfDay.Instance.normalizedTimeOfDay; NetworkTime serverTime = NetworkManager.Singleton.ServerTime; double time = ((NetworkTime)(ref serverTime)).Time; float num = (float)(time % 72.0); int num2 = ((!(normalizedTimeOfDay < 0.3f)) ? ((num >= 56f) ? 2 : ((num >= 48f) ? 1 : 0)) : 0); if (num2 == 0) { tideWarned = false; } if (num2 == 1) { tideWarned = true; } bool flag = !localPlayerController.isInsideFactory && !localPlayerController.isInHangarShipRoom; if (num2 != lastStage && flag && num2 > 0) { HUDManager.Instance.DisplayTip((num2 == 1) ? "NEGATIVE TIDE IN 8 SECONDS" : "NEGATIVE TIDE", (num2 == 1) ? "Reach an amber shelter or the ship." : "Stay on amber until the ocean quiets.", true, false, "PalinodeTide"); } lastStage = num2; hum.volume = ((!flag || num2 <= 0) ? 0f : ((num2 == 1) ? 0.25f : 0.42f)); foreach (Transform movingRing in movingRings) { movingRing.Rotate(Vector3.up, ((num2 == 2) ? 10f : 1.5f) * Time.deltaTime, (Space)0); } sun.transform.localScale = Vector3.one * (float)((num2 == 2) ? 29 : 22); bool flag2 = num2 == 2 && tideWarned && !Sheltered(localPlayerController) && Time.time - landedAt > 12f; exposure = (flag2 ? (exposure + Time.deltaTime) : 0f); damageTimer += Time.deltaTime; if (damageTimer >= 1f) { damageTimer = 0f; if (flag2 && exposure > 1f && ((NetworkBehaviour)localPlayerController).IsOwner) { localPlayerController.DamagePlayer((normalizedTimeOfDay >= 0.65f) ? 25 : 20, true, true, (CauseOfDeath)13, 0, false, Vector3.zero); } if (!localPlayerController.isInsideFactory && ((Component)localPlayerController).transform.position.y < origin.y - 12f && ((NetworkBehaviour)localPlayerController).IsOwner) { localPlayerController.DamagePlayer(100, true, true, (CauseOfDeath)2, 0, false, Vector3.zero); } } } private void OnDestroy() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) foreach (NavMeshDataInstance navInstance in navInstances) { NavMeshDataInstance current = navInstance; if (((NavMeshDataInstance)(ref current)).valid) { ((NavMeshDataInstance)(ref current)).Remove(); } } foreach (NavMeshData navDatum in navData) { Object.Destroy((Object)(object)navDatum); } foreach (Material material in materials) { Object.Destroy((Object)(object)material); } if ((Object)(object)tone != (Object)null) { Object.Destroy((Object)(object)tone); } if ((Object)(object)Plugin.World == (Object)(object)this) { Plugin.World = null; } } }