fix gui in eye

This commit is contained in:
Mister_Nebula 2022-05-03 09:44:07 +01:00
parent 18a069427b
commit 6e2dba8e9c

View File

@ -173,104 +173,107 @@ internal class DebugGUI : MonoBehaviour, IAddComponentOnStart
#endregion
#region Column3 - Ship data
WriteLine(3, $"Current Flyer : {ShipManager.Instance.CurrentFlyer}");
if (ShipTransformSync.LocalInstance != null)
if (QSBSceneManager.CurrentScene == OWScene.SolarSystem)
{
var instance = ShipTransformSync.LocalInstance;
if (QSBCore.IsHost)
#region Column3 - Ship data
WriteLine(3, $"Current Flyer : {ShipManager.Instance.CurrentFlyer}");
if (ShipTransformSync.LocalInstance != null)
{
var currentOwner = instance.netIdentity.connectionToClient;
if (currentOwner == null)
var instance = ShipTransformSync.LocalInstance;
if (QSBCore.IsHost)
{
WriteLine(3, "Current Owner : NULL");
var currentOwner = instance.netIdentity.connectionToClient;
if (currentOwner == null)
{
WriteLine(3, "Current Owner : NULL");
}
else
{
WriteLine(3, $"Current Owner : {currentOwner.GetPlayerId()}");
}
}
else
{
WriteLine(3, $"Current Owner : {currentOwner.GetPlayerId()}");
}
}
var sector = instance.ReferenceSector;
WriteLine(3, $"Ref. Sector : {(sector != null ? sector.Name : "NULL")}", sector == null ? Color.red : Color.white);
var transform = instance.ReferenceTransform;
WriteLine(3, $"Ref. Transform : {(transform != null ? transform.name : "NULL")}", transform == null ? Color.red : Color.white);
}
else
{
WriteLine(3, "ShipTransformSync.LocalInstance is null.", Color.red);
}
WriteLine(3, "QSBShipComponent");
foreach (var component in QSBWorldSync.GetWorldObjects<QSBShipComponent>())
{
var attachedObject = component.AttachedObject;
if (attachedObject == null)
{
WriteLine(3, $"- {component.ObjectId} NULL ATTACHEDOBJECT", Color.red);
var sector = instance.ReferenceSector;
WriteLine(3, $"Ref. Sector : {(sector != null ? sector.Name : "NULL")}", sector == null ? Color.red : Color.white);
var transform = instance.ReferenceTransform;
WriteLine(3, $"Ref. Transform : {(transform != null ? transform.name : "NULL")}", transform == null ? Color.red : Color.white);
}
else
{
WriteLine(3, $"- {component.AttachedObject.name} RepairFraction:{component.AttachedObject._repairFraction}");
WriteLine(3, "ShipTransformSync.LocalInstance is null.", Color.red);
}
}
WriteLine(3, "QSBShipHull");
foreach (var hull in QSBWorldSync.GetWorldObjects<QSBShipHull>())
{
var attachedObject = hull.AttachedObject;
if (attachedObject == null)
WriteLine(3, "QSBShipComponent");
foreach (var component in QSBWorldSync.GetWorldObjects<QSBShipComponent>())
{
WriteLine(3, $"- {hull.ObjectId} NULL ATTACHEDOBJECT", Color.red);
}
else
{
WriteLine(3, $"- {hull.AttachedObject.name}, Integrity:{hull.AttachedObject.integrity}");
}
}
#endregion
if (QSBWorldSync.AllObjectsReady)
{
var ghost = QSBWorldSync.GetWorldObjects<QSBGhostBrain>().First(x => x.AttachedObject._name == "Yubaba");
WriteLine(4, ghost.AttachedObject._name);
WriteLine(4, $"Action:{ghost.GetCurrentActionName()}");
WriteLine(4, $"Threat Awareness:{ghost.GetThreatAwareness()}");
var interestedPlayer = ghost._data.interestedPlayer;
WriteLine(4, $"InterestedPlayer:{(interestedPlayer == null ? "NULL" : interestedPlayer.player.PlayerId)}");
foreach (var player in ghost._data.players.Values)
{
WriteLine(4, $"{player.player.PlayerId}");
WriteLine(4, $"- isPlayerVisible:{player.sensor.isPlayerVisible}");
WriteLine(4, $"- isPlayerHeldLanternVisible:{player.sensor.isPlayerHeldLanternVisible}");
WriteLine(4, $"- isIlluminatedByPlayer:{player.sensor.isIlluminatedByPlayer}");
WriteLine(4, $"- isPlayerLocationKnown:{player.isPlayerLocationKnown}");
WriteLine(4, $"- timeSincePlayerLocationKnown:{player.timeSincePlayerLocationKnown}");
var lantern = player.player.AssignedSimulationLantern;
if (lantern != null)
var attachedObject = component.AttachedObject;
if (attachedObject == null)
{
WriteLine(4, $"- IsHeldByPlayer:{lantern.AttachedObject.GetLanternController().IsHeldByPlayer()}");
WriteLine(4, $"- Concealed:{lantern.AttachedObject.GetLanternController().IsConcealed()}");
WriteLine(3, $"- {component.ObjectId} NULL ATTACHEDOBJECT", Color.red);
}
else
{
WriteLine(4, $"- LANTERN NULL", Color.red);
WriteLine(3, $"- {component.AttachedObject.name} RepairFraction:{component.AttachedObject._repairFraction}");
}
}
var playerCamera = player.player.Camera;
if (playerCamera != null)
WriteLine(3, "QSBShipHull");
foreach (var hull in QSBWorldSync.GetWorldObjects<QSBShipHull>())
{
var attachedObject = hull.AttachedObject;
if (attachedObject == null)
{
var position = playerCamera.transform.position;
WriteLine(4, $"- Camera in vision cone:{ghost.AttachedObject._sensors.CheckPointInVisionCone(position)}");
WriteLine(4, $"- CheckLineOccluded:{ghost.AttachedObject._sensors.CheckLineOccluded(ghost.AttachedObject._sensors._sightOrigin.position, position)}");
WriteLine(3, $"- {hull.ObjectId} NULL ATTACHEDOBJECT", Color.red);
}
else
{
WriteLine(4, $"- CAMERA NULL", Color.red);
WriteLine(3, $"- {hull.AttachedObject.name}, Integrity:{hull.AttachedObject.integrity}");
}
}
#endregion
if (QSBWorldSync.AllObjectsReady)
{
var ghost = QSBWorldSync.GetWorldObjects<QSBGhostBrain>().First(x => x.AttachedObject._name == "Yubaba");
WriteLine(4, ghost.AttachedObject._name);
WriteLine(4, $"Action:{ghost.GetCurrentActionName()}");
WriteLine(4, $"Threat Awareness:{ghost.GetThreatAwareness()}");
var interestedPlayer = ghost._data.interestedPlayer;
WriteLine(4, $"InterestedPlayer:{(interestedPlayer == null ? "NULL" : interestedPlayer.player.PlayerId)}");
foreach (var player in ghost._data.players.Values)
{
WriteLine(4, $"{player.player.PlayerId}");
WriteLine(4, $"- isPlayerVisible:{player.sensor.isPlayerVisible}");
WriteLine(4, $"- isPlayerHeldLanternVisible:{player.sensor.isPlayerHeldLanternVisible}");
WriteLine(4, $"- isIlluminatedByPlayer:{player.sensor.isIlluminatedByPlayer}");
WriteLine(4, $"- isPlayerLocationKnown:{player.isPlayerLocationKnown}");
WriteLine(4, $"- timeSincePlayerLocationKnown:{player.timeSincePlayerLocationKnown}");
var lantern = player.player.AssignedSimulationLantern;
if (lantern != null)
{
WriteLine(4, $"- IsHeldByPlayer:{lantern.AttachedObject.GetLanternController().IsHeldByPlayer()}");
WriteLine(4, $"- Concealed:{lantern.AttachedObject.GetLanternController().IsConcealed()}");
}
else
{
WriteLine(4, $"- LANTERN NULL", Color.red);
}
var playerCamera = player.player.Camera;
if (playerCamera != null)
{
var position = playerCamera.transform.position;
WriteLine(4, $"- Camera in vision cone:{ghost.AttachedObject._sensors.CheckPointInVisionCone(position)}");
WriteLine(4, $"- CheckLineOccluded:{ghost.AttachedObject._sensors.CheckLineOccluded(ghost.AttachedObject._sensors._sightOrigin.position, position)}");
}
else
{
WriteLine(4, $"- CAMERA NULL", Color.red);
}
}
}
}