27 lines
623 B
C#
27 lines
623 B
C#
|
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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|