mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2024-12-29 03:28:26 +00:00
fix player name setting
This commit is contained in:
parent
3ea84f889e
commit
0a97b992b2
@ -58,6 +58,7 @@ public class QSBCore : ModBehaviour
|
||||
Application.version.Split('.').Take(3).Join(delimiter: ".");
|
||||
public static bool DLCInstalled => EntitlementsManager.IsDlcOwned() == EntitlementsManager.AsyncOwnershipStatus.Owned;
|
||||
public static bool IncompatibleModsAllowed { get; private set; }
|
||||
public static bool ShowPlayerNames { get; private set; }
|
||||
public static bool ShipDamage { get; private set; }
|
||||
public static GameVendor GameVendor { get; private set; } = GameVendor.None;
|
||||
public static bool IsStandalone => GameVendor is GameVendor.Epic or GameVendor.Steam;
|
||||
@ -245,24 +246,14 @@ public class QSBCore : ModBehaviour
|
||||
{
|
||||
DefaultServerIP = config.GetSettingsValue<string>("defaultServerIP");
|
||||
IncompatibleModsAllowed = config.GetSettingsValue<bool>("incompatibleModsAllowed");
|
||||
if (!IsInMultiplayer)
|
||||
{
|
||||
ServerSettingsManager.ShowPlayerNames = config.GetSettingsValue<bool>("showPlayerNames");
|
||||
}
|
||||
else if (IsHost)
|
||||
{
|
||||
var _showPlayerNames = config.GetSettingsValue<bool>("showPlayerNames");
|
||||
if (_showPlayerNames != ServerSettingsManager.ShowPlayerNames)
|
||||
{
|
||||
new ServerSettingsMessage().Send();
|
||||
}
|
||||
ServerSettingsManager.ShowPlayerNames = _showPlayerNames;
|
||||
}
|
||||
else
|
||||
{
|
||||
config.SetSettingsValue("showPlayerNames", ServerSettingsManager.ShowPlayerNames);
|
||||
}
|
||||
ShowPlayerNames = config.GetSettingsValue<bool>("showPlayerNames");
|
||||
ShipDamage = config.GetSettingsValue<bool>("shipDamage");
|
||||
|
||||
if (IsHost)
|
||||
{
|
||||
ServerSettingsManager.ServerShowPlayerNames = ShowPlayerNames;
|
||||
new ServerSettingsMessage().Send();
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
@ -5,5 +5,6 @@ namespace QSB.ServerSettings;
|
||||
|
||||
internal class ServerSettingsManager : MonoBehaviour, IAddComponentOnStart
|
||||
{
|
||||
public static bool ShowPlayerNames;
|
||||
public static bool ServerShowPlayerNames;
|
||||
public static bool ShowPlayerNames => (ServerShowPlayerNames || QSBCore.IsHost) && QSBCore.ShowPlayerNames;
|
||||
}
|
||||
|
@ -8,9 +8,7 @@ internal class ServerSettingsMessage : QSBMessage
|
||||
private bool _showPlayerNames;
|
||||
|
||||
public ServerSettingsMessage()
|
||||
{
|
||||
_showPlayerNames = ServerSettingsManager.ShowPlayerNames;
|
||||
}
|
||||
=> _showPlayerNames = QSBCore.ShowPlayerNames;
|
||||
|
||||
public override void Serialize(NetworkWriter writer)
|
||||
{
|
||||
@ -25,8 +23,5 @@ internal class ServerSettingsMessage : QSBMessage
|
||||
}
|
||||
|
||||
public override void OnReceiveRemote()
|
||||
{
|
||||
ServerSettingsManager.ShowPlayerNames = _showPlayerNames;
|
||||
QSBCore.Helper.Config.SetSettingsValue("showPlayerNames", _showPlayerNames);
|
||||
}
|
||||
=> ServerSettingsManager.ServerShowPlayerNames = _showPlayerNames;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user