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 Company Globes v1.2.2
plugins/GlobeScrap.dll
Decompiled a month 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 BepInEx.Bootstrap; using Chameleon.Patches; using Dawn; using Dawn.Utils; using Dusk; using GlobeScrap.Behaviours; using GlobeScrap.Configs; using GlobeScrap.NetcodePatcher; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("CelestialTint")] [assembly: IgnoresAccessChecksTo("Chameleon")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("GlobeScrap")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1")] [assembly: AssemblyProduct("GlobeScrap")] [assembly: AssemblyTitle("GlobeScrap")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace GlobeScrap { internal static class GlobeBuilder { public const string celestialTint_GUID = "CelestialTint"; public const string chameleon_GUID = "butterystancakes.lethalcompany.chameleon"; public const string artificeBlizzard_GUID = "butterystancakes.lethalcompany.artificeblizzard"; private static int previousLevelID = -1; private static GameObject planetStorage; private static GameObject planetObject; public static List<PresetMoon> registeredMoons = new List<PresetMoon>(); private static bool ChameleonEnabled; private static bool SnowyArtEnabled; private static bool CelestialTintEnabled; private static Mesh planetMesh; private static Material artificeMatReference; private static Material embrionMatReference; private static Material gordionMatReference; private static Material desertMatReference; private static Material forestMatReference; private static Material snowyMatReference; public static void Initialise() { AssetBundle val = AssetBundleUtils.LoadBundle(Assembly.GetExecutingAssembly(), "globeimages"); desertMatReference = val.LoadAsset<Material>("Assets/LethalCompany/Mods/CompanyGlobes/Assets/DesertPlanet.mat"); forestMatReference = val.LoadAsset<Material>("Assets/LethalCompany/Mods/CompanyGlobes/Assets/ForestPlanet.mat"); snowyMatReference = val.LoadAsset<Material>("Assets/LethalCompany/Mods/CompanyGlobes/Assets/SnowPlanet.mat"); gordionMatReference = val.LoadAsset<Material>("Assets/LethalCompany/Mods/CompanyGlobes/Assets/OceanPlanet.mat"); planetMesh = val.LoadAsset<Mesh>("Assets/LethalCompany/Mods/CompanyGlobes/Assets/PlanetMesh.asset"); ((Registry<DawnMoonInfo>)(object)LethalContent.Moons).OnFreeze += delegate { RegisterCompatibilities(); MakePlanetStorage(); registeredMoons = MoonConfig.BuildMoonConfig(); }; } private static void RegisterCompatibilities() { ChameleonEnabled = Chainloader.PluginInfos.ContainsKey("butterystancakes.lethalcompany.chameleon"); SnowyArtEnabled = Chainloader.PluginInfos.ContainsKey("butterystancakes.lethalcompany.artificeblizzard"); if (Chainloader.PluginInfos.ContainsKey("CelestialTint")) { CelestialTintEnabled = CheckCT(); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static bool CheckCT() { try { return !CelestialTint.ModConfig.VanillaMode.Value; } catch { return false; } } private static void MakePlanetStorage() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) planetStorage = new GameObject("planetStorage"); planetObject = new GameObject(); planetObject.transform.parent = planetStorage.transform; planetStorage.transform.position = new Vector3(0f, -10f, 1012f); previousLevelID = -1; } public static GameObject Build(SelectableLevel level) { if ((Object)(object)planetStorage == (Object)null) { MakePlanetStorage(); } if (previousLevelID != level.levelID) { previousLevelID = level.levelID; if (BuildPrefabbedPlanets(level)) { return planetObject; } if (CelestialTintEnabled || !BuildFromPrefab(level)) { BuildFromLevelTag(level); } } return planetObject; } private static bool BuildPrefabbedPlanets(SelectableLevel level) { switch (TrimPlanetName(level.PlanetName)) { case "Artifice": if (SnowyArtEnabled) { PresetMoon(snowyMatReference); return true; } if (ChameleonEnabled) { if ((Object)(object)artificeMatReference == (Object)null) { artificeMatReference = GetArtMat(); if ((Object)(object)artificeMatReference != (Object)null) { artificeMatReference.SetFloat("_Metallic", 0f); artificeMatReference.SetFloat("_Smoothness", 0.25f); artificeMatReference.SetFloat("_NormalScale", 0.05f); } } if ((Object)(object)artificeMatReference != (Object)null) { PresetMoon(artificeMatReference); return true; } } PresetMoon(forestMatReference); return true; case "Embrion": if (!ChameleonEnabled) { break; } if ((Object)(object)embrionMatReference == (Object)null) { embrionMatReference = GetEmbMat(); if ((Object)(object)embrionMatReference != (Object)null) { embrionMatReference.SetFloat("_Metallic", 0f); embrionMatReference.SetFloat("_Smoothness", 0.25f); embrionMatReference.SetFloat("_NormalScale", 0.05f); } } if ((Object)(object)embrionMatReference != (Object)null) { PresetMoon(embrionMatReference); } return true; case "Gordion": case "Liquidation": PresetMoon(gordionMatReference); return true; } return false; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static Material GetArtMat() { try { return PlanetPreviewPatches.artificeMat; } catch { return null; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static Material GetEmbMat() { try { return PlanetPreviewPatches.embrionMat; } catch { return null; } } private static bool BuildFromPrefab(SelectableLevel level) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00ee: Unknown result type (might be due to invalid IL or missing references) PresetMoon presetMoon = registeredMoons.Find((PresetMoon x) => x.name == TrimPlanetName(level.PlanetName)); if (CopyFromPrefab(level.planetPrefab.transform, presetMoon?.positionInPrefab ?? 0)) { planetObject.transform.localPosition = ((presetMoon == null || !presetMoon.positionOffset.HasValue) ? Vector3.zero : presetMoon.positionOffset.Value); planetObject.transform.localRotation = ((presetMoon == null || !presetMoon.rotationOffset.HasValue) ? Quaternion.identity : Quaternion.Euler(presetMoon.rotationOffset.Value)); if (presetMoon != null && presetMoon.scale.HasValue) { Transform transform = planetObject.transform; transform.localScale *= presetMoon.scale.Value; } planetObject.layer = 6; return true; } return false; } public static string TrimPlanetName(string name) { return name.TrimStart(' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-'); } private static void BuildFromLevelTag(SelectableLevel level) { foreach (NamespacedKey item in ((DawnBaseInfo<DawnMoonInfo>)(object)SelectableLevelExtensions.GetDawnInfo(level)).AllTags()) { switch (item.Key) { case "desert": case "canyon": case "wasteland": case "volcanic": case "rocky": case "argon": PresetMoon(desertMatReference); return; case "forest": case "valley": case "marsh": PresetMoon(forestMatReference); return; case "tundra": case "snow": PresetMoon(snowyMatReference); return; case "company": case "ocean": PresetMoon(gordionMatReference); return; } } PresetMoon(forestMatReference); } private static void PresetMoon(Material overrideMaterial) { //IL_0051: 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) //IL_007b: Unknown result type (might be due to invalid IL or missing references) MeshFilter val = planetObject.GetComponent<MeshFilter>() ?? planetObject.AddComponent<MeshFilter>(); val.mesh = planetMesh; MeshRenderer val2 = planetObject.GetComponent<MeshRenderer>() ?? planetObject.AddComponent<MeshRenderer>(); ((Renderer)val2).material = overrideMaterial; planetObject.transform.localPosition = Vector3.zero; planetObject.transform.localRotation = Quaternion.identity; planetObject.transform.localScale = Vector3.one; } private static bool CopyFromPrefab(Transform reference, int prefabPosition) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00a3: 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) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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) MeshFilter[] componentsInChildren = ((Component)reference).GetComponentsInChildren<MeshFilter>(); Transform transform = ((Component)componentsInChildren[prefabPosition]).transform; ((Object)planetObject).name = ((Object)transform).name; MeshFilter component = ((Component)transform).GetComponent<MeshFilter>(); MeshRenderer component2 = ((Component)transform).GetComponent<MeshRenderer>(); if ((Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null) { CopyMeshFilter(component, planetObject.gameObject); CopyMeshRenderer(component2, planetObject.gameObject); float[] array = new float[3]; Bounds bounds = component.mesh.bounds; array[0] = ((Bounds)(ref bounds)).size.x; bounds = component.mesh.bounds; array[1] = ((Bounds)(ref bounds)).size.y; bounds = component.mesh.bounds; array[2] = ((Bounds)(ref bounds)).size.z; float num = 2f / Mathf.Max(array); planetObject.transform.localScale = Vector3.one * num; Transform transform2 = planetObject.transform; bounds = component.mesh.bounds; transform2.position = -((Bounds)(ref bounds)).center * num; return true; } return false; } private static void CopyMeshFilter(MeshFilter original, GameObject destination) { MeshFilter val = destination.GetComponent<MeshFilter>() ?? destination.AddComponent<MeshFilter>(); val.mesh = original.sharedMesh; } private static void CopyMeshRenderer(MeshRenderer original, GameObject destination) { MeshRenderer val = destination.GetComponent<MeshRenderer>() ?? destination.AddComponent<MeshRenderer>(); ((Renderer)val).materials = ((Renderer)original).sharedMaterials; ((Renderer)val).material.SetFloat("_Metallic", 0f); ((Renderer)val).material.SetFloat("_Smoothness", 0.25f); ((Renderer)val).material.SetFloat("_NormalScale", 0.05f); } } internal class GlobeContentHandler : ContentHandler<GlobeContentHandler> { public GlobeContentHandler(DuskMod mod) : base(mod) { DefaultBundle val = default(DefaultBundle); ((ContentHandler)this).RegisterContent<DefaultBundle>("globescrap", ref val, true); ((ContentHandler)this).RegisterContent<DefaultBundle>("globefurniture", ref val, true); } } [BepInPlugin("CompanyGlobes", "CompanyGlobes", "1.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string DawnDep = "com.github.teamxiaolan.dawnlib"; public const string PLUGIN_GUID = "CompanyGlobes"; public const string PLUGIN_NAME = "CompanyGlobes"; public const string PLUGIN_VERSION = "1.2.0"; internal static Harmony Harmony { get; set; } public static DuskMod Mod { get; private set; } private void Awake() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown AssetBundle val = AssetBundleUtils.LoadBundle(Assembly.GetExecutingAssembly(), "globemain"); Mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val); Mod.RegisterContentHandlers(); GlobeBuilder.Initialise(); if (Harmony == null) { Harmony = new Harmony("PlanetSwapPatch"); } Harmony.PatchAll(typeof(ChangeLevelPatch)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin GlobeScrap is loaded!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "GlobeScrap"; public const string PLUGIN_NAME = "GlobeScrap"; public const string PLUGIN_VERSION = "1.1.1"; } } namespace GlobeScrap.Configs { internal class MoonConfig { private static readonly List<PresetMoon> presetMoons = new List<PresetMoon>(39) { new PresetMoon("Assurance", 1), new PresetMoon("Asteroid-13", 44, null, null, 0.67f), new PresetMoon("Awakening", 2), new PresetMoon("Bilge", 1), new PresetMoon("Calist", 1, (Vector3?)null, (Vector3?)new Vector3(0f, 90f, 0f), (float?)0.95f), new PresetMoon("Cubatres", 0, (Vector3?)null, (Vector3?)new Vector3(316.6853f, 143.8695f, 272.1489f), (float?)0.67f), new PresetMoon("Chronos", 1), new PresetMoon("Core", 1), new PresetMoon("Desolation", 0, null, null, 0.67f), new PresetMoon("Duckstroid-14", 1, (Vector3?)new Vector3(-0.0026f, -0.32f, -1.001f), (Vector3?)null, (float?)null), new PresetMoon("Espira", 1), new PresetMoon("Experimentation", 1), new PresetMoon("Faith", 1), new PresetMoon("Filitrios", 1), new PresetMoon("Gratar", 1), new PresetMoon("Hope", 113), new PresetMoon("Hyve", 19, null, null, 0.67f), new PresetMoon("Impact", 112), new PresetMoon("Infernis", 2), new PresetMoon("Kanie", 1), new PresetMoon("Kiln", 1), new PresetMoon("Kiri", 1), new PresetMoon("Lecaro", 0, null, null, 0.67f), new PresetMoon("Lithium", 1), new PresetMoon("Lua", 1), new PresetMoon("Navel", 113), new PresetMoon("Obscura", 1), new PresetMoon("Offense", 1), new PresetMoon("Oxyde", 0, (Vector3?)null, (Vector3?)new Vector3(0f, 0f, 90f), (float?)null), new PresetMoon("Outpost 31", 0, (Vector3?)null, (Vector3?)new Vector3(90f, 0f, 0f), (float?)null), new PresetMoon("Praetor", 1), new PresetMoon("Perplexing", 2), new PresetMoon("Phobos / Deimos", 11), new PresetMoon("Repose", 2), new PresetMoon("Row", 1), new PresetMoon("Spring", 113), new PresetMoon("Terra", 1), new PresetMoon("Trial", 112), new PresetMoon("Wistful", 1) }; public static List<PresetMoon> BuildMoonConfig() { List<PresetMoon> list = new List<PresetMoon>(); foreach (KeyValuePair<NamespacedKey<DawnMoonInfo>, DawnMoonInfo> item in (Registry<DawnMoonInfo>)(object)LethalContent.Moons) { if (!(item.Value.GetNumberlessPlanetName() == string.Empty)) { MeshFilter[] componentsInChildren = item.Value.Level.planetPrefab.GetComponentsInChildren<MeshFilter>(); string planetName = GlobeBuilder.TrimPlanetName(((Registry<DawnMoonInfo>)(object)LethalContent.Moons)[item.Key].Level.PlanetName); PresetMoon presetMoon = presetMoons.Find((PresetMoon x) => x.name == planetName); if (presetMoon != null) { list.Add(presetMoon); } } } return list; } } public class PresetMoon(string name, int positionInPrefab, Vector3? positionOffset = null, Vector3? rotationOffset = null, float? scale = null) { public string name = name; public int positionInPrefab = positionInPrefab; public Vector3? positionOffset = positionOffset; public Vector3? rotationOffset = rotationOffset; public float? scale = scale; } } namespace GlobeScrap.Behaviours { public static class ChangeLevelPatch { [HarmonyPatch(typeof(StartOfRound), "ChangeLevel")] [HarmonyPostfix] public static void ChangeLevel() { GlobeFurniture.ChangePlanet(); } } public class GlobeBehaviour : GrabbableObject { public Transform planetContainer; public float spinSpeed = 8f; public AnimationCurve spinDecceleration; private bool isSpinning; private float spinTime; private int planetID; private bool isSet = false; private static bool? _PoltergeistCompact; private static bool PoltergeistCompact { get { bool valueOrDefault = _PoltergeistCompact == true; if (!_PoltergeistCompact.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("coderCleric.Poltergeist"); _PoltergeistCompact = valueOrDefault; } return _PoltergeistCompact.Value; } } public override void Start() { ((GrabbableObject)this).Start(); ((MonoBehaviour)this).StartCoroutine(WaitForID()); if (!isSet && ((NetworkBehaviour)this).IsServer) { SyncPlanetIDRpc(); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private void AddPoltergeistTrigger() { } [Rpc(/*Could not decode attribute arguments.*/)] private void SyncPlanetIDRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_0043: 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_0051: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(910179441u, val3, val, (SendTo)7, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 910179441u, val3, val, (SendTo)7, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; planetID = StartOfRound.Instance.currentLevelID; isSet = true; } } } private IEnumerator WaitForID() { while (!isSet) { yield return null; } yield return (object)new WaitForSeconds(2f); InitializeItem(planetID); } private void InitializeItem(int planetID) { GameObject val = GlobeBuilder.Build(StartOfRound.Instance.levels[planetID]); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)((Component)planetContainer.GetChild(0)).gameObject); ScanNodeProperties componentInChildren = ((Component)this).gameObject.GetComponentInChildren<ScanNodeProperties>(); if ((Object)(object)componentInChildren == (Object)null) { Debug.LogError((object)("Scan node is missing for item!: " + ((Object)((Component)this).gameObject).name)); return; } componentInChildren.headerText = GlobeBuilder.TrimPlanetName(StartOfRound.Instance.levels[planetID].PlanetName) + " Globe"; Object.Instantiate<GameObject>(val, planetContainer, false); } } public override int GetItemDataToSave() { ((GrabbableObject)this).GetItemDataToSave(); return planetID; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); planetID = saveData; int num = StartOfRound.Instance.levels.Length; if (planetID > num) { planetID %= num; } isSet = true; } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) && !isSpinning) { ((MonoBehaviour)this).StartCoroutine(SpinGlobe()); } } private IEnumerator SpinGlobe() { isSpinning = true; spinTime = Mathf.Min(spinTime, (float)Random.Range(0, 10) / 10f); while (spinTime < 2.5f && !base.isPocketed) { planetContainer.Rotate(Vector3.forward, (0f - spinSpeed) * spinDecceleration.Evaluate(spinTime), (Space)1); spinTime += Time.deltaTime; yield return null; } isSpinning = false; } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(910179441u, new RpcReceiveHandler(__rpc_handler_910179441), "SyncPlanetIDRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_910179441(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((GlobeBehaviour)(object)target).SyncPlanetIDRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "GlobeBehaviour"; } } internal class GlobeFurniture : NetworkBehaviour { public Transform planetContainer = null; public float passiveSpinRotation = 0.3f; private static readonly UnityEvent PlanetChangedEvent = new UnityEvent(); private bool isTransitioning; private bool queued; public float transitionSpeed = 10f; public Material mat; private void OnEnable() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown PlanetChangedEvent.AddListener(new UnityAction(CreateGlobe)); CreateGlobe(); } private void OnDisable() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown PlanetChangedEvent.RemoveListener(new UnityAction(CreateGlobe)); } public static void ChangePlanet() { PlanetChangedEvent.Invoke(); } private void CreateGlobe() { if (!queued) { ((MonoBehaviour)this).StartCoroutine(TransitionGlobeModel()); } } private IEnumerator TransitionGlobeModel() { queued = true; yield return (object)new WaitUntil((Func<bool>)(() => !isTransitioning)); queued = false; isTransitioning = true; Renderer oldGlobe = SetupOldGlobe(); bool hadNoPreviousGlobe = (Object)(object)oldGlobe == (Object)null; Renderer newGlobe = SetupNewGlobe(hadNoPreviousGlobe); if ((Object)(object)newGlobe == (Object)null || hadNoPreviousGlobe) { isTransitioning = false; yield break; } float t = 0f; while (t < 1f) { t += Time.deltaTime / transitionSpeed; oldGlobe.material.SetFloat("_FillAmount", t); newGlobe.material.SetFloat("_FillAmount", 1f - t); yield return null; } ClearTransform(((Component)oldGlobe).transform); isTransitioning = false; } private Renderer SetupOldGlobe() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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) if (planetContainer.childCount > 0) { if (planetContainer.childCount > 1) { TransformExtensions.KillAllChildren(planetContainer); } Transform child = planetContainer.GetChild(0); child.localPosition += Vector3.right * -0.001f; Renderer component = ((Component)child).GetComponent<Renderer>(); if ((Object)(object)component == (Object)null) { return null; } Material[] materials = component.materials; foreach (Material val in materials) { val.SetFloat("_Reverse", 1f); } return component; } return null; } private Renderer SetupNewGlobe(bool instant) { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) if (((Object)StartOfRound.Instance.currentLevel).name == "TestAllEnemies") { return null; } GameObject val = GlobeBuilder.Build(StartOfRound.Instance.currentLevel); Transform transform = Object.Instantiate<GameObject>(val, planetContainer, false).transform; Renderer component = ((Component)transform).GetComponent<Renderer>(); if ((Object)(object)component == (Object)null) { return null; } Material[] array = (Material[])(object)new Material[component.materials.Length]; for (int i = 0; i < component.materials.Length; i++) { Material val2 = new Material(mat); val2.SetTexture("_MainTex", component.materials[i].GetTexture("_BaseColorMap")); val2.SetColor("_ColourTint", component.materials[i].color); val2.SetFloat("_FillAmount", (float)((!instant) ? 1 : 0)); array[i] = val2; } component.materials = array; return component; } private void ClearTransform(Transform t) { Object.Destroy((Object)(object)((Component)t).gameObject); } public void Update() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) planetContainer.Rotate(Vector3.forward, passiveSpinRotation); } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "GlobeFurniture"; } } } 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 GlobeScrap.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }