World changes
This commit is contained in:
@@ -207,7 +207,7 @@ public class IndexModel : AdminPageModel
|
||||
}
|
||||
|
||||
await EnsureZonesAsync(region);
|
||||
var zone = await _db.WorldZones.FirstAsync(z => z.RegionId == regionId && z.ZoneX == zoneX && z.ZoneY == zoneY);
|
||||
var zone = await _db.WorldZones.FirstAsync(z => z.RegionId == regionId && z.ZoneX == zoneX && z.ZoneY == zoneY && z.ZoneZ == 0);
|
||||
|
||||
var chunks = await _db.WorldChunks
|
||||
.Where(c => c.WorldZoneId == zone.Id)
|
||||
@@ -901,8 +901,9 @@ public class IndexModel : AdminPageModel
|
||||
|
||||
private async Task EnsureZonesAsync(WorldRegion region)
|
||||
{
|
||||
// Only auto-create Z=0 (ground level) zones
|
||||
var existing = await _db.WorldZones
|
||||
.Where(z => z.RegionId == region.Id)
|
||||
.Where(z => z.RegionId == region.Id && z.ZoneZ == 0)
|
||||
.Select(z => new { z.ZoneX, z.ZoneY })
|
||||
.ToListAsync();
|
||||
|
||||
@@ -956,7 +957,7 @@ public class IndexModel : AdminPageModel
|
||||
await EnsureZonesAsync(region);
|
||||
|
||||
var zone = await _db.WorldZones
|
||||
.FirstOrDefaultAsync(z => z.RegionId == regionId && z.ZoneX == zoneX && z.ZoneY == zoneY && z.IsEnabled);
|
||||
.FirstOrDefaultAsync(z => z.RegionId == regionId && z.ZoneX == zoneX && z.ZoneY == zoneY && z.ZoneZ == 0 && z.IsEnabled);
|
||||
if (zone == null)
|
||||
return (false, "zone_not_found", region, null, null);
|
||||
|
||||
@@ -986,16 +987,17 @@ public class IndexModel : AdminPageModel
|
||||
return x >= 0 && y >= 0 && x < width && y < height;
|
||||
}
|
||||
|
||||
private void PublishDelta(int regionId, int zoneX, int zoneY, int chunkX, int chunkY, long fromVersion, long toVersion, object op)
|
||||
private void PublishDelta(int regionId, int zoneX, int zoneY, int chunkX, int chunkY, long fromVersion, long toVersion, object op, int zoneZ = 0)
|
||||
{
|
||||
_deltaHub.Publish(
|
||||
ChunkKey(regionId, zoneX, zoneY, chunkX, chunkY),
|
||||
ChunkKey(regionId, zoneX, zoneY, chunkX, chunkY, zoneZ),
|
||||
new
|
||||
{
|
||||
kind = "chunk_delta",
|
||||
regionId,
|
||||
zoneX,
|
||||
zoneY,
|
||||
zoneZ,
|
||||
chunkX,
|
||||
chunkY,
|
||||
fromVersion,
|
||||
@@ -1004,8 +1006,8 @@ public class IndexModel : AdminPageModel
|
||||
});
|
||||
}
|
||||
|
||||
private static string ChunkKey(int regionId, int zoneX, int zoneY, int chunkX, int chunkY)
|
||||
=> $"{regionId}:{zoneX}:{zoneY}:{chunkX}:{chunkY}";
|
||||
private static string ChunkKey(int regionId, int zoneX, int zoneY, int chunkX, int chunkY, int zoneZ = 0)
|
||||
=> $"{regionId}:{zoneX}:{zoneY}:{zoneZ}:{chunkX}:{chunkY}";
|
||||
|
||||
private static string NormalizeCdnBaseUrl(string? baseUrl)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user