2 months procrastination moment

This commit is contained in:
msk
2022-06-06 19:09:31 -07:00
parent 2b73125f8e
commit cb1dd8b4c6
4 changed files with 50 additions and 14 deletions
+4 -3
View File
@@ -13,18 +13,19 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
PackageName: TNH_Quality_of_Life_Improvements PackageName: TNH_Quality_of_Life_Improvements
Author: muskit Author: muskit
Version: 1.2.2 Version: 1.2.3
Icon: {fileID: 2800000, guid: 785b7946398f5314b95bf593d2d77d67, type: 3} Icon: {fileID: 2800000, guid: 785b7946398f5314b95bf593d2d77d67, type: 3}
ReadMe: {fileID: 102900000, guid: ab1d6dea017447a48ac348db588a6f35, type: 3} ReadMe: {fileID: 102900000, guid: ab1d6dea017447a48ac348db588a6f35, type: 3}
WebsiteURL: https://github.com/muskit/TNH-Quality-of-Life-Improvements WebsiteURL: https://github.com/muskit/TNH-Quality-of-Life-Improvements
Description: Quality of life improvements to the Take and Hold experience. Description: Quality of life improvements to the Take and Hold experience.
AdditionalDependencies: AdditionalDependencies:
- BepInEx-BepInExPack_H3VR-5.4.1700 - BepInEx-BepInExPack_H3VR-5.4.1700
- nrgill28-Sodalite-1.3.5
StripNamespaces: 0 StripNamespaces: 0
AdditionalNamespaces: AdditionalNamespaces:
- TNHQoLImprovements - TNHQoLImprovements
BuildItems: BuildItems:
- {fileID: 11400000, guid: ccaff18373cd99848b344316974e6d46, type: 2} - {fileID: 11400000, guid: ccaff18373cd99848b344316974e6d46, type: 2}
BundleCompressionType: 2 BundleCompressionType: 2
BuildAction: 2 BuildAction: 1
OutputProfile: OutputProfile: C:/Users/Alex/AppData/Roaming/r2modmanPlus-local/H3VR/profiles/dev
+36 -10
View File
@@ -9,7 +9,10 @@ using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
using FistVR;
using TNHQoLImprovements; using TNHQoLImprovements;
using Sodalite.Api;
using Sodalite;
/* /*
* SUPER LARGE WARNING ABOUT THIS CLASS * SUPER LARGE WARNING ABOUT THIS CLASS
@@ -61,11 +64,17 @@ public class MeatKitPlugin : BaseUnityPlugin
// Take and Hold modifications // Take and Hold modifications
private static InPlay instance; private static InPlay instance;
// Searching for old leaderboards player count mod to disable // Searching for old leaderboards player count mod to disable
private float lpcSearchTime;
private bool lpcStopSearching = false; private bool lpcStopSearching = false;
private float lpcModSearchTimeEnd; private float lpcModSearchTimeEnd;
// toggle HP visibility from wrist menu
private bool hpDisplayEnabled = true;
public static FVRHealthBar hpDisplay;
private WristMenuButton wmbHPToggle;
private Harmony harmony; private Harmony harmony;
private void SceneChanged(Scene from, Scene to) private void SceneChanged(Scene from, Scene to)
@@ -74,17 +83,23 @@ public class MeatKitPlugin : BaseUnityPlugin
playerCamera = GameObject.FindGameObjectWithTag("MainCamera"); playerCamera = GameObject.FindGameObjectWithTag("MainCamera");
// apply health counter tweaks globally // apply health counter tweaks globally
var healthCounter = FindObjectOfType<FistVR.FVRHealthBar>(); hpDisplay = FindObjectOfType<FVRHealthBar>();
if (healthCounter != null) if (hpDisplay != null)
{ {
HPReadability.ImproveHPTextReadability(healthCounter.transform.GetChild(0).gameObject); HPReadability.ImproveHPTextReadability(hpDisplay.transform.GetChild(0).gameObject);
if (cfgHPHiddenWhenAiming.Value) if (cfgHPHiddenWhenAiming.Value)
healthCounter.gameObject.AddComponent<HPHideWhenAiming>(); hpDisplay.gameObject.AddComponent<HPHideWhenAiming>();
WristMenuAPI.Buttons.Add(wmbHPToggle);
}
else
{
WristMenuAPI.Buttons.Remove(wmbHPToggle);
} }
// TNH patches // TNH patches
if (GameObject.Find("_GameManager") != null || FindObjectOfType<FistVR.TNH_Manager>() != null) if (GameObject.Find("_GameManager") != null || FindObjectOfType<TNH_Manager>() != null)
{ {
Logger.LogInfo("We are in a TNH game!"); Logger.LogInfo("We are in a TNH game!");
instance = new GameObject().AddComponent<InPlay>(); instance = new GameObject().AddComponent<InPlay>();
@@ -102,7 +117,7 @@ public class MeatKitPlugin : BaseUnityPlugin
// Agency FB // Agency FB
if (fontAgencyFB == null) if (fontAgencyFB == null)
{ {
var healthCounter = FindObjectOfType<FistVR.FVRHealthBar>(); var healthCounter = FindObjectOfType<FVRHealthBar>();
if (healthCounter != null) if (healthCounter != null)
{ {
fontAgencyFB = healthCounter.transform.GetChild(0).GetChild(0).GetComponent<Text>().font; fontAgencyFB = healthCounter.transform.GetChild(0).GetChild(0).GetComponent<Text>().font;
@@ -126,6 +141,7 @@ public class MeatKitPlugin : BaseUnityPlugin
public MeatKitPlugin(): base() public MeatKitPlugin(): base()
{ {
harmony = new Harmony("muskit.TNHQualityOfLifeImprovements"); harmony = new Harmony("muskit.TNHQualityOfLifeImprovements");
lpcSearchTime = 30 + 30 * Mathf.Sin(System.DateTime.Today.DayOfYear / 365);
} }
private void Awake() private void Awake()
@@ -201,11 +217,14 @@ public class MeatKitPlugin : BaseUnityPlugin
HealthExpireIndicationType.Flashing, HealthExpireIndicationType.Flashing,
"Add a visual indication on the Health Crystal's despawn timer."); "Add a visual indication on the Health Crystal's despawn timer.");
// give 60 seconds to search for old mod, which we want to kill // calculate end time to search for my deprecated Leaderboard
lpcModSearchTimeEnd = Time.time + 60; lpcModSearchTimeEnd = Time.time + lpcSearchTime;
wmbHPToggle = new WristMenuButton("Toggle HP Display", ToggleHPVisibility);
RunPatches(); RunPatches();
} }
// DO NOT EDIT. // DO NOT EDIT.
private void LoadAssets() {} private void LoadAssets() {}
@@ -240,6 +259,13 @@ public class MeatKitPlugin : BaseUnityPlugin
} }
} }
private void ToggleHPVisibility(object sender, ButtonClickEventArgs args)
{
hpDisplayEnabled = !hpDisplayEnabled;
if (hpDisplay != null)
hpDisplay.gameObject.SetActive(hpDisplayEnabled);
}
/// <summary> /// <summary>
/// Its only purpose: to kill the deprecated TNH Leaderboard Player Count mod. /// Its only purpose: to kill the deprecated TNH Leaderboard Player Count mod.
/// </summary> /// </summary>
@@ -260,7 +286,7 @@ public class MeatKitPlugin : BaseUnityPlugin
if (Time.realtimeSinceStartup >= lpcModSearchTimeEnd) if (Time.realtimeSinceStartup >= lpcModSearchTimeEnd)
{ {
Logger.LogInfo("Stopping search for TNH Leaderboard Player Count mod after 60 seconds."); Logger.LogInfo(string.Format("Stopping search for TNH Leaderboard Player Count mod after {0} seconds.", lpcSearchTime));
lpcStopSearching = true; lpcStopSearching = true;
} }
} }
+9
View File
@@ -21,6 +21,15 @@ Toggle and customize these features in your mod manager's *Config editor*.
For any issues/ideas, please create an issue at the GitHub repository (linked on Thunderstore page). For any issues/ideas, please create an issue at the GitHub repository (linked on Thunderstore page).
## Changelog ## Changelog
1.2.3
* Added button in wrist menu to toggle HP counter (thanks PutterMyBancakes for the suggestion!)
* [TNH] Made the search time for deprecated Leaderboard mod based on day of year as an input of the sin()
1.2.2
* When aiming around the HP counter, its opacity can now change to a player setting
* Increased size of hide-HP aiming region
* [TNH] Decreased search time for deprecated Leaderboard mod
1.2.1 1.2.1
* [TNH] Changed leaderboard player count message for unavailability with TNHTweaker * [TNH] Changed leaderboard player count message for unavailability with TNHTweaker
+1 -1
View File
@@ -48,7 +48,7 @@ namespace TNHQoLImprovements
void Start() void Start()
{ {
tnhManager = GameObject.Find("_GameManager").GetComponent<TNH_Manager>(); tnhManager = FindObjectOfType<TNH_Manager>();
var rig = Object.FindObjectOfType<FVRMovementManager>().transform; var rig = Object.FindObjectOfType<FVRMovementManager>().transform;
hands = new Transform[] { hands = new Transform[] {