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);
#pragma warning restore 414
public static AssetBundle bundle;
public static ConfigEntry<bool> cfgShowLPC;
public static ConfigEntry<bool> cfgSolidifyHPText;
public static ConfigEntry<bool> cfgShowHPBackground;
public static ConfigEntry<float> cfgHPBackgroundOpacity;
@@ -48,12 +49,16 @@ public class MeatKitPlugin : BaseUnityPlugin
private void SceneChanged(Scene from, Scene to)
{
//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>();
}
else
{
Logger.LogInfo("We are NOT in a TNH game!");
Destroy(instance);
}
}
@@ -78,6 +83,10 @@ public class MeatKitPlugin : BaseUnityPlugin
"Solidify HP text",
true,
"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",
"Show Tokens",
true,
@@ -88,6 +97,7 @@ public class MeatKitPlugin : BaseUnityPlugin
"Shows how many holds the player has completed by their radar hand.");
// patch leaderboard code
if (cfgShowLPC.Value)
lpc = new LeaderboardPlayerCountPatch();
// give 120 seconds to search for old mod
@@ -116,7 +126,7 @@ public class MeatKitPlugin : BaseUnityPlugin
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;
}
}
+14 -2
View File
@@ -2,13 +2,25 @@
This mod adds quality of life improvements to the *Take and Hold* experience.
## Features
* More visible HP counter
* Better Health counter visibility
* Token and hold counter on wrist
* 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*.
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.**
+9 -2
View File
@@ -11,16 +11,23 @@ namespace TNHQoLImprovements
private void OnDeath(bool _)
{
Debug.Log("I died!");
}
// TODO: lose counter. patch postfix FistVR.TNH_Manager.HoldPointCompleted
private void OnHoldLose()
{
}
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.localRotation = Quaternion.Euler(90, 0, 0);
transform.localScale = new Vector3(0.002f, 0.002f, 0.002f);
GameObject.Find("[SceneSettings]").GetComponent<FVRSceneSettings>().PlayerDeathEvent += OnDeath;
FindObjectOfType<FVRSceneSettings>().PlayerDeathEvent += OnDeath;
}
void Update()
+4 -3
View File
@@ -1,7 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using FistVR;
namespace TNHQoLImprovements
{
@@ -9,7 +9,8 @@ namespace TNHQoLImprovements
{
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.localRotation = Quaternion.Euler(90, 0, 0);
transform.localScale = new Vector3(0.002f, 0.002f, 0.002f);
@@ -31,7 +32,7 @@ namespace TNHQoLImprovements
else
{
debug_iterations++;
yield return new WaitForSeconds(0.25f);
yield return new WaitForEndOfFrame();
}
}
Debug.Log("Token sprite found after " + debug_iterations.ToString() + " iterations.");