major cleanup

This commit is contained in:
NotAKidoS 2023-04-26 15:32:02 -05:00
parent b33e15377f
commit e5242f76c7
85 changed files with 584 additions and 571 deletions

View file

@ -1,6 +1,6 @@
using CVRGizmos.GismoTypes;
using Gizmos = Popcron.Gizmos;
using UnityEngine;
using Gizmos = Popcron.Gizmos;
namespace CVRGizmos
{

View file

@ -31,49 +31,49 @@ namespace CVRGizmos.GismoTypes
CacheGizmos();
break;
}
if (references[i].target == null)
{
break;
}
if (references[i].maxDistance < references[i].minDistance && references[i].maxDistance != 0f)
{
break;
}
Vector3 normalized = (references[i].transform.position - references[i].target.position).normalized;
if (references[i].target == null)
{
break;
}
if (references[i].maxDistance < references[i].minDistance && references[i].maxDistance != 0f)
{
break;
}
Vector3 normalized = (references[i].transform.position - references[i].target.position).normalized;
//BUG: Matrix addition isn't reset, other gizmo types Matrix will persist.
//This gizmo type could be a bit fucked, but I don't have the time to test.
Gizmos.Matrix = Matrix4x4.identity;
//BUG: Matrix addition isn't reset, other gizmo types Matrix will persist.
//This gizmo type could be a bit fucked, but I don't have the time to test.
Gizmos.Matrix = Matrix4x4.identity;
if (references[i].minDistance == 0f)
{
if (references[i].maxDistance == 0f)
{
Gizmos.Color = Color.green;
Gizmos.Line(references[i].target.position, normalized * 9999f);
break;
}
Gizmos.Color = Color.green;
Gizmos.Line(references[i].target.position, references[i].target.position + normalized * references[i].maxDistance);
break;
}
else
{
if (references[i].maxDistance == 0f)
{
Gizmos.Color = Color.red;
Gizmos.Line(references[i].target.position, references[i].target.position + normalized * references[i].minDistance);
Gizmos.Color = Color.green;
Gizmos.Line(references[i].target.position + normalized * references[i].minDistance, normalized * 9999f);
break;
}
Gizmos.Color = Color.red;
Gizmos.Line(references[i].target.position, references[i].target.position + normalized * references[i].minDistance);
Gizmos.Color = Color.green;
Gizmos.Line(references[i].target.position + normalized * references[i].minDistance, references[i].target.position + normalized * references[i].maxDistance);
break;
}
}
if (references[i].minDistance == 0f)
{
if (references[i].maxDistance == 0f)
{
Gizmos.Color = Color.green;
Gizmos.Line(references[i].target.position, normalized * 9999f);
break;
}
Gizmos.Color = Color.green;
Gizmos.Line(references[i].target.position, references[i].target.position + normalized * references[i].maxDistance);
break;
}
else
{
if (references[i].maxDistance == 0f)
{
Gizmos.Color = Color.red;
Gizmos.Line(references[i].target.position, references[i].target.position + normalized * references[i].minDistance);
Gizmos.Color = Color.green;
Gizmos.Line(references[i].target.position + normalized * references[i].minDistance, normalized * 9999f);
break;
}
Gizmos.Color = Color.red;
Gizmos.Line(references[i].target.position, references[i].target.position + normalized * references[i].minDistance);
Gizmos.Color = Color.green;
Gizmos.Line(references[i].target.position + normalized * references[i].minDistance, references[i].target.position + normalized * references[i].maxDistance);
break;
}
}
}
}
}

View file

@ -1,28 +1,22 @@
using ABI_RC.Core.Player;
using MelonLoader;
using UnityEngine;
using System.Collections;
namespace CVRGizmos;
public class CVRGizmos : MelonMod
{
public static readonly MelonPreferences_Category CategoryCVRGizmos =
MelonPreferences.CreateCategory(nameof(CVRGizmos));
private static MelonPreferences_Category m_categoryCVRGizmos;
private static MelonPreferences_Entry<bool> m_entryCVRGizmosEnabled;
private static MelonPreferences_Entry<bool> m_entryCVRGizmosLocalOnly;
public static readonly MelonPreferences_Entry<bool> EntryEnabled =
CategoryCVRGizmos.CreateEntry("Enabled", false, description: "Toggle CVR Gizmos entirely.", dont_save_default: true);
public override void OnApplicationStart()
public static readonly MelonPreferences_Entry<bool> EntryLocalOnly =
CategoryCVRGizmos.CreateEntry("Local Only", false, description: "Toggle CVR Gizmos local-only mode.", dont_save_default: true);
public override void OnInitializeMelon()
{
m_categoryCVRGizmos = MelonPreferences.CreateCategory(nameof(CVRGizmos));
m_entryCVRGizmosEnabled = m_categoryCVRGizmos.CreateEntry<bool>("Enabled", false);
m_entryCVRGizmosLocalOnly = m_categoryCVRGizmos.CreateEntry<bool>("Local Only", false);
m_entryCVRGizmosEnabled.Value = false;
m_categoryCVRGizmos.SaveToFile(false);
m_entryCVRGizmosEnabled.OnValueChangedUntyped += CVRGizmosEnabled;
m_entryCVRGizmosLocalOnly.OnValueChangedUntyped += CVRGizmosLocalOnly;
MelonLoader.MelonCoroutines.Start(WaitForLocalPlayer());
}
@ -37,13 +31,13 @@ public class CVRGizmos : MelonMod
public void CVRGizmosEnabled()
{
if (!CVRGizmoManager.Instance) return;
CVRGizmoManager.Instance.EnableGizmos(m_entryCVRGizmosEnabled.Value);
CVRGizmoManager.Instance.EnableGizmos(EntryEnabled.Value);
}
public void CVRGizmosLocalOnly()
{
if (!CVRGizmoManager.Instance) return;
CVRGizmoManager.Instance.g_localOnly = m_entryCVRGizmosLocalOnly.Value;
CVRGizmoManager.Instance.g_localOnly = EntryLocalOnly.Value;
CVRGizmoManager.Instance.RefreshGizmos();
}
}

View file

@ -2,7 +2,6 @@
using MelonLoader;
using System.Reflection;
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
@ -15,7 +14,7 @@ using System.Reflection;
nameof(CVRGizmos),
AssemblyInfoParams.Version,
AssemblyInfoParams.Author,
downloadLink: "https://github.com/NotAKidOnSteam/CVRGizmos"
downloadLink: "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/CVRGizmos"
)]
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]

View file

@ -16,8 +16,8 @@
"requirements": [
"None"
],
"downloadlink": "https://github.com/NotAKidOnSteam/CVRGizmos/releases/download/r2/CVRGizmos.dll",
"sourcelink": "https://github.com/NotAKidOnSteam/CVRGizmos/",
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r3/CVRGizmos.dll",
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/CVRGizmos/",
"changelog": "Added option to scale player collision. Fixed some VR specific issues.",
"embedcolor": "804221"
}