Skip to content

Commit 9a6f82f

Browse files
authored
Merge pull request #666 from qsb-dev/dev
1.0.1
2 parents 052d8f8 + 975c4bd commit 9a6f82f

File tree

6 files changed

+78
-5
lines changed

6 files changed

+78
-5
lines changed

DEVELOPMENT.md

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ The template for this file is this :
7676
"autoStart": false,
7777
"kickEveryone": false,
7878
"disableLoopDeath": false,
79+
"timeout": 25,
7980
"debugMode": false,
8081
"drawGui": false,
8182
"drawLines": false,
@@ -91,6 +92,7 @@ The template for this file is this :
9192
- autoStart - Host/connect automatically for faster testing.
9293
- kickEveryone - Kick anyone who joins a game.
9394
- disableLoopDeath - Make it so the loop doesn't end when everyone is dead.
95+
- timeout - How many seconds for your connection to timeout, in seconds.
9496
- debugMode - Enables debug mode. If this is set to `false`, none of the following settings do anything.
9597
- drawGui - Draws a GUI at the top of the screen that gives information on many things.
9698
- drawLines - Draws gizmo-esque lines around things. Indicates reference sectors/transforms, triggers, etc. LAGGY.

QSB/Animation/Player/HelmetAnimator.cs

+2-4
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,8 @@ public void SetHelmetInstant(bool helmetOn)
6767
{
6868
_fakeHelmetDitheringAnimator.SetVisible(false);
6969
FakeHelmet.gameObject.SetActive(false);
70-
if (!SuitGroup.activeSelf)
71-
{
72-
FakeHead.gameObject.SetActive(false);
73-
}
70+
// If the player is currently wearing their suit but has no helmet on, make sure to make the head visible (#655)
71+
FakeHead.gameObject.SetActive(SuitGroup.activeSelf);
7472
}
7573
}
7674

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
using QSB.Utility;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using UnityEngine;
5+
using UnityEngine.UI;
6+
7+
namespace QSB.Menus;
8+
9+
internal class PreflightChecklistAdjustment : MonoBehaviour, IAddComponentOnStart
10+
{
11+
private string[] _preflightOptionsToRemove = new string[]
12+
{
13+
"UIElement-FreezeTimeTranslating",
14+
"UIElement-FreezeTimeShipLog",
15+
"UIElement-FreezeTimeConversations",
16+
"UIElement-FreezeTimeTranslator",
17+
"UIElement-FreezeTimeDialogue"
18+
};
19+
20+
private MenuOption[] DestroyFreezeTimeOptions(MenuOption[] options)
21+
{
22+
var remainingMenuOptions = new List<MenuOption>();
23+
foreach (var preflightChecklistOption in options)
24+
{
25+
if (_preflightOptionsToRemove.Contains(preflightChecklistOption.name))
26+
{
27+
GameObject.Destroy(preflightChecklistOption.gameObject);
28+
}
29+
else
30+
{
31+
remainingMenuOptions.Add(preflightChecklistOption);
32+
}
33+
}
34+
return remainingMenuOptions.ToArray();
35+
}
36+
37+
public void Awake()
38+
{
39+
QSBSceneManager.OnPostSceneLoad += (_, loadScene) =>
40+
{
41+
if (QSBCore.IsInMultiplayer && loadScene.IsUniverseScene())
42+
{
43+
// PREFLIGHT MENU IN THE SHIP
44+
var suitMenuManager = GameObject.FindObjectOfType<SuitMenuManager>()._mainMenu;
45+
suitMenuManager._menuOptions = DestroyFreezeTimeOptions(suitMenuManager._menuOptions);
46+
47+
// Remove cosmetic elements from ship preflight checklist
48+
var suitOptionsMenu = GameObject.Find("PauseMenu/PreFlightCanvas/OptionsMenu-Panel/SuitOptionsDisplayPanel/SuitOptionsMainMenu/");
49+
GameObject.Destroy(suitOptionsMenu.transform.Find("FreezeTimeImage").gameObject);
50+
GameObject.Destroy(suitOptionsMenu.transform.Find("Box-FreezeTimeBorder").gameObject);
51+
52+
53+
// PREFLIGHT MENU IN THE OPTIONS MENU
54+
var settingsMenuView = GameObject.FindObjectOfType<SettingsMenuView>();
55+
settingsMenuView._listSettingsOptions = DestroyFreezeTimeOptions(settingsMenuView._listSettingsOptions);
56+
57+
// This one also points to the same options, have to remove the destroyed objects from it
58+
var menuGameplayPreFlight = GameObject.Find("PauseMenu/OptionsCanvas/OptionsMenu-Panel/OptionsDisplayPanel/GameplayMenu/MenuGameplayPreFl/").GetComponent<Menu>();
59+
Delay.RunNextFrame(() => menuGameplayPreFlight._menuOptions = menuGameplayPreFlight._menuOptions.Where(x => x != null).ToArray());
60+
}
61+
};
62+
}
63+
}

QSB/QSBNetworkManager.cs

+4
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,14 @@ public override void Awake()
7878

7979
{
8080
_kcpTransport = gameObject.AddComponent<kcp2k.KcpTransport>();
81+
// KCP uses milliseconds
82+
_kcpTransport.Timeout = QSBCore.DebugSettings.Timeout * 1000;
8183
}
8284

8385
{
8486
_steamTransport = gameObject.AddComponent<FizzySteamworks>();
87+
// Steam uses seconds
88+
_steamTransport.Timeout = QSBCore.DebugSettings.Timeout;
8589
}
8690

8791
{

QSB/Utility/DebugSettings.cs

+6
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ public class DebugSettings
3232
[JsonProperty("randomizeSkins")]
3333
public bool RandomizeSkins;
3434

35+
/// <summary>
36+
/// Timeout in seconds
37+
/// </summary>
38+
[JsonProperty("timeout")]
39+
public int Timeout = 25;
40+
3541
[JsonProperty("debugMode")]
3642
public bool DebugMode;
3743

QSB/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"body": "- Disable *all* other mods. (Can heavily affect performance)\n- Make sure you are not running any other network-intensive applications."
99
},
1010
"uniqueName": "Raicuparta.QuantumSpaceBuddies",
11-
"version": "1.0.0",
11+
"version": "1.0.1",
1212
"owmlVersion": "2.9.8",
1313
"dependencies": [ "_nebula.MenuFramework", "JohnCorby.VanillaFix" ],
1414
"pathsToPreserve": [ "debugsettings.json" ],

0 commit comments

Comments
 (0)