From 3464e93aee6c2ff4c2ff44aa0f31fa2ccde23a2d Mon Sep 17 00:00:00 2001 From: "derek.holloway" Date: Thu, 6 Aug 2026 09:45:28 -0700 Subject: [PATCH] Make sure everythings init correctly on boot --- MistoxServer/Client/UDPClient.cs | 2 +- MistoxServer/Server/MistoxServer.cs | 17 ++++++++--------- MistoxServer/Server/ServerConnection.cs | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/MistoxServer/Client/UDPClient.cs b/MistoxServer/Client/UDPClient.cs index 58b217d..0e893b9 100644 --- a/MistoxServer/Client/UDPClient.cs +++ b/MistoxServer/Client/UDPClient.cs @@ -9,7 +9,7 @@ namespace Mistox.Client { public string UserName { get; set; } = ""; // The remote players UserName public bool WithinRange { get; set; } = true; // Is the user close enough? - public Vector3 Position { get; set; } // The remote location of the player + public Vector3 Position { get; set; } = new Vector3(0, 0, 0); // The remote location of the player private IPEndPoint _remoteHost { get; set; } // The remote IP Address private readonly SemaphoreSlim _sendLock = new SemaphoreSlim(1, 1); diff --git a/MistoxServer/Server/MistoxServer.cs b/MistoxServer/Server/MistoxServer.cs index e597a0a..8bf6a9f 100644 --- a/MistoxServer/Server/MistoxServer.cs +++ b/MistoxServer/Server/MistoxServer.cs @@ -9,18 +9,17 @@ namespace Mistox.Server { public class MistoxServer { - public string ServerName { get; private set; } = ""; // The name of the server - public int MaxClients { get; set; } = 10; // The max players per server - public float ConnectionRange { get; set; } = 40; // InGame distance for valid conections - public string ConnectionKey { get; set; } = ""; // The connection key for the server - public int ConnectionTimeoutSeconds { get; set; } = 10; // If no reply in time kill the connection - public bool Alive { get; set; } = true; // Is the server running - public ConcurrentDictionary Connections; // All the active connections. key is username + public string ServerName { get; private set; } = ""; // The name of the server + public int MaxClients { get; set; } = 10; // The max players per server + public float ConnectionRange { get; set; } = 40; // InGame distance for valid conections + public string ConnectionKey { get; set; } = ""; // The connection key for the server + public int ConnectionTimeoutSeconds { get; set; } = 10; // If no reply in time kill the connection + public bool Alive { get; set; } = true; // Is the server running + public ConcurrentDictionary Connections = new(); // All the active connections. key is username - private readonly ServerListener Listener; // The Connection Listener singleton + private readonly ServerListener Listener; // The Connection Listener singleton public MistoxServer(IPEndPoint ListenerAddress, string serverName) { - Connections = new ConcurrentDictionary(); ServerName = serverName; Listener = new ServerListener(ListenerAddress, this); Console.WriteLine( "The Server is initilized and waiting for clients to connect at port : " + ListenerAddress.Port ); diff --git a/MistoxServer/Server/ServerConnection.cs b/MistoxServer/Server/ServerConnection.cs index 8843226..3a5d40b 100644 --- a/MistoxServer/Server/ServerConnection.cs +++ b/MistoxServer/Server/ServerConnection.cs @@ -10,7 +10,7 @@ namespace Mistox.Server { public string UserName { get; set; } = ""; // The Players UserName public bool IsAuthenticated { get; set; } = false; // Has the player authenticated - public Vector3 Position { get; set; } // The ingame position of the player + public Vector3 Position { get; set; } = new Vector3(0, 0, 0); // The ingame position of the player public bool Connected { get; set; } = true; // Is the connection valid private readonly MistoxServer _parent;