mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-29 09:32:38 +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: ".");
|
Application.version.Split('.').Take(3).Join(delimiter: ".");
|
||||||
public static bool DLCInstalled => EntitlementsManager.IsDlcOwned() == EntitlementsManager.AsyncOwnershipStatus.Owned;
|
public static bool DLCInstalled => EntitlementsManager.IsDlcOwned() == EntitlementsManager.AsyncOwnershipStatus.Owned;
|
||||||
public static bool IncompatibleModsAllowed { get; private set; }
|
public static bool IncompatibleModsAllowed { get; private set; }
|
||||||
|
public static bool ShowPlayerNames { get; private set; }
|
||||||
public static bool ShipDamage { get; private set; }
|
public static bool ShipDamage { get; private set; }
|
||||||
public static GameVendor GameVendor { get; private set; } = GameVendor.None;
|
public static GameVendor GameVendor { get; private set; } = GameVendor.None;
|
||||||
public static bool IsStandalone => GameVendor is GameVendor.Epic or GameVendor.Steam;
|
public static bool IsStandalone => GameVendor is GameVendor.Epic or GameVendor.Steam;
|
||||||
@ -245,24 +246,14 @@ public class QSBCore : ModBehaviour
|
|||||||
{
|
{
|
||||||
DefaultServerIP = config.GetSettingsValue<string>("defaultServerIP");
|
DefaultServerIP = config.GetSettingsValue<string>("defaultServerIP");
|
||||||
IncompatibleModsAllowed = config.GetSettingsValue<bool>("incompatibleModsAllowed");
|
IncompatibleModsAllowed = config.GetSettingsValue<bool>("incompatibleModsAllowed");
|
||||||
if (!IsInMultiplayer)
|
ShowPlayerNames = config.GetSettingsValue<bool>("showPlayerNames");
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
ShipDamage = config.GetSettingsValue<bool>("shipDamage");
|
ShipDamage = config.GetSettingsValue<bool>("shipDamage");
|
||||||
|
|
||||||
|
if (IsHost)
|
||||||
|
{
|
||||||
|
ServerSettingsManager.ServerShowPlayerNames = ShowPlayerNames;
|
||||||
|
new ServerSettingsMessage().Send();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
|
@ -5,5 +5,6 @@ namespace QSB.ServerSettings;
|
|||||||
|
|
||||||
internal class ServerSettingsManager : MonoBehaviour, IAddComponentOnStart
|
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;
|
private bool _showPlayerNames;
|
||||||
|
|
||||||
public ServerSettingsMessage()
|
public ServerSettingsMessage()
|
||||||
{
|
=> _showPlayerNames = QSBCore.ShowPlayerNames;
|
||||||
_showPlayerNames = ServerSettingsManager.ShowPlayerNames;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Serialize(NetworkWriter writer)
|
public override void Serialize(NetworkWriter writer)
|
||||||
{
|
{
|
||||||
@ -25,8 +23,5 @@ internal class ServerSettingsMessage : QSBMessage
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override void OnReceiveRemote()
|
public override void OnReceiveRemote()
|
||||||
{
|
=> ServerSettingsManager.ServerShowPlayerNames = _showPlayerNames;
|
||||||
ServerSettingsManager.ShowPlayerNames = _showPlayerNames;
|
|
||||||
QSBCore.Helper.Config.SetSettingsValue("showPlayerNames", _showPlayerNames);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user