Merge pull request #369 from misternebula/fixes

Fix some things
This commit is contained in:
_nebula 2021-11-27 12:04:16 +00:00 committed by GitHub
commit 2daf92b7fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 81 additions and 24 deletions

View File

@ -70,7 +70,6 @@ namespace QSB.Anglerfish.TransformSync
base.OnRenderObject();
if (!QSBCore.WorldObjectsReady
|| !QSBCore.DebugMode
|| !QSBCore.ShowLinesInDebug
|| !IsReady
|| ReferenceTransform == null)

View File

@ -85,7 +85,7 @@ namespace QSB.Animation.Player.Thrusters
private void OnRenderObject()
{
if (!QSBCore.WorldObjectsReady || !QSBCore.DebugMode || !QSBCore.ShowLinesInDebug)
if (!QSBCore.WorldObjectsReady || !QSBCore.ShowLinesInDebug)
{
return;
}

View File

@ -136,7 +136,7 @@ namespace QSB.Menus
OnConnected();
if (QSBCore.DebugMode)
if (QSBCore.SkipTitleScreen)
{
Application.runInBackground = true;
var titleScreenManager = FindObjectOfType<TitleScreenManager>();

View File

@ -250,7 +250,6 @@ namespace QSB.Player.TransformSync
base.OnRenderObject();
if (!QSBCore.WorldObjectsReady
|| !QSBCore.DebugMode
|| !QSBCore.ShowLinesInDebug
|| !IsReady
|| ReferenceTransform == null)

View File

@ -77,4 +77,9 @@ copy /y "$(OwmlDir)\OWML.Abstractions.dll" $(UnityAssetsDir)
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<None Update="debugsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -60,8 +60,12 @@ namespace QSB
public static IModUnityEvents UnityEvents => Helper.Events.Unity;
public static string DefaultServerIP { get; private set; }
public static int Port { get; private set; }
public static bool DebugMode { get; private set; }
public static bool ShowLinesInDebug { get; private set; }
public static bool DebugMode => DebugSettings.DebugMode;
public static bool ShowLinesInDebug => DebugMode && DebugSettings.DrawLines;
public static bool ShowQuantumVisibilityObjects => DebugMode && DebugSettings.ShowQuantumVisibilityObjects;
public static bool ShowQuantumDebugBoxes => DebugMode && DebugSettings.ShowQuantumDebugBoxes;
public static bool AvoidTimeSync => DebugMode && DebugSettings.AvoidTimeSync;
public static bool SkipTitleScreen => DebugMode && DebugSettings.SkipTitleScreen;
public static AssetBundle NetworkAssetBundle { get; private set; }
public static AssetBundle InstrumentAssetBundle { get; private set; }
public static AssetBundle ConversationAssetBundle { get; private set; }
@ -76,6 +80,8 @@ namespace QSB
: GamePlatform.Steam;
public static IMenuAPI MenuApi { get; private set; }
private static DebugSettings DebugSettings { get; set; } = new DebugSettings();
public void Awake()
{
var instance = TextTranslation.Get().m_table;
@ -95,6 +101,13 @@ namespace QSB
ConversationAssetBundle = Helper.Assets.LoadBundle("AssetBundles/conversation");
DebugAssetBundle = Helper.Assets.LoadBundle("AssetBundles/debug");
DebugSettings = ModHelper.Storage.Load<DebugSettings>("debugsettings.json");
if (DebugSettings == null)
{
DebugSettings = new DebugSettings();
}
QSBPatchManager.Init();
gameObject.AddComponent<QSBNetworkManager>();
@ -167,9 +180,6 @@ namespace QSB
{
QSBNetworkManager.Instance.networkPort = Port;
}
DebugMode = config.GetSettingsValue<bool>("debugMode");
ShowLinesInDebug = config.GetSettingsValue<bool>("showLinesInDebug");
}
}
}

View File

@ -24,7 +24,7 @@ namespace QSB.QuantumSync.Events
public override void OnReceiveLocal(bool server, MultiStateChangeMessage message)
{
if (!QSBCore.DebugMode)
if (!QSBCore.ShowQuantumDebugBoxes)
{
return;
}

View File

@ -67,7 +67,7 @@ namespace QSB.QuantumSync
public void OnRenderObject()
{
if (!QSBCore.WorldObjectsReady || !QSBCore.DebugMode || !QSBCore.ShowLinesInDebug)
if (!QSBCore.WorldObjectsReady || !QSBCore.ShowLinesInDebug)
{
return;
}

View File

@ -26,7 +26,7 @@ namespace QSB.QuantumSync.WorldObjects
ObjectId = id;
AttachedObject = attachedObject;
if (QSBCore.DebugMode)
if (QSBCore.ShowQuantumDebugBoxes)
{
DebugBoxText = DebugBoxManager.CreateBox(AttachedObject.transform, 0, $"Multistate\r\nid:{id}\r\nstate:{CurrentState}").GetComponent<Text>();
}
@ -53,7 +53,7 @@ namespace QSB.QuantumSync.WorldObjects
QuantumStates[newStateIndex].SetVisible(true);
AttachedObject._stateIndex = newStateIndex;
if (QSBCore.DebugMode)
if (QSBCore.ShowQuantumDebugBoxes)
{
DebugBoxText.text = $"Multistate\r\nid:{ObjectId}\r\nstate:{CurrentState}";
}

View File

@ -64,7 +64,7 @@ namespace QSB.QuantumSync.WorldObjects
shape.OnShapeDeactivated += (Shape s)
=> QSBCore.UnityEvents.FireOnNextUpdate(() => OnDisable(s));
if (QSBCore.DebugMode)
if (QSBCore.ShowQuantumVisibilityObjects)
{
if (shape is BoxShape boxShape)
{

View File

@ -18,7 +18,7 @@ namespace QSB.QuantumSync.WorldObjects
ObjectId = id;
AttachedObject = quantumObject;
base.Init(quantumObject, id);
if (QSBCore.DebugMode)
if (QSBCore.ShowQuantumDebugBoxes)
{
DebugBoxText = DebugBoxManager.CreateBox(AttachedObject.transform, 0, $"Socketed\r\nid:{ObjectId}").GetComponent<Text>();
}

View File

@ -48,6 +48,11 @@ namespace QSB.RespawnSync
private void Init(OWScene newScene, bool inUniverse)
{
if (!QSBCore.IsInMultiplayer)
{
return;
}
QSBPlayerManager.ShowAllPlayers();
QSBPlayerManager.LocalPlayer.UpdateStatesFromObjects();
QSBPlayerManager.PlayerList.ForEach(x => x.IsDead = false);

View File

@ -20,6 +20,11 @@ namespace QSB.StatueSync
private void OnUniverseSceneLoaded(OWScene oldScene, OWScene newScene)
{
if (!QSBCore.IsInMultiplayer)
{
return;
}
QSBPlayerManager.ShowAllPlayers();
QSBPlayerManager.LocalPlayer.UpdateStatesFromObjects();
}

View File

@ -299,7 +299,6 @@ namespace QSB.Syncs
protected virtual void OnRenderObject()
{
if (!QSBCore.WorldObjectsReady
|| !QSBCore.DebugMode
|| !QSBCore.ShowLinesInDebug
|| !IsReady
|| ReferenceTransform == null)

View File

@ -121,7 +121,10 @@ namespace QSB.TimeSync
}
else
{
WakeUpOrSleep();
if (!QSBCore.SkipTitleScreen)
{
WakeUpOrSleep();
}
}
}
@ -240,7 +243,7 @@ namespace QSB.TimeSync
{
UpdateServer();
}
else if (IsLocalPlayer)
else if (IsLocalPlayer && !QSBCore.AvoidTimeSync)
{
UpdateClient();
}

View File

@ -76,7 +76,7 @@ namespace QSB.Tools.TranslatorTool
private void OnRenderObject()
{
if (!QSBCore.WorldObjectsReady || !QSBCore.DebugMode || !QSBCore.ShowLinesInDebug)
if (!QSBCore.WorldObjectsReady || !QSBCore.ShowLinesInDebug)
{
return;
}

View File

@ -0,0 +1,25 @@
using Newtonsoft.Json;
namespace QSB.Utility
{
public class DebugSettings
{
[JsonProperty("debugMode")]
public bool DebugMode { get; set; } = false;
[JsonProperty("drawLines")]
public bool DrawLines { get; set; } = false;
[JsonProperty("showQuantumVisibilityObjects")]
public bool ShowQuantumVisibilityObjects { get; set; } = false;
[JsonProperty("showQuantumDebugBoxes")]
public bool ShowQuantumDebugBoxes { get; set; } = false;
[JsonProperty("avoidTimeSync")]
public bool AvoidTimeSync { get; set; } = false;
[JsonProperty("skipTitleScreen")]
public bool SkipTitleScreen { get; set; } = false;
}
}

View File

@ -1,4 +1,5 @@
using QSB.Player;
using QSB.Player.TransformSync;
using System;
namespace QSB.Utility.VariableSync
@ -18,7 +19,7 @@ namespace QSB.Utility.VariableSync
}
else
{
if (QSBPlayerManager.LocalPlayer.IsReady)
if (PlayerTransformSync.LocalInstance != null && QSBPlayerManager.LocalPlayer.IsReady)
{
DebugLog.ToConsole($"Warning - Getter is null!", OWML.Common.MessageType.Warning);
}
@ -34,7 +35,7 @@ namespace QSB.Utility.VariableSync
}
else
{
if (QSBPlayerManager.LocalPlayer.IsReady)
if (PlayerTransformSync.LocalInstance != null && QSBPlayerManager.LocalPlayer.IsReady)
{
DebugLog.ToConsole($"Warning - Setter is null!", OWML.Common.MessageType.Warning);
}

8
QSB/debugsettings.json Normal file
View File

@ -0,0 +1,8 @@
{
"debugMode": true,
"drawLines": true,
"showQuantumVisibilityObjects": false,
"showQuantumDebugBoxes": false,
"avoidTimeSync": true,
"skipTitleScreen": true
}

View File

@ -2,8 +2,6 @@
"enabled": true,
"settings": {
"defaultServerIP": "localhost",
"port": 7777,
"debugMode": true,
"showLinesInDebug": false
"port": 7777
}
}