World changes

This commit is contained in:
dingo
2026-02-17 11:18:55 -05:00
parent cae32f6157
commit 14d74fa9ce
23 changed files with 3029 additions and 157 deletions
+14 -10
View File
@@ -44,12 +44,12 @@ public sealed class WorldBroadcastService
var zy = ay / region.ChunksPerZoneY;
var cx = ax % region.ChunksPerZoneX;
var cy = ay % region.ChunksPerZoneY;
var key = $"{region.Id}:{zx}:{zy}:{cx}:{cy}";
var key = WorldChunkCache.ChunkKey(region.Id, zx, zy, s.ZoneZ, cx, cy);
required.Add(key);
if (!s.ChunkVersions.ContainsKey(key))
{
var cached = await _cache.GetChunkAsync(region.Id, zx, zy, cx, cy, ct);
var cached = await _cache.GetChunkAsync(region.Id, zx, zy, s.ZoneZ, cx, cy, ct);
s.ChunkVersions[key] = cached?.Version ?? 0;
if (cached != null)
{
@@ -82,15 +82,19 @@ public sealed class WorldBroadcastService
{
s.ChunkVersions.Remove(stale);
var p = stale.Split(':');
list.Add(("chunk_unload", new
if (p.Length >= 6)
{
type = "chunk_unload",
regionId = int.Parse(p[0]),
zoneX = int.Parse(p[1]),
zoneY = int.Parse(p[2]),
chunkX = int.Parse(p[3]),
chunkY = int.Parse(p[4])
}));
list.Add(("chunk_unload", new
{
type = "chunk_unload",
regionId = int.Parse(p[0]),
zoneX = int.Parse(p[1]),
zoneY = int.Parse(p[2]),
zoneZ = int.Parse(p[3]),
chunkX = int.Parse(p[4]),
chunkY = int.Parse(p[5])
}));
}
}
return list;
}