mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2024-12-29 03:28:26 +00:00
setting for player names
This commit is contained in:
parent
165ae8fdaf
commit
9c4c80eb36
@ -1,4 +1,5 @@
|
||||
using QSB.Utility;
|
||||
using QSB.ServerSettings;
|
||||
using QSB.Utility;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.Player;
|
||||
@ -34,6 +35,11 @@ public class PlayerHUDMarker : HUDDistanceMarker
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ServerSettingsManager.ShowPlayerNames)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return _player.IsReady &&
|
||||
!_player.IsDead &&
|
||||
_player.Visible &&
|
||||
|
@ -1,4 +1,5 @@
|
||||
using QSB.Utility;
|
||||
using QSB.ServerSettings;
|
||||
using QSB.Utility;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.Player;
|
||||
@ -57,6 +58,11 @@ public class PlayerMapMarker : MonoBehaviour
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ServerSettingsManager.ShowPlayerNames)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
var playerScreenPos = Locator.GetActiveCamera().WorldToScreenPoint(transform.position);
|
||||
var isInfrontOfCamera = playerScreenPos.z > 0f;
|
||||
|
||||
|
@ -4,9 +4,11 @@ using OWML.Common;
|
||||
using OWML.ModHelper;
|
||||
using QSB.Localization;
|
||||
using QSB.Menus;
|
||||
using QSB.Messaging;
|
||||
using QSB.Patches;
|
||||
using QSB.QuantumSync;
|
||||
using QSB.SaveSync;
|
||||
using QSB.ServerSettings;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
using System;
|
||||
@ -56,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 GameVendor GameVendor { get; private set; } = GameVendor.None;
|
||||
public static bool IsStandalone => GameVendor is GameVendor.Epic or GameVendor.Steam;
|
||||
public static IProfileManager ProfileManager => IsStandalone
|
||||
@ -242,6 +245,14 @@ public class QSBCore : ModBehaviour
|
||||
{
|
||||
DefaultServerIP = config.GetSettingsValue<string>("defaultServerIP");
|
||||
IncompatibleModsAllowed = config.GetSettingsValue<bool>("incompatibleModsAllowed");
|
||||
var _showPlayerNames = config.GetSettingsValue<bool>("showPlayerNames");
|
||||
|
||||
if (_showPlayerNames != ShowPlayerNames)
|
||||
{
|
||||
new ServerSettingsMessage().Send();
|
||||
}
|
||||
|
||||
ShowPlayerNames = _showPlayerNames;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
@ -1,6 +1,7 @@
|
||||
using QSB.ConversationSync.Messages;
|
||||
using QSB.Messaging;
|
||||
using QSB.Player;
|
||||
using QSB.ServerSettings;
|
||||
using QSB.Utility;
|
||||
|
||||
namespace QSB.SaveSync.Messages;
|
||||
@ -21,6 +22,7 @@ internal class RequestGameStateMessage : QSBMessage
|
||||
}
|
||||
|
||||
new GameStateMessage(From).Send();
|
||||
new ServerSettingsMessage().Send();
|
||||
|
||||
var gameSave = PlayerData._currentGameSave;
|
||||
|
||||
|
9
QSB/ServerSettings/ServerSettingsManager.cs
Normal file
9
QSB/ServerSettings/ServerSettingsManager.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using QSB.Utility;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.ServerSettings;
|
||||
|
||||
internal class ServerSettingsManager : MonoBehaviour, IAddComponentOnStart
|
||||
{
|
||||
public static bool ShowPlayerNames;
|
||||
}
|
26
QSB/ServerSettings/ServerSettingsMessage.cs
Normal file
26
QSB/ServerSettings/ServerSettingsMessage.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using Mirror;
|
||||
using QSB.Messaging;
|
||||
|
||||
namespace QSB.ServerSettings;
|
||||
|
||||
internal class ServerSettingsMessage : QSBMessage
|
||||
{
|
||||
private bool _showPlayerNames;
|
||||
|
||||
public override void Serialize(NetworkWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
writer.Write(QSBCore.ShowPlayerNames);
|
||||
}
|
||||
|
||||
public override void Deserialize(NetworkReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
_showPlayerNames = reader.ReadBool();
|
||||
}
|
||||
|
||||
public override void OnReceiveRemote()
|
||||
{
|
||||
ServerSettingsManager.ShowPlayerNames = _showPlayerNames;
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
"enabled": true,
|
||||
"settings": {
|
||||
"defaultServerIP": "localhost",
|
||||
"incompatibleModsAllowed": false
|
||||
"incompatibleModsAllowed": false,
|
||||
"showPlayerNames": true
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user