World Editor fixes

This commit is contained in:
dingo
2026-02-16 16:41:23 -05:00
parent 7e6d494e44
commit cae32f6157
5 changed files with 359 additions and 31 deletions
+23
View File
@@ -124,4 +124,27 @@ public sealed class WorldBroadcastService
.Select(p => SendAsync(p.Connection, opCode, payload, CancellationToken.None));
await Task.WhenAll(tasks);
}
/// <summary>
/// Send a chunk delta to all players who currently have the given chunk key in their visible set.
/// </summary>
public async Task BroadcastChunkDeltaAsync(
string chunkKey,
object deltaPayload,
long newVersion,
ConcurrentDictionary<Guid, WorldSessionState> players)
{
var tasks = new List<Task>();
foreach (var s in players.Values)
{
if (!s.ChunkVersions.ContainsKey(chunkKey))
continue;
// Update the player's tracked version so the next tick doesn't re-send a full chunk_load
s.ChunkVersions[chunkKey] = newVersion;
tasks.Add(SendAsync(s.Connection, OpCodes.WORLD_CHUNK_DELTA, deltaPayload, CancellationToken.None));
}
if (tasks.Count > 0)
await Task.WhenAll(tasks);
}
}