Server 2.9.6: no old positions after reset / new game

Late position updates from players that are being reconnected after reset-world or a new game
were stored again, so everyone spawned at their old-world position. Tracking stops for those
clients now. Test added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-03 00:34:15 +02:00
co-authored by Claude Opus 5.5
parent e31953b4ab
commit 5e07fe1001
3 changed files with 18 additions and 2 deletions
+3
View File
@@ -746,6 +746,9 @@ public sealed class GameServer
int count = 0;
foreach (var c in clients.Values.Where(x => x.State == ClientState.Joined).ToList())
{
// Positionen/Bedürfnisse aus der alten Welt, die bis zum Trennen noch ankommen, nicht mehr speichern - sonst
// erscheint man nach Reset/neuem Spiel wieder dort, wo man in der alten Welt stand
c.TrackPositionFrom = DateTime.MaxValue;
c.Conn.Send(MsgType.Reconnect, Wire.Build(w => w.Write(message)));
c.Conn.CloseAfterSend("Reconnect after world change");
count++;
+1 -1
View File
@@ -7,7 +7,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MSCO.Server</RootNamespace>
<AssemblyName>MSCO.Server</AssemblyName>
<Version>2.9.5</Version>
<Version>2.9.6</Version>
<Company>MBM</Company>
<Product>MSCO Dedicated Server</Product>
<InvariantGlobalization>true</InvariantGlobalization>
+14 -1
View File
@@ -1,4 +1,4 @@
using System.Net.Sockets;
using System.Net.Sockets;
using MSCO.Server;
// Protokoll-Tests gegen den echten Server-Code: startet einen Server offline (ohne Master, ohne Lizenz) auf
@@ -235,11 +235,24 @@ try
Console.WriteLine("== reset-world makes everyone reconnect");
var r1 = await TestClient.Join("Resetter", 0, null);
r1.Send(MsgType.Ready, Array.Empty<byte>());
await r1.WaitFor(MsgType.WorldSnapshot);
await Task.Delay(8500);
r1.Send(MsgType.Player, PlayerPos(950f, 1f, -653f)); // irgendwo in der alten Welt
await Task.Delay(300);
Srv().EnqueueCommand("reset-world");
var rec = await r1.WaitFor(MsgType.Reconnect);
r1.Send(MsgType.Player, PlayerPos(951f, 1f, -654f)); // kommt noch an, bevor die Verbindung zu ist
Check(rec != null && new BinaryReader(new MemoryStream(rec)).ReadString().Contains("reset"), "Players get the 'world is being reset' reconnect message");
await Task.Delay(300);
Check(r1.IsClosedByServer(), "Their connection is closed so they load the fresh world");
var rejoined = await TestClient.Join("Resetter", 0, null);
rejoined.Send(MsgType.Ready, Array.Empty<byte>());
var resetSpawn = Snapshot.Parse(await rejoined.WaitFor(MsgType.WorldSnapshot)).Spawn;
Check(resetSpawn == null, "After a reset nobody spawns at their old position (also not from late position updates): " +
(resetSpawn == null ? "none" : string.Join(", ", resetSpawn)));
rejoined.Close();
await Task.Delay(300);
Console.WriteLine("== Joining gets the CURRENT save game from a player in the game");
var inGame = await TestClient.Join("InGame", 0, null);