Compare commits
No commits in common. "main" and "1.0.3" have entirely different histories.
10 changed files with 80 additions and 235 deletions
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
|
@ -10,9 +10,7 @@
|
||||||
"GBSU",
|
"GBSU",
|
||||||
"gmenu",
|
"gmenu",
|
||||||
"hlapi",
|
"hlapi",
|
||||||
"maplist",
|
|
||||||
"netstandard",
|
"netstandard",
|
||||||
"Newtonsoft",
|
|
||||||
"playercount",
|
"playercount",
|
||||||
"protontricks",
|
"protontricks",
|
||||||
"rotationconfig",
|
"rotationconfig",
|
||||||
|
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
using GB.Core;
|
|
||||||
using GB.Networking.Utils;
|
|
||||||
using GB.Platform.Lobby;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace GBSU.Addons;
|
|
||||||
|
|
||||||
public class GBSUClient : MonoBehaviour
|
|
||||||
{
|
|
||||||
public static void JoinServer(string serverip, int serverport)
|
|
||||||
{
|
|
||||||
if (!Helper.hosting)
|
|
||||||
{
|
|
||||||
LobbyManager.Instance.LobbyStates.IP = serverip;
|
|
||||||
LobbyManager.Instance.LobbyStates.Port = serverport;
|
|
||||||
LobbyManager.Instance.LobbyStates.CurrentState = LobbyState.State.Ready | LobbyState.State.InGame;
|
|
||||||
LobbyManager.Instance.LocalBeasts.SetupNetMemberContext(true);
|
|
||||||
MonoSingleton<Global>.Instance.UNetManager.LaunchClient(serverip, serverport);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GBSUGui.PushError("You are currently hosting a game! Please stop your server before attempting to join.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// this method should be used when something has went wrong
|
|
||||||
// because players can just use the escape menu to exit
|
|
||||||
public static void DisconnectFromServer()
|
|
||||||
{
|
|
||||||
GBNetUtils.DisconnectSelf(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using BepInEx;
|
using BepInEx;
|
||||||
|
using CoreNet.Config;
|
||||||
|
using GB.Config;
|
||||||
|
using GB.Core;
|
||||||
|
using GB.Game;
|
||||||
using GB.Platform.Lobby;
|
using GB.Platform.Lobby;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
|
|
@ -11,13 +15,28 @@ namespace GBSU.Addons;
|
||||||
public class GBSUGui : MonoBehaviour
|
public class GBSUGui : MonoBehaviour
|
||||||
{
|
{
|
||||||
private bool menu_shown;
|
private bool menu_shown;
|
||||||
private static bool error_shown;
|
private bool error_shown;
|
||||||
//private string _currentMap;
|
//private string _currentMap;
|
||||||
public Rect gmenu = new(Screen.width / 2, 0, 385f, 690f);
|
public Rect gmenu = new(Screen.width / 2, 0, 385f, 690f);
|
||||||
public Rect error_dialog = new(Screen.width / 2, 0, 520f, 175f);
|
public Rect error_dialog = new(Screen.width / 2, 0, 520f, 175f);
|
||||||
private static string error_msg = "Unknown error!";
|
private string error_msg = "Unknown error!";
|
||||||
|
|
||||||
readonly IInputSystem inputSystem = UnityInput.Current;
|
readonly IInputSystem inputSystem = UnityInput.Current;
|
||||||
|
string serverip = null;
|
||||||
|
int serverport = 5999;
|
||||||
|
string currentmap;
|
||||||
|
bool hosting = false;
|
||||||
|
private void Start()
|
||||||
|
{
|
||||||
|
if (CommandLineParser.Instance.KeyExists("-ip"))
|
||||||
|
{
|
||||||
|
serverip = CommandLineParser.Instance.GetValueForKey("-ip", true);
|
||||||
|
}
|
||||||
|
if (CommandLineParser.Instance.KeyExists("-port"))
|
||||||
|
{
|
||||||
|
int.TryParse(CommandLineParser.Instance.GetValueForKey("-port", true), out serverport);
|
||||||
|
}
|
||||||
|
}
|
||||||
private void Update()
|
private void Update()
|
||||||
{
|
{
|
||||||
if (inputSystem.GetKeyDown(KeyCode.RightShift))
|
if (inputSystem.GetKeyDown(KeyCode.RightShift))
|
||||||
|
|
@ -25,6 +44,8 @@ public class GBSUGui : MonoBehaviour
|
||||||
//Plugin.Log.LogInfo("Toggling GBSU menu...");
|
//Plugin.Log.LogInfo("Toggling GBSU menu...");
|
||||||
ToggleMenu();
|
ToggleMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentmap = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ToggleMenu()
|
private void ToggleMenu()
|
||||||
|
|
@ -46,7 +67,7 @@ public class GBSUGui : MonoBehaviour
|
||||||
GUI.skin.label.alignment = TextAnchor.UpperLeft;
|
GUI.skin.label.alignment = TextAnchor.UpperLeft;
|
||||||
|
|
||||||
GUILayout.Label($@"==Guide==
|
GUILayout.Label($@"==Guide==
|
||||||
Set CLI arguments: -ip, -port (optionally -maplist)
|
Set CLI arguments: -ip, -port
|
||||||
|
|
||||||
[Hosting]
|
[Hosting]
|
||||||
1. Create a config in Gang Beasts_Data/Config/Rotation/config.json
|
1. Create a config in Gang Beasts_Data/Config/Rotation/config.json
|
||||||
|
|
@ -59,26 +80,30 @@ Set CLI arguments: -ip, -port (optionally -maplist)
|
||||||
{
|
{
|
||||||
Application.Quit(0);
|
Application.Quit(0);
|
||||||
}
|
}
|
||||||
if (GUI.Button(new Rect(320f, 45f, 55f, 30f), "Menu"))
|
if (serverip != null)
|
||||||
{
|
|
||||||
Helper.SwitchToMenu();
|
|
||||||
}
|
|
||||||
if (Helper.serverip != null)
|
|
||||||
{
|
{
|
||||||
if (GUI.Button(new Rect(20f, 260f, 170f, 30f), "Host"))
|
if (GUI.Button(new Rect(20f, 260f, 170f, 30f), "Host"))
|
||||||
{
|
{
|
||||||
if (LobbyManager.Instance.LobbyStates.SelfState == LobbyState.Game.Menu)
|
if (LobbyManager.Instance.LobbyStates.SelfState == LobbyState.Game.Menu)
|
||||||
{
|
{
|
||||||
if (File.Exists(Helper.GameConfigPath))
|
if (File.Exists(Helper.RotationFolderPath + "config.json"))
|
||||||
{
|
{
|
||||||
|
hosting = true;
|
||||||
|
|
||||||
|
AudioListener.volume = 0; // mute game audio
|
||||||
|
|
||||||
|
Plugin.AddServerComp(); // add custom GBSU server component
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
GBSUServer.StartServer();
|
RotationConfig gameConfig = GBConfigLoader.LoadRotationConfig("config.json", true); // load rotation config from Config/Rotation/config.json
|
||||||
|
ServerConfig serverConfig = NetConfigLoader.LoadServerConfig(); // load default server config, because it can be overridden by args like -ip and -port
|
||||||
|
MonoSingleton<Global>.Instance.UNetManager.LaunchServer(serverConfig); // launch the server with the server config
|
||||||
|
MonoSingleton<Global>.Instance.UNetManager.GetComponent<GameManagerNew>().ChangeRotationConfig(gameConfig, 0); // set server's rotationconfig
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
PushError("Looks like you've caught a bug! Please send your log file to us :)\n" + e);
|
PushError("Looks like you've caught a bug! Please send your log file to us :)\n" + e);
|
||||||
GBSUServer.StopServer();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -97,7 +122,18 @@ Make sure to download a file from the examples given and rename it to config.jso
|
||||||
{
|
{
|
||||||
if (LobbyManager.Instance.LobbyStates.SelfState == LobbyState.Game.Online)
|
if (LobbyManager.Instance.LobbyStates.SelfState == LobbyState.Game.Online)
|
||||||
{
|
{
|
||||||
GBSUClient.JoinServer(Helper.serverip, Helper.serverport);
|
if (!hosting)
|
||||||
|
{
|
||||||
|
LobbyManager.Instance.LobbyStates.IP = serverip;
|
||||||
|
LobbyManager.Instance.LobbyStates.Port = serverport;
|
||||||
|
LobbyManager.Instance.LobbyStates.CurrentState = LobbyState.State.Ready | LobbyState.State.InGame;
|
||||||
|
LobbyManager.Instance.LocalBeasts.SetupNetMemberContext(true);
|
||||||
|
MonoSingleton<Global>.Instance.UNetManager.LaunchClient(serverip, serverport);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PushError("You are currently hosting a match! Please restart the game before attempting to join.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -105,6 +141,10 @@ Make sure to download a file from the examples given and rename it to config.jso
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PushError("Couldn't find the -ip CLI argument. Please refer to the documentation.");
|
||||||
|
}
|
||||||
|
|
||||||
if (GUI.Button(new Rect(20f, 295f, 170f, 30f), "Cap FPS to 60"))
|
if (GUI.Button(new Rect(20f, 295f, 170f, 30f), "Cap FPS to 60"))
|
||||||
{
|
{
|
||||||
|
|
@ -116,19 +156,19 @@ Make sure to download a file from the examples given and rename it to config.jso
|
||||||
}
|
}
|
||||||
if (GUI.Button(new Rect(20f, 330f, 170f, 30f), "Toggle VSync"))
|
if (GUI.Button(new Rect(20f, 330f, 170f, 30f), "Toggle VSync"))
|
||||||
{
|
{
|
||||||
Helper.FlipVSync();
|
if (QualitySettings.vSyncCount == 0)
|
||||||
|
{
|
||||||
|
QualitySettings.vSyncCount = 1;
|
||||||
}
|
}
|
||||||
if (Helper.hosting)
|
else
|
||||||
{
|
{
|
||||||
if (GUI.Button(new Rect(195f, 330f, 170f, 30f), "Stop server"))
|
QualitySettings.vSyncCount = 0;
|
||||||
{
|
|
||||||
GBSUServer.StopServer();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GUI.Label(new Rect(20f, 365f, 365f, 400f), $@"
|
GUI.Label(new Rect(20f, 365f, 365f, 400f), $@"
|
||||||
|
|
||||||
Current map: {UnityEngine.SceneManagement.SceneManager.GetActiveScene().name}
|
Current map: {currentmap}
|
||||||
Lobby State: {LobbyManager.Instance.LobbyStates.SelfState}
|
Lobby State: {LobbyManager.Instance.LobbyStates.SelfState}
|
||||||
VSync: {QualitySettings.vSyncCount}
|
VSync: {QualitySettings.vSyncCount}
|
||||||
Target FPS: {Application.targetFrameRate}
|
Target FPS: {Application.targetFrameRate}
|
||||||
|
|
@ -158,7 +198,7 @@ Please refer to the documentation for more information.");
|
||||||
}
|
}
|
||||||
private string UpdateScoreDisplay()
|
private string UpdateScoreDisplay()
|
||||||
{
|
{
|
||||||
if (Helper.hosting)
|
if (hosting)
|
||||||
{
|
{
|
||||||
string scoreString = "Score:\n";
|
string scoreString = "Score:\n";
|
||||||
foreach (var pair in Plugin.GameScore)
|
foreach (var pair in Plugin.GameScore)
|
||||||
|
|
@ -170,7 +210,7 @@ Please refer to the documentation for more information.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PushError(string message)
|
private void PushError(string message)
|
||||||
{
|
{
|
||||||
Plugin.Log.LogError(message);
|
Plugin.Log.LogError(message);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
using CoreNet.Config;
|
|
||||||
using GB.Config;
|
|
||||||
using GB.Core;
|
|
||||||
using GB.Game;
|
using GB.Game;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
@ -26,45 +23,12 @@ public class GBSUServer : MonoBehaviour
|
||||||
//_gmInit = AccessTools.Method(typeof(GameMode), "Init");
|
//_gmInit = AccessTools.Method(typeof(GameMode), "Init");
|
||||||
localSingleGang = Traverse.Create(nameof(GameMode)).Field("localSingleGang");
|
localSingleGang = Traverse.Create(nameof(GameMode)).Field("localSingleGang");
|
||||||
gameTimer = Traverse.Create(nameof(GameMode)).Field("timer");
|
gameTimer = Traverse.Create(nameof(GameMode)).Field("timer");
|
||||||
|
|
||||||
AudioListener.volume = 0; // mute game audio
|
|
||||||
}
|
}
|
||||||
void SetLocalGangToOff()
|
void SetLocalGangToOff()
|
||||||
{
|
{
|
||||||
localSingleGang?.SetValue(false);
|
localSingleGang?.SetValue(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void StartServer()
|
|
||||||
{
|
|
||||||
if (!Helper.hosting)
|
|
||||||
{
|
|
||||||
Helper.hosting = true;
|
|
||||||
|
|
||||||
Plugin.AddServerComp(); // add custom GBSU server component
|
|
||||||
|
|
||||||
RotationConfig gameConfig = GBConfigLoader.LoadRotationConfig(null); // the argument doesn't matter as we do stuff in the method
|
|
||||||
ServerConfig serverConfig = NetConfigLoader.LoadServerConfig(); // load default server config, because it can be overridden by args like -ip and -port
|
|
||||||
MonoSingleton<Global>.Instance.UNetManager.LaunchServer(serverConfig); // launch the server with the server config
|
|
||||||
MonoSingleton<Global>.Instance.UNetManager.GetComponent<GameManagerNew>().ChangeRotationConfig(gameConfig, 0); // set server's rotationconfig
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void StopServer()
|
|
||||||
{
|
|
||||||
// WIP: At the moment the only way to stop the server is to exit/kill the game
|
|
||||||
Helper.hosting = false;
|
|
||||||
|
|
||||||
AudioListener.volume = Helper.saved_volume; // restore volume
|
|
||||||
|
|
||||||
// stop network listener
|
|
||||||
MonoSingleton<Global>.Instance.UNetManager.StopServer();
|
|
||||||
|
|
||||||
// destroy GBSU server comp
|
|
||||||
Plugin.DestroyServerComp();
|
|
||||||
|
|
||||||
// go back to main menu
|
|
||||||
Helper.SwitchToMenu();
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
public string GetRemainingRoundTime()
|
public string GetRemainingRoundTime()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,13 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using GB.Core;
|
|
||||||
using GB.Networking.Utils;
|
|
||||||
using GB.Platform.Lobby;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Analytics;
|
using UnityEngine.Analytics;
|
||||||
using UnityEngine.SceneManagement;
|
|
||||||
|
|
||||||
namespace GBSU.Addons;
|
namespace GBSU.Addons;
|
||||||
public class Helper
|
public class Helper
|
||||||
{
|
{
|
||||||
public static string RotationFolderPath = BepInEx.Paths.BepInExRootPath + "/config/GBSU/";
|
public static string RotationFolderPath = Application.dataPath + "/Config/Rotation/";
|
||||||
public static string GameConfigPath = RotationFolderPath + "config.json";
|
public static string GameConfigPath = RotationFolderPath + "config.json";
|
||||||
public static string serverip = null;
|
|
||||||
public static int serverport = 5999;
|
|
||||||
public static bool hosting = false;
|
|
||||||
public static float saved_volume;
|
|
||||||
public static void DisableAnalytics()
|
public static void DisableAnalytics()
|
||||||
{
|
{
|
||||||
// Try disabling analytics https://docs.unity3d.com/ScriptReference/Analytics.Analytics-deviceStatsEnabled.html
|
// Try disabling analytics https://docs.unity3d.com/ScriptReference/Analytics.Analytics-deviceStatsEnabled.html
|
||||||
|
|
@ -57,7 +49,7 @@ public class Helper
|
||||||
{
|
{
|
||||||
string names = "";
|
string names = "";
|
||||||
|
|
||||||
foreach (FileInfo file in files)
|
foreach(FileInfo file in files)
|
||||||
{
|
{
|
||||||
names = file.Name + " " + names;
|
names = file.Name + " " + names;
|
||||||
}
|
}
|
||||||
|
|
@ -65,54 +57,4 @@ public class Helper
|
||||||
return $"There are {number} files: {names}";
|
return $"There are {number} files: {names}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void FlipVSync()
|
|
||||||
{
|
|
||||||
if (QualitySettings.vSyncCount == 0)
|
|
||||||
{
|
|
||||||
QualitySettings.vSyncCount = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QualitySettings.vSyncCount = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CheckCustomRotationPath()
|
|
||||||
{
|
|
||||||
// Did the host request to use their own rotation config path?
|
|
||||||
if (CommandLineParser.Instance.KeyExists("-maplist"))
|
|
||||||
{
|
|
||||||
GameConfigPath = CommandLineParser.Instance.GetValueForKey("-maplist");
|
|
||||||
Plugin.Log.LogInfo("Set custom rotation config path at " + GameConfigPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void SwitchToMenu()
|
|
||||||
{
|
|
||||||
if (hosting)
|
|
||||||
{
|
|
||||||
GBSUGui.PushError("Please press the Stop server button instead!");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// uhm, time to panic!
|
|
||||||
|
|
||||||
// let's begin by disconnecting if theres an active connection
|
|
||||||
try
|
|
||||||
{
|
|
||||||
GBNetUtils.DisconnectSelf(false);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Plugin.Log.LogWarning("Couldn't disconnect from server:\n" + e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// go back to main menu
|
|
||||||
SceneManager.LoadScene(Global.MENU_SCENE_NAME);
|
|
||||||
|
|
||||||
// make sure our lobby state is menu
|
|
||||||
LobbyManager.Instance.LobbyStates.SelfState = LobbyState.Game.Menu;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
<AssemblyName>GBSU</AssemblyName>
|
<AssemblyName>GBSU</AssemblyName>
|
||||||
<Product>Gang Beasts Server Utility</Product>
|
<Product>Gang Beasts Server Utility</Product>
|
||||||
<Version>1.1.0</Version>
|
<Version>1.0.3</Version>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<LangVersion>latest</LangVersion>
|
<LangVersion>latest</LangVersion>
|
||||||
<RestoreAdditionalProjectSources>
|
<RestoreAdditionalProjectSources>
|
||||||
|
|
@ -42,8 +42,5 @@
|
||||||
<Reference Include="UnityEngine.CoreModule">
|
<Reference Include="UnityEngine.CoreModule">
|
||||||
<HintPath>ref/UnityEngine.CoreModule.dll</HintPath>
|
<HintPath>ref/UnityEngine.CoreModule.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Newtonsoft.Json.dll">
|
|
||||||
<HintPath>ref/Newtonsoft.Json.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using GB.Config;
|
|
||||||
using GBSU.Addons;
|
|
||||||
using HarmonyLib;
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace GBSU.Patches;
|
|
||||||
|
|
||||||
[HarmonyPatch]
|
|
||||||
class ConfigLoaderPatch
|
|
||||||
{
|
|
||||||
[HarmonyPatch(typeof(GBConfigLoader), "LoadRotationConfig")]
|
|
||||||
private static bool Prefix(ref RotationConfig __result)
|
|
||||||
{
|
|
||||||
string text = ""; // contents of file
|
|
||||||
|
|
||||||
Plugin.Log.LogInfo("Loading custom rotation config...");
|
|
||||||
|
|
||||||
// Reading from file
|
|
||||||
try
|
|
||||||
{
|
|
||||||
text = File.ReadAllText(Helper.GameConfigPath);
|
|
||||||
Plugin.Log.LogDebug("Provided rotation config:\n" + text);
|
|
||||||
RotationConfig rc = JsonConvert.DeserializeObject<RotationConfig>(text);
|
|
||||||
__result = rc;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
GBSUGui.PushError("Couldn't read game config file. A few details:\n" + e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false; // skip
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -50,6 +50,7 @@ class HandleScorePatch
|
||||||
Plugin.Log.LogDebug("Done processing all scores!");
|
Plugin.Log.LogDebug("Done processing all scores!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Plugin.Log.LogInfo("Not letting HandleScore run...");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
34
Plugin.cs
34
Plugin.cs
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using BepInEx;
|
using BepInEx;
|
||||||
using BepInEx.Logging;
|
using BepInEx.Logging;
|
||||||
|
|
@ -54,26 +54,6 @@ public class Plugin : BaseUnityPlugin
|
||||||
Helper.CreateRotationFolder();
|
Helper.CreateRotationFolder();
|
||||||
|
|
||||||
Log.LogDebug("Server game config should be found at " + Helper.GameConfigPath);
|
Log.LogDebug("Server game config should be found at " + Helper.GameConfigPath);
|
||||||
|
|
||||||
// Parse CLI arguments
|
|
||||||
if (CommandLineParser.Instance.KeyExists("-ip"))
|
|
||||||
{
|
|
||||||
Helper.serverip = CommandLineParser.Instance.GetValueForKey("-ip", false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GBSUGui.PushError("Couldn't find the -ip CLI argument. Please refer to the documentation.");
|
|
||||||
}
|
|
||||||
if (CommandLineParser.Instance.KeyExists("-port"))
|
|
||||||
{
|
|
||||||
int.TryParse(CommandLineParser.Instance.GetValueForKey("-port", false), out Helper.serverport);
|
|
||||||
}
|
|
||||||
|
|
||||||
// "-maplist" CLI
|
|
||||||
Helper.CheckCustomRotationPath();
|
|
||||||
|
|
||||||
// store app volume in a variable to restore it if needed
|
|
||||||
Helper.saved_volume = AudioListener.volume;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void GBSUCompInit()
|
private static void GBSUCompInit()
|
||||||
|
|
@ -86,23 +66,19 @@ public class Plugin : BaseUnityPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddServerComp()
|
public static void AddServerComp()
|
||||||
{
|
|
||||||
DestroyServerComp();
|
|
||||||
Log.LogDebug("Adding GBSUServer component");
|
|
||||||
GBSUCompContainer.AddComponent<GBSUServer>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void DestroyServerComp()
|
|
||||||
{
|
{
|
||||||
Component[] comps = GBSUCompContainer.GetComponents(typeof(Component));
|
Component[] comps = GBSUCompContainer.GetComponents(typeof(Component));
|
||||||
foreach (var comp in comps)
|
foreach (var comp in comps)
|
||||||
{
|
{
|
||||||
Log.LogDebug("iterating thru singleton comps");
|
Log.LogDebug("iterating thru singleton comps");
|
||||||
if (comp is GBSUServer)
|
if(comp is GBSUServer)
|
||||||
{
|
{
|
||||||
Log.LogDebug("GBSUServer component was found! Destroying it");
|
Log.LogDebug("GBSUServer component was found! Destroying it");
|
||||||
Destroy(comp);
|
Destroy(comp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Log.LogDebug("Adding GBSUServer component");
|
||||||
|
GBSUCompContainer.AddComponent<GBSUServer>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
18
README.md
18
README.md
|
|
@ -4,7 +4,7 @@ This mod allows you to connect to a Gang Beasts server in recent versions (throu
|
||||||
**NOTICE: This is not a "Cement" mod, and we don't want to be affiliated with their developers. This mod is standalone, and will work best on its own!**
|
**NOTICE: This is not a "Cement" mod, and we don't want to be affiliated with their developers. This mod is standalone, and will work best on its own!**
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
- LAN (Ethernet switches at LAN parties) and Online (port forwarding, ZeroTier, Wireguard) multiplayer
|
- LAN (ethernet switches at LAN parties) and Online (port forwarding, ZeroTier, Wireguard) multiplayer
|
||||||
- Custom score handling made by the server (we don't want to use the game's score handler)
|
- Custom score handling made by the server (we don't want to use the game's score handler)
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
|
@ -31,13 +31,11 @@ Press `Right Shift` to open the mod GUI. Because of how the game is made, you ne
|
||||||
|
|
||||||
## Server (host)
|
## Server (host)
|
||||||
### Setting up the server
|
### Setting up the server
|
||||||
1. Open the `BepInEx` folder in the "server" game instance files.
|
1. Open the `Gang Beasts_Data` folder in the "server" game instance files.
|
||||||
2. Create a `GBSU` folder in `config`.
|
2. Create two new folders: `Config/Rotation`
|
||||||
3. Download the [one of the config files](https://git.gaboule.com/Gaboule/GBSU/src/branch/main/docs/configs) and place it inside the `GBSU` folder.
|
3. Download the [one of the config files](https://git.gaboule.com/Gaboule/GBSU/src/branch/main/docs/configs) and place it inside the `Rotation` folder.
|
||||||
4. Rename the file to `config.json`
|
4. Rename the file to `config.json`
|
||||||
|
|
||||||
**Tip: your config file can also be anywhere else! Use the -maplist argument followed by the path to the file,** for example `-ip 192.168.1.2 -port 5999 -maplist "/home/user/mycustomconfig.json"`
|
|
||||||
|
|
||||||
### Configuring your custom server settings
|
### Configuring your custom server settings
|
||||||
* If you set `"random": true`, the map order will be randomized.
|
* If you set `"random": true`, the map order will be randomized.
|
||||||
* Some maps may have different names in-game compared to their actual titles. Make sure to refer to the [`allmaps` configs](https://git.gaboule.com/Gaboule/GBSU/src/branch/main/docs/configs) for the map names.
|
* Some maps may have different names in-game compared to their actual titles. Make sure to refer to the [`allmaps` configs](https://git.gaboule.com/Gaboule/GBSU/src/branch/main/docs/configs) for the map names.
|
||||||
|
|
@ -47,7 +45,7 @@ Once the config file is in place, host your server by pressing the **Host** butt
|
||||||
|
|
||||||
## Client (player)
|
## Client (player)
|
||||||
1. In the game menu, choose **Online**.
|
1. In the game menu, choose **Online**.
|
||||||
2. If you're planning to team up with friends, make sure your server config is set to the `gang` gamemode and choose a shared color. Otherwise, use a different color than your friends.
|
2. If you're planning to team up with friends, make sure your [server config]() is set to the `gang` gamemode and choose a shared color. Otherwise, use a different color than your friends.
|
||||||
3. Open the mod menu and press **Join**.
|
3. Open the mod menu and press **Join**.
|
||||||
|
|
||||||
# Troubleshooting
|
# Troubleshooting
|
||||||
|
|
@ -64,10 +62,6 @@ On Steam, simply put `WINEDLLOVERRIDES="winhttp.dll=n,b" %command%` in your laun
|
||||||
|
|
||||||
If it's still not working, try using `winecfg` for your prefix or `protontricks` and go to the libraries tab in Wine Configuration. Simply add `winhttp` as an override and check if it's correctly set as "native, then builtin" (or "n,b").
|
If it's still not working, try using `winecfg` for your prefix or `protontricks` and go to the libraries tab in Wine Configuration. Simply add `winhttp` as an override and check if it's correctly set as "native, then builtin" (or "n,b").
|
||||||
|
|
||||||
# Known issues
|
|
||||||
- This mode uses the game's netcode. It is poorly made, and you get noticeable latency on localhost (RTT is 10ms). It seems that there's no client-side prediction.
|
|
||||||
- The custom score handler only tracks through colors, and is only visible on the host side.
|
|
||||||
|
|
||||||
# Contact us
|
# Contact us
|
||||||
## Need help?
|
## Need help?
|
||||||
Ask us on [Matrix](https://matrix.to/#/#gbsu:gaboule.com).
|
Ask us on [Matrix](https://matrix.to/#/#gbsu:gaboule.com).
|
||||||
|
|
@ -79,4 +73,4 @@ Want a new feature? Found a bug? [Open an issue!](https://git.gaboule.com/Gaboul
|
||||||
- The mod is made for BepInEx 5
|
- The mod is made for BepInEx 5
|
||||||
- The targeted Unity version is `2020.3.5f1`
|
- The targeted Unity version is `2020.3.5f1`
|
||||||
- The TFM is `netstandard2.0`
|
- The TFM is `netstandard2.0`
|
||||||
- The mod is built using .NET SDK `9.0.304`
|
- The mod is built using .NET SDK `9.0.103`
|
||||||
Loading…
Add table
Add a link
Reference in a new issue