fix in-play stuff not working in other maps

This commit is contained in:
msk
2022-01-24 03:40:08 -08:00
parent b259424300
commit 6f938e95c8
4 changed files with 40 additions and 10 deletions
+12 -2
View File
@@ -33,6 +33,7 @@ public class MeatKitPlugin : BaseUnityPlugin
private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
#pragma warning restore 414 #pragma warning restore 414
public static AssetBundle bundle; public static AssetBundle bundle;
public static ConfigEntry<bool> cfgShowLPC;
public static ConfigEntry<bool> cfgSolidifyHPText; public static ConfigEntry<bool> cfgSolidifyHPText;
public static ConfigEntry<bool> cfgShowHPBackground; public static ConfigEntry<bool> cfgShowHPBackground;
public static ConfigEntry<float> cfgHPBackgroundOpacity; public static ConfigEntry<float> cfgHPBackgroundOpacity;
@@ -48,12 +49,16 @@ public class MeatKitPlugin : BaseUnityPlugin
private void SceneChanged(Scene from, Scene to) private void SceneChanged(Scene from, Scene to)
{ {
//Logger.LogInfo(string.Format("scene chg: {0} --> {1}", from.name, to.name)); //Logger.LogInfo(string.Format("scene chg: {0} --> {1}", from.name, to.name));
if(GameObject.Find("_NewTAHReticle") != null) Logger.LogInfo("_GameManager present: " + (GameObject.Find("_GameManager") != null));
Logger.LogInfo("TNH_Manager object present: " + (FindObjectOfType<FistVR.TNH_Manager>() != null));
if(GameObject.Find("_GameManager") != null || FindObjectOfType<FistVR.TNH_Manager>() != null)
{ {
Logger.LogInfo("We are in a TNH game!");
instance = new GameObject().AddComponent<InPlay>(); instance = new GameObject().AddComponent<InPlay>();
} }
else else
{ {
Logger.LogInfo("We are NOT in a TNH game!");
Destroy(instance); Destroy(instance);
} }
} }
@@ -78,6 +83,10 @@ public class MeatKitPlugin : BaseUnityPlugin
"Solidify HP text", "Solidify HP text",
true, true,
"Set opacity of HP text to full and give it a shadow."); "Set opacity of HP text to full and give it a shadow.");
cfgShowLPC = Config.Bind("Game Info",
"Show player count in online leaderboards",
true,
"Shows the number of players in the currently selected TNH leaderboard.");
cfgShowTokens = Config.Bind("Game Info", cfgShowTokens = Config.Bind("Game Info",
"Show Tokens", "Show Tokens",
true, true,
@@ -88,6 +97,7 @@ public class MeatKitPlugin : BaseUnityPlugin
"Shows how many holds the player has completed by their radar hand."); "Shows how many holds the player has completed by their radar hand.");
// patch leaderboard code // patch leaderboard code
if (cfgShowLPC.Value)
lpc = new LeaderboardPlayerCountPatch(); lpc = new LeaderboardPlayerCountPatch();
// give 120 seconds to search for old mod // give 120 seconds to search for old mod
@@ -116,7 +126,7 @@ public class MeatKitPlugin : BaseUnityPlugin
if (Time.realtimeSinceStartup >= lpcModSearchTimeEnd) if (Time.realtimeSinceStartup >= lpcModSearchTimeEnd)
{ {
Logger.LogWarning("Stopping search for TNH Leaderboard Player Count mod after 120 seconds."); Logger.LogInfo("Stopping search for TNH Leaderboard Player Count mod after 120 seconds.");
lpcModGone = true; lpcModGone = true;
} }
} }
+14 -2
View File
@@ -2,13 +2,25 @@
This mod adds quality of life improvements to the *Take and Hold* experience. This mod adds quality of life improvements to the *Take and Hold* experience.
## Features ## Features
* More visible HP counter * Better Health counter visibility
* Token and hold counter on wrist * Token and hold counter on wrist
* Player count for online leaderboards; see how you stack up! * Player count for online leaderboards; see how you stack up!
* Incompatible with [*TakeAndHoldTweaker*](https://h3vr.thunderstore.io/package/devyndamonster/TakeAndHoldTweaker/); feature will be disabled! * Won't work with [*TakeAndHoldTweaker*](https://h3vr.thunderstore.io/package/devyndamonster/TakeAndHoldTweaker/) installed
Enable/disable these features in your mod manager's *Config editor*. Enable/disable these features in your mod manager's *Config editor*.
For any issues/ideas, please create an issue on the GitHub repo (linked on Thunderstore page). For any issues/ideas, please create an issue on the GitHub repo (linked on Thunderstore page).
## Changelog
1.0.1
* Fixed the in-play improvements only applying in Classic Hallways map (whoops!!)
* Added option to enable/disable showing player count of online leaderboards
* Added option to enable/disable HP text opacity/shadow change
* (Surprisingly, the HP text normally doesn't have full opacity)
* Searching for TNH Leaderboards Player Count now stops after 120s
1.0.0
* Initial release!
**NOTE: [*TNH Leaderboard Player Count*](https://h3vr.thunderstore.io/package/muskit/TNH_Leaderboard_Player_Count/) has been merged with this mod. If installed, please remove that mod as it lacks features and is no longer supported.** **NOTE: [*TNH Leaderboard Player Count*](https://h3vr.thunderstore.io/package/muskit/TNH_Leaderboard_Player_Count/) has been merged with this mod. If installed, please remove that mod as it lacks features and is no longer supported.**
+9 -2
View File
@@ -11,16 +11,23 @@ namespace TNHQoLImprovements
private void OnDeath(bool _) private void OnDeath(bool _)
{ {
Debug.Log("I died!"); Debug.Log("I died!");
}
// TODO: lose counter. patch postfix FistVR.TNH_Manager.HoldPointCompleted
private void OnHoldLose()
{
} }
void Start() void Start()
{ {
transform.parent = GameObject.Find("_NewTAHReticle/TAHReticle_HealthBar").transform; //transform.parent = GameObject.Find("_NewTAHReticle/TAHReticle_HealthBar").transform;
transform.parent = FindObjectOfType<TAH_Reticle>().transform.GetChild(3);
transform.localPosition = new Vector3(-1f, 0, -.5f); transform.localPosition = new Vector3(-1f, 0, -.5f);
transform.localRotation = Quaternion.Euler(90, 0, 0); transform.localRotation = Quaternion.Euler(90, 0, 0);
transform.localScale = new Vector3(0.002f, 0.002f, 0.002f); transform.localScale = new Vector3(0.002f, 0.002f, 0.002f);
GameObject.Find("[SceneSettings]").GetComponent<FVRSceneSettings>().PlayerDeathEvent += OnDeath; FindObjectOfType<FVRSceneSettings>().PlayerDeathEvent += OnDeath;
} }
void Update() void Update()
+4 -3
View File
@@ -1,7 +1,7 @@
using System.Collections; using System.Collections;
using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
using FistVR;
namespace TNHQoLImprovements namespace TNHQoLImprovements
{ {
@@ -9,7 +9,8 @@ namespace TNHQoLImprovements
{ {
void Start() void Start()
{ {
transform.parent = GameObject.Find("_NewTAHReticle/TAHReticle_HealthBar").transform; //transform.parent = GameObject.Find("_NewTAHReticle/TAHReticle_HealthBar").transform;
transform.parent = FindObjectOfType<TAH_Reticle>().transform.GetChild(3);
transform.localPosition = new Vector3(1, 0, -.5f); transform.localPosition = new Vector3(1, 0, -.5f);
transform.localRotation = Quaternion.Euler(90, 0, 0); transform.localRotation = Quaternion.Euler(90, 0, 0);
transform.localScale = new Vector3(0.002f, 0.002f, 0.002f); transform.localScale = new Vector3(0.002f, 0.002f, 0.002f);
@@ -31,7 +32,7 @@ namespace TNHQoLImprovements
else else
{ {
debug_iterations++; debug_iterations++;
yield return new WaitForSeconds(0.25f); yield return new WaitForEndOfFrame();
} }
} }
Debug.Log("Token sprite found after " + debug_iterations.ToString() + " iterations."); Debug.Log("Token sprite found after " + debug_iterations.ToString() + " iterations.");