Add hex stalagmite support for tile bottom models
- TileBottomModel gains a Shape column (Square/Hex, default Square) so admins can manage separate stalagmite pools per tile grid type - EF migration 20260407153312_AddTileBottomModelShape adds the column with a default of 'Square' to preserve existing data - Admin UI splits the Tile Bottom Models section into Square and Hex cards, each with their own Add/toggle/delete controls - content.tile_bottoms response now returns squareUrls and hexUrls separately; handler queries each shape independently - ContentCache splits into _tile_bottom_urls_square / _hex and get_random_tile_bottom_url() now takes a shape parameter - game_screen: hex tiles with no 3D model now receive a hex stalagmite instead of silently skipping; 3D-model path passes shape_key through Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -35,7 +35,7 @@ public sealed record GetCardDefinitionResponse(CardDefinitionDto? Card);
|
||||
|
||||
public sealed record GetTileModelsResponse(IEnumerable<TileModelDto> Bindings);
|
||||
|
||||
public sealed record GetTileBottomsResponse(IEnumerable<string> Urls);
|
||||
public sealed record GetTileBottomsResponse(IEnumerable<string> SquareUrls, IEnumerable<string> HexUrls);
|
||||
|
||||
public sealed record TileModelDto(
|
||||
string Affinity,
|
||||
|
||||
@@ -2,13 +2,15 @@ namespace SOR.Content.Handlers;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SOR.Database.Contexts;
|
||||
using SOR.Database.Enums;
|
||||
using SOR.Networking.Abstractions.Messaging;
|
||||
using SOR.Networking.Abstractions.Transport;
|
||||
using SOR.Shared.Networking;
|
||||
|
||||
/// <summary>
|
||||
/// content.tile_bottoms — returns CDN URLs for all active tile-bottom (stalagmite) models.
|
||||
/// The client randomly picks from this list when attaching an underside mesh to a tile.
|
||||
/// content.tile_bottoms — returns CDN URLs for all active tile-bottom (stalagmite) models,
|
||||
/// split into square and hex pools. The client picks randomly from the pool matching the
|
||||
/// current board's tile shape.
|
||||
/// </summary>
|
||||
internal sealed class ContentGetTileBottomsHandler : IMessageHandler
|
||||
{
|
||||
@@ -28,12 +30,17 @@ internal sealed class ContentGetTileBottomsHandler : IMessageHandler
|
||||
AuthenticatedConnection connection,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var urls = await _catalogDb.TileBottomModels
|
||||
.Where(m => m.IsActive)
|
||||
var squareUrls = await _catalogDb.TileBottomModels
|
||||
.Where(m => m.IsActive && m.Shape == TileShape.Square)
|
||||
.Select(m => m.PublicUrl)
|
||||
.ToListAsync(ct);
|
||||
|
||||
var hexUrls = await _catalogDb.TileBottomModels
|
||||
.Where(m => m.IsActive && m.Shape == TileShape.Hex)
|
||||
.Select(m => m.PublicUrl)
|
||||
.ToListAsync(ct);
|
||||
|
||||
return ServerMessage.Reply("content.tile_bottoms.ack", message.Seq,
|
||||
new GetTileBottomsResponse(urls));
|
||||
new GetTileBottomsResponse(squareUrls, hexUrls));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user