From 0e2c40644f12d620d483a95bee63c76d1d096530 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Fri, 10 Feb 2023 18:15:53 -0800 Subject: [PATCH 1/9] better hack --- QSB/Localization/QSBLocalization.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/QSB/Localization/QSBLocalization.cs b/QSB/Localization/QSBLocalization.cs index a81af601..70a6d918 100644 --- a/QSB/Localization/QSBLocalization.cs +++ b/QSB/Localization/QSBLocalization.cs @@ -43,8 +43,21 @@ public static class QSBLocalization return; } + // just use the system language until the profile is loaded and does SetLanguage // hack to stop things from breaking - Current = _translations[0]; + { + var language = TextTranslation.Get().GetSystemLanguage(); + DebugLog.DebugWrite($"Language changed to {language}"); + var newTranslation = _translations.FirstOrDefault(x => x.Language == language); + + if (newTranslation == default) + { + DebugLog.ToConsole($"Error - Could not find translation for language {language}! Defaulting to English."); + newTranslation = _translations.First(x => x.Language == TextTranslation.Language.ENGLISH); + } + + Current = newTranslation; + } TextTranslation.Get().OnLanguageChanged += OnLanguageChanged; } From 95361ade694cf3f9a712162513a9a82444cabfce Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Fri, 10 Feb 2023 20:01:29 -0800 Subject: [PATCH 2/9] dont move player if attached --- QSB/EchoesOfTheEye/RaftSync/TransformSync/RaftTransformSync.cs | 1 + QSB/ShipSync/TransformSync/ShipTransformSync.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/QSB/EchoesOfTheEye/RaftSync/TransformSync/RaftTransformSync.cs b/QSB/EchoesOfTheEye/RaftSync/TransformSync/RaftTransformSync.cs index f7a3d9ed..efde9e70 100644 --- a/QSB/EchoesOfTheEye/RaftSync/TransformSync/RaftTransformSync.cs +++ b/QSB/EchoesOfTheEye/RaftSync/TransformSync/RaftTransformSync.cs @@ -11,6 +11,7 @@ namespace QSB.EchoesOfTheEye.RaftSync.TransformSync; public class RaftTransformSync : UnsectoredRigidbodySync, ILinkedNetworkBehaviour { private bool ShouldMovePlayer => + !PlayerState.IsAttached() && ( Locator.GetPlayerController().GetGroundBody() == null || Locator.GetPlayerController().GetGroundBody() == AttachedRigidbody diff --git a/QSB/ShipSync/TransformSync/ShipTransformSync.cs b/QSB/ShipSync/TransformSync/ShipTransformSync.cs index 5bd46328..677cc9ef 100644 --- a/QSB/ShipSync/TransformSync/ShipTransformSync.cs +++ b/QSB/ShipSync/TransformSync/ShipTransformSync.cs @@ -124,6 +124,7 @@ public class ShipTransformSync : SectoredRigidbodySync private bool ShouldMovePlayer => + !PlayerState.IsAttached() && ( Locator.GetPlayerController().GetGroundBody() == null || Locator.GetPlayerController().GetGroundBody() == AttachedRigidbody From 8609f5baf0370e42dded59da4d8d0add55ed9fcb Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Fri, 10 Feb 2023 20:24:09 -0800 Subject: [PATCH 3/9] silly invincibility hack --- QSB/TimeSync/TimeSyncUI.cs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/QSB/TimeSync/TimeSyncUI.cs b/QSB/TimeSync/TimeSyncUI.cs index d57833e4..60bce5e8 100644 --- a/QSB/TimeSync/TimeSyncUI.cs +++ b/QSB/TimeSync/TimeSyncUI.cs @@ -70,6 +70,15 @@ internal class TimeSyncUI : MonoBehaviour, IAddComponentOnStart enabled = true; _canvas.enabled = true; Canvas.willRenderCanvases += OnWillRenderCanvases; + + // silly hack that shouldnt be in the ui component but oh well + Locator.GetPlayerTransform().GetComponent()._invincible = true; + Locator.GetDeathManager()._invincible = true; + var shipTransform = Locator.GetShipTransform(); + if (shipTransform) + { + shipTransform.GetComponentInChildren()._invincible = true; + } } private void EndTimeSync() @@ -78,6 +87,15 @@ internal class TimeSyncUI : MonoBehaviour, IAddComponentOnStart enabled = false; _canvas.enabled = false; Canvas.willRenderCanvases -= OnWillRenderCanvases; + + // silly hack that shouldnt be in the ui component but oh well + Locator.GetPlayerTransform().GetComponent()._invincible = false; + Locator.GetDeathManager()._invincible = false; + var shipTransform = Locator.GetShipTransform(); + if (shipTransform) + { + shipTransform.GetComponentInChildren()._invincible = false; + } } private void OnWillRenderCanvases() @@ -133,4 +151,4 @@ internal class TimeSyncUI : MonoBehaviour, IAddComponentOnStart _text.text = text; } -} \ No newline at end of file +} From b26832f65b196544d3ff7f12d2ac1d5509ac622a Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Fri, 10 Feb 2023 20:24:29 -0800 Subject: [PATCH 4/9] todo --- QSB/TimeSync/TimeSyncUI.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/QSB/TimeSync/TimeSyncUI.cs b/QSB/TimeSync/TimeSyncUI.cs index 60bce5e8..0f5807f7 100644 --- a/QSB/TimeSync/TimeSyncUI.cs +++ b/QSB/TimeSync/TimeSyncUI.cs @@ -72,6 +72,7 @@ internal class TimeSyncUI : MonoBehaviour, IAddComponentOnStart Canvas.willRenderCanvases += OnWillRenderCanvases; // silly hack that shouldnt be in the ui component but oh well + // TODO may have to wait a frame cuz Locator? Locator.GetPlayerTransform().GetComponent()._invincible = true; Locator.GetDeathManager()._invincible = true; var shipTransform = Locator.GetShipTransform(); @@ -89,6 +90,7 @@ internal class TimeSyncUI : MonoBehaviour, IAddComponentOnStart Canvas.willRenderCanvases -= OnWillRenderCanvases; // silly hack that shouldnt be in the ui component but oh well + // TODO may have to wait a frame cuz Locator? Locator.GetPlayerTransform().GetComponent()._invincible = false; Locator.GetDeathManager()._invincible = false; var shipTransform = Locator.GetShipTransform(); From eae2cf3c257d94da3f4e8d8baf9dc4b5f92b7ffb Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Fri, 10 Feb 2023 20:25:49 -0800 Subject: [PATCH 5/9] okay nvm --- QSB/TimeSync/TimeSyncUI.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/QSB/TimeSync/TimeSyncUI.cs b/QSB/TimeSync/TimeSyncUI.cs index 0f5807f7..60bce5e8 100644 --- a/QSB/TimeSync/TimeSyncUI.cs +++ b/QSB/TimeSync/TimeSyncUI.cs @@ -72,7 +72,6 @@ internal class TimeSyncUI : MonoBehaviour, IAddComponentOnStart Canvas.willRenderCanvases += OnWillRenderCanvases; // silly hack that shouldnt be in the ui component but oh well - // TODO may have to wait a frame cuz Locator? Locator.GetPlayerTransform().GetComponent()._invincible = true; Locator.GetDeathManager()._invincible = true; var shipTransform = Locator.GetShipTransform(); @@ -90,7 +89,6 @@ internal class TimeSyncUI : MonoBehaviour, IAddComponentOnStart Canvas.willRenderCanvases -= OnWillRenderCanvases; // silly hack that shouldnt be in the ui component but oh well - // TODO may have to wait a frame cuz Locator? Locator.GetPlayerTransform().GetComponent()._invincible = false; Locator.GetDeathManager()._invincible = false; var shipTransform = Locator.GetShipTransform(); From 52c7ed923926a23a6f2c43c51d742fb116c5433c Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Fri, 10 Feb 2023 21:25:20 -0800 Subject: [PATCH 6/9] Revert "dont move player if attached" This reverts commit 95361ade694cf3f9a712162513a9a82444cabfce. --- QSB/EchoesOfTheEye/RaftSync/TransformSync/RaftTransformSync.cs | 1 - QSB/ShipSync/TransformSync/ShipTransformSync.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/QSB/EchoesOfTheEye/RaftSync/TransformSync/RaftTransformSync.cs b/QSB/EchoesOfTheEye/RaftSync/TransformSync/RaftTransformSync.cs index efde9e70..f7a3d9ed 100644 --- a/QSB/EchoesOfTheEye/RaftSync/TransformSync/RaftTransformSync.cs +++ b/QSB/EchoesOfTheEye/RaftSync/TransformSync/RaftTransformSync.cs @@ -11,7 +11,6 @@ namespace QSB.EchoesOfTheEye.RaftSync.TransformSync; public class RaftTransformSync : UnsectoredRigidbodySync, ILinkedNetworkBehaviour { private bool ShouldMovePlayer => - !PlayerState.IsAttached() && ( Locator.GetPlayerController().GetGroundBody() == null || Locator.GetPlayerController().GetGroundBody() == AttachedRigidbody diff --git a/QSB/ShipSync/TransformSync/ShipTransformSync.cs b/QSB/ShipSync/TransformSync/ShipTransformSync.cs index 677cc9ef..5bd46328 100644 --- a/QSB/ShipSync/TransformSync/ShipTransformSync.cs +++ b/QSB/ShipSync/TransformSync/ShipTransformSync.cs @@ -124,7 +124,6 @@ public class ShipTransformSync : SectoredRigidbodySync private bool ShouldMovePlayer => - !PlayerState.IsAttached() && ( Locator.GetPlayerController().GetGroundBody() == null || Locator.GetPlayerController().GetGroundBody() == AttachedRigidbody From 6a074e7feb83b0caaa2a5f9e9eba81d6b92190ff Mon Sep 17 00:00:00 2001 From: isrecalpear <64584752+isrecalpear@users.noreply.github.com> Date: Sun, 12 Feb 2023 19:15:31 +0800 Subject: [PATCH 7/9] Fix an inappropriate translation --- QSB/Translations/zh_CN.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/QSB/Translations/zh_CN.json b/QSB/Translations/zh_CN.json index d64142b0..79065b52 100644 --- a/QSB/Translations/zh_CN.json +++ b/QSB/Translations/zh_CN.json @@ -41,7 +41,7 @@ "GalaxyMapEveryoneNotPresent": "现在还不是时候。需要所有人见证这个时刻。", "YouAreDead": "你死了。", "WaitingForRespawn": "等待某人将你复活……", - "WaitingForAllToDie": "等待{0}死亡……", + "WaitingForAllToDie": "等待剩余{0}人死亡……", "AttachToShip": "固定在飞船上", "DetachFromShip": "取消固定", "DeathMessages": { @@ -123,4 +123,4 @@ "{0}被电梯挤扁了" ] } -} \ No newline at end of file +} From 385ebd543ef0adfeda978a63812916377e3f7b84 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Tue, 28 Feb 2023 19:45:35 -0800 Subject: [PATCH 8/9] do this properly --- QSB/Utility/DebugLog.cs | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/QSB/Utility/DebugLog.cs b/QSB/Utility/DebugLog.cs index 90badb74..06cbe18f 100644 --- a/QSB/Utility/DebugLog.cs +++ b/QSB/Utility/DebugLog.cs @@ -16,19 +16,20 @@ public static class DebugLog public static void ToConsole(string message, MessageType type = MessageType.Message) { - if (QSBCore.Helper == null) - { - // yes i know this is only meant for OWML, but it's useful as a backup - ModConsole.OwmlConsole.WriteLine(message, type, GetCallingType()); - return; - } - if (QSBCore.DebugSettings.InstanceIdInLogs) { message = $"[{ProcessInstanceId}] " + message; } - QSBCore.Helper.Console.WriteLine(message, type, GetCallingType()); + if (QSBCore.Helper == null) + { + // yes i know this is only meant for OWML, but it's useful as a backup + ModConsole.OwmlConsole.WriteLine(message, type, GetCallingType()); + } + else + { + QSBCore.Helper.Console.WriteLine(message, type, GetCallingType()); + } } public static void ToHud(string message) @@ -50,13 +51,6 @@ public static class DebugLog public static void DebugWrite(string message, MessageType type = MessageType.Message) { - if (QSBCore.Helper == null) - { - // yes i know this is only meant for OWML, but it's useful as a backup - ModConsole.OwmlConsole.WriteLine(message, type, GetCallingType()); - return; - } - if (QSBCore.DebugSettings.DebugMode) { ToConsole(message, type); From 7bb2f1ca72a0257c4e2182ef83610df47ab17cd8 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Tue, 28 Feb 2023 19:50:33 -0800 Subject: [PATCH 9/9] DebugLog: slight refactor --- QSB/Utility/DebugLog.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/QSB/Utility/DebugLog.cs b/QSB/Utility/DebugLog.cs index 06cbe18f..8c17293a 100644 --- a/QSB/Utility/DebugLog.cs +++ b/QSB/Utility/DebugLog.cs @@ -61,6 +61,6 @@ public static class DebugLog new StackTrace(2) // skip this function and calling function .GetFrames()! .Select(x => x.GetMethod().DeclaringType!) - .First(x => x != typeof(DebugLog) && !x.IsDefined(typeof(CompilerGeneratedAttribute))) + .First(x => x != typeof(DebugLog) && !x.IsDefined(typeof(CompilerGeneratedAttribute), true)) .Name; }