SmartReticle: made work for VR reticle

This commit is contained in:
NotAKidoS 2024-09-02 00:53:54 -05:00
parent dbdf4308c7
commit e61049462b
2 changed files with 14 additions and 11 deletions

View file

@ -65,15 +65,18 @@ public class SmartReticleMod : MelonMod
if (!Entry_Enabled.Value)
return;
if (!__instance.isDesktopRay)
GameObject pointer;
if (__instance.isDesktopRay) // in desktop mode
pointer = CohtmlHud.Instance.desktopPointer;
else if (__instance.isHeadRay) // in VR mode with no controllers
pointer = __instance.backupCrossHair;
else
return;
GameObject desktopPointer = CohtmlHud.Instance.desktopPointer;
if (!desktopPointer.activeSelf)
if (!pointer.activeSelf)
{
_lastDisplayedTime = 0; // reset time
return; // pointing at menu or cursor is active
return; // pointing at menu or cursor / controllers active
}
bool shouldDisplayPointer = (__instance._interact // pressing mouse1 or mouse2
@ -93,7 +96,7 @@ public class SmartReticleMod : MelonMod
}
if (Time.time - _lastDisplayedTime > Entry_HideTimeout.Value)
desktopPointer.SetActive(false);
pointer.SetActive(false);
}
}

View file

@ -1,12 +1,12 @@
{
"_id": -1,
"_id": 233,
"name": "SmartReticle",
"modversion": "1.0.0",
"modversion": "1.0.1",
"gameversion": "2024r175",
"loaderversion": "0.6.1",
"modtype": "Mod",
"author": "NotAKidoS",
"description": "Simple mod that makes the Desktop reticle only appear when needed.",
"description": "Simple mod that makes the Desktop/VR Head reticle only appear when hovering over an interactable, holding an interaction button, or when using a tool.",
"searchtags": [
"reticle",
"hud",
@ -16,8 +16,8 @@
"requirements": [
"None"
],
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r39/SmartReticle.dll",
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r40/SmartReticle.dll",
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/SmartReticle/",
"changelog": "- Initial Release",
"changelog": "- Adjusted to also work for the VR head reticle.",
"embedcolor": "#f61963"
}