From 1560520e0ea53c3c37de8c2facd9095022292def Mon Sep 17 00:00:00 2001 From: Govorunb Date: Fri, 5 Jul 2024 07:05:00 +1000 Subject: [PATCH] sn --- SCHIZO/Credits/CreditsPatches.cs | 6 +++--- SCHIZO/HullPlates/HullPlatePrefab.cs | 9 ++++++--- SCHIZO/Patches/HolsterBeginPatches.Subnautica.cs | 6 +++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/SCHIZO/Credits/CreditsPatches.cs b/SCHIZO/Credits/CreditsPatches.cs index 989d1db4..75268dc2 100644 --- a/SCHIZO/Credits/CreditsPatches.cs +++ b/SCHIZO/Credits/CreditsPatches.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Reflection; using System.Reflection.Emit; using HarmonyLib; @@ -16,7 +16,7 @@ public static class UpdateCreditsTextTranspiler #if BELOWZERO AccessTools.Method(typeof(UnityEngine.MonoBehaviour), nameof(UnityEngine.MonoBehaviour.Invoke)); #else - AccessTools.Method(typeof(TMPro.TMP_Text), nameof(TMPro.TMP_Text.SetText), new[] { typeof(string), typeof(bool) }); + AccessTools.Method(typeof(TMPro.TMP_Text), nameof(TMPro.TMP_Text.SetText), [typeof(string), typeof(bool)]); #endif [HarmonyTranspiler, UsedImplicitly] @@ -41,7 +41,7 @@ private static void Patch(EndCreditsManager __instance) #if BELOWZERO __instance.centerText.SetText(creditsManager.GetCreditsTextBZ() + __instance.centerText.text); #else - float oldHeight = 14100;//__instance.textField.preferredHeight; + const float oldHeight = 14100;//__instance.textField.preferredHeight; __instance.textField.SetText(creditsManager.GetCreditsTextSN() + __instance.textField.text); __instance.scrollSpeed = __instance.textField.preferredHeight * __instance.scrollSpeed / oldHeight; __instance.scrollStep = __instance.textField.preferredHeight * __instance.scrollStep / oldHeight; diff --git a/SCHIZO/HullPlates/HullPlatePrefab.cs b/SCHIZO/HullPlates/HullPlatePrefab.cs index 50863696..4e758a49 100644 --- a/SCHIZO/HullPlates/HullPlatePrefab.cs +++ b/SCHIZO/HullPlates/HullPlatePrefab.cs @@ -39,9 +39,7 @@ public HullPlatePrefab(HullPlate hullPlate, HullPlateLoader loader) : base(hullP private IEnumerator GetPrefab(IOut gameObject) { -#pragma warning disable CS0612 // Type or member is obsolete - CoroutineTask task = CraftData.GetPrefabForTechTypeAsync(TechType.DioramaHullPlate); -#pragma warning restore CS0612 // Type or member is obsolete + CoroutineTask task = CraftData.GetPrefabForTechTypeAsync(HullPlateTechType); yield return task; GameObject instance = GameObject.Instantiate(task.GetResult()); @@ -53,4 +51,9 @@ private IEnumerator GetPrefab(IOut gameObject) instance.name = _hullPlate.classId; gameObject.Set(instance); } + // lol. lmao, even +#if BELOWZERO +#pragma warning disable CS0612 // Type or member is obsolete +#endif + private const TechType HullPlateTechType = TechType.DioramaHullPlate; } diff --git a/SCHIZO/Patches/HolsterBeginPatches.Subnautica.cs b/SCHIZO/Patches/HolsterBeginPatches.Subnautica.cs index 455fdaa6..b0747cdc 100644 --- a/SCHIZO/Patches/HolsterBeginPatches.Subnautica.cs +++ b/SCHIZO/Patches/HolsterBeginPatches.Subnautica.cs @@ -10,10 +10,10 @@ internal static class HolsterBeginPatches public static void InjectBeginHolsterCall(QuickSlots __instance) { if (__instance.state != QuickSlots.ArmsState.Holster) return; - InventoryItem item = __instance._heldItem; - if (item is null || !item.item) return; + Pickupable item = __instance._heldItem?.item; + if (!item) return; // the funny - item.item.gameObject.SendMessage("OnHolsterBegin", SendMessageOptions.DontRequireReceiver); + item.gameObject.SendMessage("OnHolsterBegin", SendMessageOptions.DontRequireReceiver); } }