mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-29 09:32:38 +00:00
toggle-able DebugMode
This commit is contained in:
parent
573ee72d86
commit
ae90014137
@ -1,13 +1,13 @@
|
|||||||
using Mirror;
|
using Mirror;
|
||||||
using OWML.Common;
|
using OWML.Common;
|
||||||
using OWML.ModHelper;
|
using OWML.ModHelper;
|
||||||
using OWML.ModHelper.Input;
|
|
||||||
using QSB.EyeOfTheUniverse.GalaxyMap;
|
using QSB.EyeOfTheUniverse.GalaxyMap;
|
||||||
using QSB.EyeOfTheUniverse.MaskSync;
|
using QSB.EyeOfTheUniverse.MaskSync;
|
||||||
using QSB.Inputs;
|
using QSB.Inputs;
|
||||||
using QSB.Menus;
|
using QSB.Menus;
|
||||||
using QSB.Patches;
|
using QSB.Patches;
|
||||||
using QSB.Player;
|
using QSB.Player;
|
||||||
|
using QSB.QuantumSync;
|
||||||
using QSB.RespawnSync;
|
using QSB.RespawnSync;
|
||||||
using QSB.SatelliteSync;
|
using QSB.SatelliteSync;
|
||||||
using QSB.StatueSync;
|
using QSB.StatueSync;
|
||||||
@ -66,7 +66,7 @@ namespace QSB
|
|||||||
public static bool DLCInstalled => EntitlementsManager.IsDlcOwned() == EntitlementsManager.AsyncOwnershipStatus.Owned;
|
public static bool DLCInstalled => EntitlementsManager.IsDlcOwned() == EntitlementsManager.AsyncOwnershipStatus.Owned;
|
||||||
public static IMenuAPI MenuApi { get; private set; }
|
public static IMenuAPI MenuApi { get; private set; }
|
||||||
|
|
||||||
private static DebugSettings DebugSettings { get; set; } = new DebugSettings();
|
private static DebugSettings DebugSettings { get; set; } = new();
|
||||||
|
|
||||||
public void Awake()
|
public void Awake()
|
||||||
{
|
{
|
||||||
@ -80,7 +80,7 @@ namespace QSB
|
|||||||
Helper = ModHelper;
|
Helper = ModHelper;
|
||||||
DebugLog.ToConsole($"* Start of QSB version {QSBVersion} - authored by {Helper.Manifest.Author}", MessageType.Info);
|
DebugLog.ToConsole($"* Start of QSB version {QSBVersion} - authored by {Helper.Manifest.Author}", MessageType.Info);
|
||||||
|
|
||||||
MenuApi = ModHelper.Interaction.GetModApi<IMenuAPI>("_nebula.MenuFramework");
|
MenuApi = Helper.Interaction.GetModApi<IMenuAPI>("_nebula.MenuFramework");
|
||||||
|
|
||||||
NetworkAssetBundle = Helper.Assets.LoadBundle("AssetBundles/network");
|
NetworkAssetBundle = Helper.Assets.LoadBundle("AssetBundles/network");
|
||||||
InstrumentAssetBundle = Helper.Assets.LoadBundle("AssetBundles/instruments");
|
InstrumentAssetBundle = Helper.Assets.LoadBundle("AssetBundles/instruments");
|
||||||
@ -88,7 +88,7 @@ namespace QSB
|
|||||||
DebugAssetBundle = Helper.Assets.LoadBundle("AssetBundles/debug");
|
DebugAssetBundle = Helper.Assets.LoadBundle("AssetBundles/debug");
|
||||||
TextAssetsBundle = Helper.Assets.LoadBundle("AssetBundles/textassets");
|
TextAssetsBundle = Helper.Assets.LoadBundle("AssetBundles/textassets");
|
||||||
|
|
||||||
DebugSettings = ModHelper.Storage.Load<DebugSettings>("debugsettings.json");
|
DebugSettings = Helper.Storage.Load<DebugSettings>("debugsettings.json");
|
||||||
|
|
||||||
if (DebugSettings == null)
|
if (DebugSettings == null)
|
||||||
{
|
{
|
||||||
@ -149,6 +149,16 @@ namespace QSB
|
|||||||
QSBNetworkManager.singleton.Port = Port;
|
QSBNetworkManager.singleton.Port = Port;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ToggleDebug()
|
||||||
|
{
|
||||||
|
DebugSettings.DebugMode = !DebugSettings.DebugMode;
|
||||||
|
|
||||||
|
QuantumManager.UpdateFromDebugSetting();
|
||||||
|
DebugCameraSettings.UpdateFromDebugSetting();
|
||||||
|
|
||||||
|
DebugLog.ToConsole($"DEBUG MODE = {DebugMode}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,8 @@ namespace QSB.QuantumSync
|
|||||||
{
|
{
|
||||||
Shrine = QSBWorldSync.GetUnityObjects<QuantumShrine>().First();
|
Shrine = QSBWorldSync.GetUnityObjects<QuantumShrine>().First();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UpdateFromDebugSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayerLeave(PlayerInfo player)
|
public void PlayerLeave(PlayerInfo player)
|
||||||
@ -121,5 +123,82 @@ namespace QSB.QuantumSync
|
|||||||
var worldObj = obj.GetWorldObject<IQSBQuantumObject>();
|
var worldObj = obj.GetWorldObject<IQSBQuantumObject>();
|
||||||
return QSBPlayerManager.PlayerList.Where(x => x.EntangledObject == worldObj);
|
return QSBPlayerManager.PlayerList.Where(x => x.EntangledObject == worldObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region debug shapes
|
||||||
|
|
||||||
|
private static GameObject _debugSphere, _debugCube, _debugCapsule;
|
||||||
|
|
||||||
|
private class DebugShape : MonoBehaviour { }
|
||||||
|
|
||||||
|
public static void UpdateFromDebugSetting()
|
||||||
|
{
|
||||||
|
if (QSBCore.ShowQuantumVisibilityObjects)
|
||||||
|
{
|
||||||
|
if (_debugSphere == null)
|
||||||
|
{
|
||||||
|
_debugSphere = QSBCore.DebugAssetBundle.LoadAsset<GameObject>("Assets/Prefabs/Sphere.prefab");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_debugCube == null)
|
||||||
|
{
|
||||||
|
_debugCube = QSBCore.DebugAssetBundle.LoadAsset<GameObject>("Assets/Prefabs/Cube.prefab");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_debugCapsule == null)
|
||||||
|
{
|
||||||
|
_debugCapsule = QSBCore.DebugAssetBundle.LoadAsset<GameObject>("Assets/Prefabs/Capsule.prefab");
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var quantumObject in QSBWorldSync.GetWorldObjects<IQSBQuantumObject>())
|
||||||
|
{
|
||||||
|
foreach (var shape in quantumObject.GetAttachedShapes())
|
||||||
|
{
|
||||||
|
if (shape is BoxShape boxShape)
|
||||||
|
{
|
||||||
|
var newCube = Instantiate(_debugCube);
|
||||||
|
newCube.transform.parent = shape.transform;
|
||||||
|
newCube.transform.localPosition = Vector3.zero;
|
||||||
|
newCube.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||||
|
newCube.transform.localScale = boxShape.size;
|
||||||
|
newCube.AddComponent<DebugShape>();
|
||||||
|
}
|
||||||
|
else if (shape is SphereShape sphereShape)
|
||||||
|
{
|
||||||
|
var newSphere = Instantiate(_debugSphere);
|
||||||
|
newSphere.transform.parent = shape.transform;
|
||||||
|
newSphere.transform.localPosition = Vector3.zero;
|
||||||
|
newSphere.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||||
|
newSphere.transform.localScale = Vector3.one * (sphereShape.radius * 2);
|
||||||
|
newSphere.AddComponent<DebugShape>();
|
||||||
|
}
|
||||||
|
else if (shape is CapsuleShape capsuleShape)
|
||||||
|
{
|
||||||
|
var newCapsule = Instantiate(_debugCapsule);
|
||||||
|
newCapsule.transform.parent = shape.transform;
|
||||||
|
newCapsule.transform.localPosition = Vector3.zero;
|
||||||
|
newCapsule.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
||||||
|
newCapsule.transform.localScale = new Vector3(capsuleShape.radius * 2, capsuleShape.height, capsuleShape.radius * 2);
|
||||||
|
newCapsule.AddComponent<DebugShape>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach (var quantumObject in QSBWorldSync.GetWorldObjects<IQSBQuantumObject>())
|
||||||
|
{
|
||||||
|
foreach (var shape in quantumObject.GetAttachedShapes())
|
||||||
|
{
|
||||||
|
var debugShape = shape.GetComponentInChildren<DebugShape>();
|
||||||
|
if (debugShape)
|
||||||
|
{
|
||||||
|
Destroy(debugShape.gameObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,57 +38,6 @@ namespace QSB.QuantumSync.WorldObjects
|
|||||||
|
|
||||||
public override void Init()
|
public override void Init()
|
||||||
{
|
{
|
||||||
if (QSBCore.ShowQuantumVisibilityObjects)
|
|
||||||
{
|
|
||||||
var debugBundle = QSBCore.DebugAssetBundle;
|
|
||||||
var sphere = debugBundle.LoadAsset<GameObject>("Assets/Prefabs/Sphere.prefab");
|
|
||||||
var cube = debugBundle.LoadAsset<GameObject>("Assets/Prefabs/Cube.prefab");
|
|
||||||
var capsule = debugBundle.LoadAsset<GameObject>("Assets/Prefabs/Capsule.prefab");
|
|
||||||
|
|
||||||
if (cube == null)
|
|
||||||
{
|
|
||||||
DebugLog.DebugWrite($"CUBE IS NULL");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sphere == null)
|
|
||||||
{
|
|
||||||
DebugLog.DebugWrite($"SPHERE IS NULL");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (capsule == null)
|
|
||||||
{
|
|
||||||
DebugLog.DebugWrite($"CAPSULE IS NULL");
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var shape in GetAttachedShapes())
|
|
||||||
{
|
|
||||||
if (shape is BoxShape boxShape)
|
|
||||||
{
|
|
||||||
var newCube = Object.Instantiate(cube);
|
|
||||||
newCube.transform.parent = shape.transform;
|
|
||||||
newCube.transform.localPosition = Vector3.zero;
|
|
||||||
newCube.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
|
||||||
newCube.transform.localScale = boxShape.size;
|
|
||||||
}
|
|
||||||
else if (shape is SphereShape sphereShape)
|
|
||||||
{
|
|
||||||
var newSphere = Object.Instantiate(sphere);
|
|
||||||
newSphere.transform.parent = shape.transform;
|
|
||||||
newSphere.transform.localPosition = Vector3.zero;
|
|
||||||
newSphere.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
|
||||||
newSphere.transform.localScale = Vector3.one * (sphereShape.radius * 2);
|
|
||||||
}
|
|
||||||
else if (shape is CapsuleShape capsuleShape)
|
|
||||||
{
|
|
||||||
var newCapsule = Object.Instantiate(capsule);
|
|
||||||
newCapsule.transform.parent = shape.transform;
|
|
||||||
newCapsule.transform.localPosition = Vector3.zero;
|
|
||||||
newCapsule.transform.localRotation = Quaternion.Euler(0, 0, 0);
|
|
||||||
newCapsule.transform.localScale = new Vector3(capsuleShape.radius * 2, capsuleShape.height, capsuleShape.radius * 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StartDelayedReady();
|
StartDelayedReady();
|
||||||
QSBCore.UnityEvents.FireInNUpdates(LateInit, 5);
|
QSBCore.UnityEvents.FireInNUpdates(LateInit, 5);
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ namespace QSB.TimeSync
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!QSBCore.SkipTitleScreen)
|
if (!QSBCore.AvoidTimeSync)
|
||||||
{
|
{
|
||||||
WakeUpOrSleep();
|
WakeUpOrSleep();
|
||||||
}
|
}
|
||||||
|
@ -31,16 +31,18 @@ namespace QSB.Utility
|
|||||||
|
|
||||||
private void DamageShipElectricalSystem() => ShipManager.Instance.ShipElectricalComponent.SetDamaged(true);
|
private void DamageShipElectricalSystem() => ShipManager.Instance.ShipElectricalComponent.SetDamaged(true);
|
||||||
|
|
||||||
private void Awake()
|
|
||||||
{
|
|
||||||
if (!QSBCore.DebugMode)
|
|
||||||
{
|
|
||||||
Destroy(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
|
if (Keyboard.current[Key.Q].isPressed && Keyboard.current[Key.D].wasPressedThisFrame)
|
||||||
|
{
|
||||||
|
QSBCore.ToggleDebug();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!QSBCore.DebugMode)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 1 - Warp to first non local player
|
* 1 - Warp to first non local player
|
||||||
* 2 - Set time flowing
|
* 2 - Set time flowing
|
||||||
@ -51,7 +53,7 @@ namespace QSB.Utility
|
|||||||
* 7 - Warp to vessel
|
* 7 - Warp to vessel
|
||||||
* 8 - Place warp core into vessel
|
* 8 - Place warp core into vessel
|
||||||
* 9 - Load eye scene
|
* 9 - Load eye scene
|
||||||
* 0 -
|
* 0 - Die
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (Keyboard.current[Key.Numpad1].wasPressedThisFrame)
|
if (Keyboard.current[Key.Numpad1].wasPressedThisFrame)
|
||||||
@ -115,6 +117,11 @@ namespace QSB.Utility
|
|||||||
LoadManager.LoadSceneAsync(OWScene.EyeOfTheUniverse, true, LoadManager.FadeType.ToWhite);
|
LoadManager.LoadSceneAsync(OWScene.EyeOfTheUniverse, true, LoadManager.FadeType.ToWhite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Keyboard.current[Key.Numpad0].wasPressedThisFrame)
|
||||||
|
{
|
||||||
|
Locator.GetDeathManager().KillPlayer(DeathType.Default);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,16 +4,29 @@ namespace QSB.Utility
|
|||||||
{
|
{
|
||||||
internal class DebugCameraSettings : MonoBehaviour
|
internal class DebugCameraSettings : MonoBehaviour
|
||||||
{
|
{
|
||||||
void Start()
|
public static void UpdateFromDebugSetting()
|
||||||
{
|
{
|
||||||
if (QSBCore.GreySkybox)
|
if (QSBCore.GreySkybox)
|
||||||
{
|
{
|
||||||
QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
|
QSBSceneManager.OnSceneLoaded += OnSceneLoaded;
|
||||||
Camera.main.backgroundColor = Color.gray;
|
Camera.main.backgroundColor = Color.gray;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QSBSceneManager.OnSceneLoaded -= OnSceneLoaded;
|
||||||
|
Camera.main.backgroundColor = _origColor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSceneLoaded(OWScene arg1, OWScene arg2, bool arg3)
|
private static Color _origColor;
|
||||||
|
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
_origColor = Camera.main.backgroundColor;
|
||||||
|
UpdateFromDebugSetting();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnSceneLoaded(OWScene arg1, OWScene arg2, bool arg3)
|
||||||
=> Camera.main.backgroundColor = Color.gray;
|
=> Camera.main.backgroundColor = Color.gray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,16 +30,7 @@ namespace QSB.Utility
|
|||||||
private readonly GUIStyle guiGUIStyle = new();
|
private readonly GUIStyle guiGUIStyle = new();
|
||||||
private static readonly GUIStyle labelGUIStyle = new();
|
private static readonly GUIStyle labelGUIStyle = new();
|
||||||
|
|
||||||
private void Awake()
|
private void Awake() => guiGUIStyle.fontSize = 9;
|
||||||
{
|
|
||||||
if (!QSBCore.DebugMode)
|
|
||||||
{
|
|
||||||
Destroy(this);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
guiGUIStyle.fontSize = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void WriteLine(int columnID, string text)
|
private void WriteLine(int columnID, string text)
|
||||||
{
|
{
|
||||||
@ -81,7 +72,8 @@ namespace QSB.Utility
|
|||||||
|
|
||||||
public void OnGUI()
|
public void OnGUI()
|
||||||
{
|
{
|
||||||
if (Event.current.type != EventType.Repaint)
|
if (!QSBCore.DebugMode ||
|
||||||
|
Event.current.type != EventType.Repaint)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user