World Editor fixes
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user