Feature: tile height variation + stalagmite bottoms + live content refresh
## Tile height variation (fix) Tile tops now visibly vary (0.8–1.0) from a fixed bottom at world Y=0. Previously the top was fixed and the variation was only visible underneath. Heights are seeded by tile coordinate so they're deterministic per board. Unit y_offsets and highlight positions update to match per-tile height. ## Stalagmite tile bottoms Server: new TileBottomModel entity + migration (catalog.tile_bottom_models), content.tile_bottoms handler returns all active CDN URLs. Admin: "Tile Bottom Models" section in the Tile Model Manager page — add/toggle active/delete entries with CDN picker. Client: ContentCache fetches + disk-caches the URL pool; _try_load_tile_model picks a random URL and attaches it flipped below the tile model as a stalagmite using the existing _fit_model_to_tile scale logic. ## Live content refresh ContentCache schedules start_sync() every 5 minutes after sync_complete so card definitions, tile models, and bottom models are refreshed in the background without restarting the client. 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:
@@ -19,6 +19,9 @@ public sealed record GetCardDefinitionRequest(Guid Id);
|
||||
/// <summary>Fetch all tile model bindings (affinity × shape → CDN URL).</summary>
|
||||
public sealed record GetTileModelsRequest;
|
||||
|
||||
/// <summary>Fetch all active tile bottom (stalagmite) model URLs.</summary>
|
||||
public sealed record GetTileBottomsRequest;
|
||||
|
||||
// ── Response / DTO types (server → client) ────────────────────────────────────
|
||||
|
||||
public sealed record SyncCardDefinitionsResponse(
|
||||
@@ -32,6 +35,8 @@ public sealed record GetCardDefinitionResponse(CardDefinitionDto? Card);
|
||||
|
||||
public sealed record GetTileModelsResponse(IEnumerable<TileModelDto> Bindings);
|
||||
|
||||
public sealed record GetTileBottomsResponse(IEnumerable<string> Urls);
|
||||
|
||||
public sealed record TileModelDto(
|
||||
string Affinity,
|
||||
string Shape,
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
namespace SOR.Content.Handlers;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SOR.Database.Contexts;
|
||||
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.
|
||||
/// </summary>
|
||||
internal sealed class ContentGetTileBottomsHandler : IMessageHandler
|
||||
{
|
||||
private readonly IMessageSerializer _serializer;
|
||||
private readonly CatalogDbContext _catalogDb;
|
||||
|
||||
public ContentGetTileBottomsHandler(IMessageSerializer serializer, CatalogDbContext catalogDb)
|
||||
{
|
||||
_serializer = serializer;
|
||||
_catalogDb = catalogDb;
|
||||
}
|
||||
|
||||
public string MessageType => "content.tile_bottoms";
|
||||
|
||||
public async Task<IServerMessage?> HandleAsync(
|
||||
IClientMessage message,
|
||||
AuthenticatedConnection connection,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var urls = await _catalogDb.TileBottomModels
|
||||
.Where(m => m.IsActive)
|
||||
.Select(m => m.PublicUrl)
|
||||
.ToListAsync(ct);
|
||||
|
||||
return ServerMessage.Reply("content.tile_bottoms.ack", message.Seq,
|
||||
new GetTileBottomsResponse(urls));
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ public static class ServiceRegistration
|
||||
services.AddTransient<IMessageHandler, ContentGetCardSetsHandler>();
|
||||
services.AddTransient<IMessageHandler, ContentGetCardDefinitionHandler>();
|
||||
services.AddTransient<IMessageHandler, ContentGetTileModelsHandler>();
|
||||
services.AddTransient<IMessageHandler, ContentGetTileBottomsHandler>();
|
||||
services.AddTransient<IMessageHandler, ContentGetAudioConfigHandler>();
|
||||
|
||||
return services;
|
||||
|
||||
Reference in New Issue
Block a user