2020-02-10 23:03:28 +01:00
|
|
|
|
using OWML.Common;
|
|
|
|
|
using OWML.ModHelper;
|
2020-08-23 15:51:45 +02:00
|
|
|
|
using QSB.DeathSync;
|
2020-08-12 21:58:29 +02:00
|
|
|
|
using QSB.ElevatorSync;
|
2020-08-13 14:32:58 +01:00
|
|
|
|
using QSB.GeyserSync;
|
2020-08-20 21:07:40 +02:00
|
|
|
|
using QSB.Tools;
|
2020-08-16 17:15:36 +02:00
|
|
|
|
using QSB.TransformSync;
|
2020-07-30 22:27:14 +02:00
|
|
|
|
using QSB.Utility;
|
2020-02-10 23:03:28 +01:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.Networking;
|
|
|
|
|
|
2020-02-15 20:48:02 +01:00
|
|
|
|
namespace QSB
|
|
|
|
|
{
|
|
|
|
|
public class QSB : ModBehaviour
|
|
|
|
|
{
|
2020-08-23 12:42:48 +02:00
|
|
|
|
public static IModHelper Helper { get; private set; }
|
|
|
|
|
public static string DefaultServerIP { get; private set; }
|
|
|
|
|
public static int Port { get; private set; }
|
|
|
|
|
public static bool DebugMode { get; private set; }
|
|
|
|
|
public static AssetBundle NetworkAssetBundle { get; private set; }
|
2020-02-10 23:03:28 +01:00
|
|
|
|
|
2020-02-15 20:48:02 +01:00
|
|
|
|
private void Awake()
|
|
|
|
|
{
|
2020-02-10 23:03:28 +01:00
|
|
|
|
Application.runInBackground = true;
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-15 20:48:02 +01:00
|
|
|
|
private void Start()
|
|
|
|
|
{
|
2020-08-20 14:10:37 +01:00
|
|
|
|
Helper = ModHelper;
|
2020-08-20 14:47:44 +01:00
|
|
|
|
DebugLog.ToConsole($"* Start of QSB version {Helper.Manifest.Version} - authored by {Helper.Manifest.Author}", MessageType.Info);
|
2020-08-20 19:31:10 +01:00
|
|
|
|
|
2020-08-17 16:51:56 +01:00
|
|
|
|
NetworkAssetBundle = Helper.Assets.LoadBundle("assets/network");
|
2020-08-20 21:07:40 +02:00
|
|
|
|
DebugLog.LogState("NetworkBundle", NetworkAssetBundle);
|
2020-08-23 15:51:45 +02:00
|
|
|
|
|
2020-08-23 15:54:00 +02:00
|
|
|
|
ProbePatches.DoPatches();
|
|
|
|
|
DeathPatches.DoPatches();
|
2020-02-10 23:03:28 +01:00
|
|
|
|
|
2020-08-20 14:47:44 +01:00
|
|
|
|
// Turns out these are very finicky about what order they go. QSBNetworkManager seems to
|
|
|
|
|
// want to go first-ish, otherwise the NetworkManager complains about the PlayerPrefab being
|
2020-08-23 12:42:48 +02:00
|
|
|
|
// null (even though it isn't...)
|
2020-08-20 14:47:44 +01:00
|
|
|
|
gameObject.AddComponent<QSBNetworkManager>();
|
|
|
|
|
gameObject.AddComponent<NetworkManagerHUD>();
|
2020-03-14 21:42:43 +01:00
|
|
|
|
gameObject.AddComponent<DebugActions>();
|
2020-08-12 22:22:52 +02:00
|
|
|
|
gameObject.AddComponent<ElevatorManager>();
|
2020-08-13 19:25:12 +02:00
|
|
|
|
gameObject.AddComponent<GeyserManager>();
|
2020-08-16 17:15:36 +02:00
|
|
|
|
gameObject.AddComponent<QSBSectorManager>();
|
2020-03-02 17:34:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Configure(IModConfig config)
|
|
|
|
|
{
|
|
|
|
|
DefaultServerIP = config.GetSettingsValue<string>("defaultServerIP");
|
2020-08-23 12:42:48 +02:00
|
|
|
|
Port = config.GetSettingsValue<int>("port");
|
|
|
|
|
if (QSBNetworkManager.Instance != null)
|
|
|
|
|
{
|
|
|
|
|
QSBNetworkManager.Instance.networkPort = Port;
|
|
|
|
|
}
|
2020-03-14 21:42:43 +01:00
|
|
|
|
DebugMode = config.GetSettingsValue<bool>("debugMode");
|
2020-02-10 23:03:28 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|