DebugGui: separate debug flag for ghost ai lines/labels

This commit is contained in:
JohnCorby 2022-04-07 11:03:52 -07:00
parent 26c040367c
commit 0c939d485e

View File

@ -1,4 +1,5 @@
using QSB.ClientServerStateSync; using QSB.ClientServerStateSync;
using QSB.EchoesOfTheEye.Ghosts.WorldObjects;
using QSB.Player; using QSB.Player;
using QSB.QuantumSync.WorldObjects; using QSB.QuantumSync.WorldObjects;
using QSB.ShipSync; using QSB.ShipSync;
@ -264,11 +265,8 @@ internal class DebugGUI : MonoBehaviour, IAddComponentOnStart
private static void DrawWorldObjectLabels() private static void DrawWorldObjectLabels()
{ {
if (!QSBCore.DebugSettings.DrawLabels) if (QSBCore.DebugSettings.DrawLabels)
{ {
return;
}
foreach (var obj in QSBWorldSync.GetWorldObjects()) foreach (var obj in QSBWorldSync.GetWorldObjects())
{ {
if (obj.ShouldDisplayDebug()) if (obj.ShouldDisplayDebug())
@ -277,16 +275,24 @@ internal class DebugGUI : MonoBehaviour, IAddComponentOnStart
} }
} }
} }
else if (QSBCore.DebugSettings.DrawGhostAI)
{
foreach (var obj in QSBWorldSync.GetWorldObjects<IGhostObject>())
{
if (obj.ShouldDisplayDebug())
{
DrawLabel(obj.AttachedObject.transform, obj.ReturnLabel());
}
}
}
}
public void OnRenderObject() => DrawWorldObjectLines(); public void OnRenderObject() => DrawWorldObjectLines();
private static void DrawWorldObjectLines() private static void DrawWorldObjectLines()
{ {
if (!QSBCore.DebugSettings.DrawLines) if (QSBCore.DebugSettings.DrawLines)
{ {
return;
}
foreach (var obj in QSBWorldSync.GetWorldObjects()) foreach (var obj in QSBWorldSync.GetWorldObjects())
{ {
if (obj.ShouldDisplayDebug()) if (obj.ShouldDisplayDebug())
@ -295,6 +301,17 @@ internal class DebugGUI : MonoBehaviour, IAddComponentOnStart
} }
} }
} }
else if (QSBCore.DebugSettings.DrawGhostAI)
{
foreach (var obj in QSBWorldSync.GetWorldObjects<IGhostObject>())
{
if (obj.ShouldDisplayDebug())
{
obj.DisplayLines();
}
}
}
}
public static void DrawLabel(Transform obj, string label) public static void DrawLabel(Transform obj, string label)
{ {