mirror of
https://github.com/muskit/H3VR-TNH-Quality-of-Life-Improvements.git
synced 2026-06-02 12:14:27 -07:00
2 months procrastination moment
This commit is contained in:
@@ -13,18 +13,19 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
PackageName: TNH_Quality_of_Life_Improvements
|
||||
Author: muskit
|
||||
Version: 1.2.2
|
||||
Version: 1.2.3
|
||||
Icon: {fileID: 2800000, guid: 785b7946398f5314b95bf593d2d77d67, type: 3}
|
||||
ReadMe: {fileID: 102900000, guid: ab1d6dea017447a48ac348db588a6f35, type: 3}
|
||||
WebsiteURL: https://github.com/muskit/TNH-Quality-of-Life-Improvements
|
||||
Description: Quality of life improvements to the Take and Hold experience.
|
||||
AdditionalDependencies:
|
||||
- BepInEx-BepInExPack_H3VR-5.4.1700
|
||||
- nrgill28-Sodalite-1.3.5
|
||||
StripNamespaces: 0
|
||||
AdditionalNamespaces:
|
||||
- TNHQoLImprovements
|
||||
BuildItems:
|
||||
- {fileID: 11400000, guid: ccaff18373cd99848b344316974e6d46, type: 2}
|
||||
BundleCompressionType: 2
|
||||
BuildAction: 2
|
||||
OutputProfile:
|
||||
BuildAction: 1
|
||||
OutputProfile: C:/Users/Alex/AppData/Roaming/r2modmanPlus-local/H3VR/profiles/dev
|
||||
|
||||
@@ -9,7 +9,10 @@ using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
using FistVR;
|
||||
using TNHQoLImprovements;
|
||||
using Sodalite.Api;
|
||||
using Sodalite;
|
||||
|
||||
/*
|
||||
* SUPER LARGE WARNING ABOUT THIS CLASS
|
||||
@@ -61,11 +64,17 @@ public class MeatKitPlugin : BaseUnityPlugin
|
||||
|
||||
// Take and Hold modifications
|
||||
private static InPlay instance;
|
||||
|
||||
|
||||
// Searching for old leaderboards player count mod to disable
|
||||
private float lpcSearchTime;
|
||||
private bool lpcStopSearching = false;
|
||||
private float lpcModSearchTimeEnd;
|
||||
|
||||
// toggle HP visibility from wrist menu
|
||||
private bool hpDisplayEnabled = true;
|
||||
public static FVRHealthBar hpDisplay;
|
||||
private WristMenuButton wmbHPToggle;
|
||||
|
||||
private Harmony harmony;
|
||||
|
||||
private void SceneChanged(Scene from, Scene to)
|
||||
@@ -74,17 +83,23 @@ public class MeatKitPlugin : BaseUnityPlugin
|
||||
playerCamera = GameObject.FindGameObjectWithTag("MainCamera");
|
||||
|
||||
// apply health counter tweaks globally
|
||||
var healthCounter = FindObjectOfType<FistVR.FVRHealthBar>();
|
||||
if (healthCounter != null)
|
||||
hpDisplay = FindObjectOfType<FVRHealthBar>();
|
||||
if (hpDisplay != null)
|
||||
{
|
||||
HPReadability.ImproveHPTextReadability(healthCounter.transform.GetChild(0).gameObject);
|
||||
HPReadability.ImproveHPTextReadability(hpDisplay.transform.GetChild(0).gameObject);
|
||||
|
||||
if (cfgHPHiddenWhenAiming.Value)
|
||||
healthCounter.gameObject.AddComponent<HPHideWhenAiming>();
|
||||
hpDisplay.gameObject.AddComponent<HPHideWhenAiming>();
|
||||
|
||||
WristMenuAPI.Buttons.Add(wmbHPToggle);
|
||||
}
|
||||
else
|
||||
{
|
||||
WristMenuAPI.Buttons.Remove(wmbHPToggle);
|
||||
}
|
||||
|
||||
// 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!");
|
||||
instance = new GameObject().AddComponent<InPlay>();
|
||||
@@ -102,7 +117,7 @@ public class MeatKitPlugin : BaseUnityPlugin
|
||||
// Agency FB
|
||||
if (fontAgencyFB == null)
|
||||
{
|
||||
var healthCounter = FindObjectOfType<FistVR.FVRHealthBar>();
|
||||
var healthCounter = FindObjectOfType<FVRHealthBar>();
|
||||
if (healthCounter != null)
|
||||
{
|
||||
fontAgencyFB = healthCounter.transform.GetChild(0).GetChild(0).GetComponent<Text>().font;
|
||||
@@ -126,6 +141,7 @@ public class MeatKitPlugin : BaseUnityPlugin
|
||||
public MeatKitPlugin(): base()
|
||||
{
|
||||
harmony = new Harmony("muskit.TNHQualityOfLifeImprovements");
|
||||
lpcSearchTime = 30 + 30 * Mathf.Sin(System.DateTime.Today.DayOfYear / 365);
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
@@ -201,11 +217,14 @@ public class MeatKitPlugin : BaseUnityPlugin
|
||||
HealthExpireIndicationType.Flashing,
|
||||
"Add a visual indication on the Health Crystal's despawn timer.");
|
||||
|
||||
// give 60 seconds to search for old mod, which we want to kill
|
||||
lpcModSearchTimeEnd = Time.time + 60;
|
||||
// calculate end time to search for my deprecated Leaderboard
|
||||
lpcModSearchTimeEnd = Time.time + lpcSearchTime;
|
||||
|
||||
wmbHPToggle = new WristMenuButton("Toggle HP Display", ToggleHPVisibility);
|
||||
|
||||
RunPatches();
|
||||
}
|
||||
|
||||
// DO NOT EDIT.
|
||||
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>
|
||||
/// Its only purpose: to kill the deprecated TNH Leaderboard Player Count mod.
|
||||
/// </summary>
|
||||
@@ -260,7 +286,7 @@ public class MeatKitPlugin : BaseUnityPlugin
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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).
|
||||
|
||||
## 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
|
||||
* [TNH] Changed leaderboard player count message for unavailability with TNHTweaker
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace TNHQoLImprovements
|
||||
|
||||
void Start()
|
||||
{
|
||||
tnhManager = GameObject.Find("_GameManager").GetComponent<TNH_Manager>();
|
||||
tnhManager = FindObjectOfType<TNH_Manager>();
|
||||
|
||||
var rig = Object.FindObjectOfType<FVRMovementManager>().transform;
|
||||
hands = new Transform[] {
|
||||
|
||||
Reference in New Issue
Block a user