Add patch for replay gem counter
This commit is contained in:
parent
17a2fd1760
commit
f0b5684e7e
1 changed files with 26 additions and 0 deletions
26
Patches/GemReplayPatch.cs
Normal file
26
Patches/GemReplayPatch.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using HarmonyLib;
|
||||
|
||||
namespace Sandbox.Patches
|
||||
{
|
||||
/*
|
||||
* Fixes the gem counter when watching a replay
|
||||
*/
|
||||
[HarmonyPatch(typeof(GameHUD), "SetGems")]
|
||||
internal class GameHUDSetGemsPatch
|
||||
{
|
||||
static bool Prefix(ref int collected)
|
||||
{
|
||||
// TODO, validate that we're actually writing to SelfGemCounter and not GhostGemCounter
|
||||
// Though I don't think you can watch a replay and ghost at the same time, so it's probably ok
|
||||
if (MarbleManager.Replaying)
|
||||
{
|
||||
MarbleController player = CameraController.instance?.player;
|
||||
if (player)
|
||||
{
|
||||
collected = player.CollectedGems;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue