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:
@@ -27,7 +27,8 @@ public sealed class CatalogDbContext : DbContext
|
||||
public DbSet<CardAnimationBinding> AnimationBindings => Set<CardAnimationBinding>();
|
||||
public DbSet<CdnUploadRecord> CdnUploadRecords => Set<CdnUploadRecord>();
|
||||
public DbSet<TileModelBinding> TileModelBindings => Set<TileModelBinding>();
|
||||
public DbSet<GameAudioConfig> AudioConfigs => Set<GameAudioConfig>();
|
||||
public DbSet<TileBottomModel> TileBottomModels => Set<TileBottomModel>();
|
||||
public DbSet<GameAudioConfig> AudioConfigs => Set<GameAudioConfig>();
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder builder)
|
||||
{
|
||||
@@ -142,6 +143,15 @@ public sealed class CatalogDbContext : DbContext
|
||||
e.HasIndex(t => new { t.Affinity, t.Shape }).IsUnique();
|
||||
});
|
||||
|
||||
builder.Entity<TileBottomModel>(e =>
|
||||
{
|
||||
e.ToTable("tile_bottom_models");
|
||||
e.HasKey(t => t.Id);
|
||||
e.Property(t => t.CdnKey).IsRequired();
|
||||
e.Property(t => t.PublicUrl).IsRequired();
|
||||
e.HasIndex(t => t.IsActive);
|
||||
});
|
||||
|
||||
builder.Entity<GameAudioConfig>(e =>
|
||||
{
|
||||
e.ToTable("game_audio_configs");
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
namespace SOR.Database.Entities.Catalog;
|
||||
|
||||
/// <summary>
|
||||
/// A stalagmite / underside 3D model that the client attaches below tile models.
|
||||
/// The client randomly picks from all active records each time a tile loads.
|
||||
/// </summary>
|
||||
public sealed class TileBottomModel
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
|
||||
/// <summary>S3 object key, e.g. "models/tiles/bottoms/stalactite_01.glb".</summary>
|
||||
public string CdnKey { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>Publicly accessible CDN URL for the model file.</summary>
|
||||
public string PublicUrl { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>When false the model is excluded from the pool returned to clients.</summary>
|
||||
public bool IsActive { get; set; } = true;
|
||||
|
||||
public DateTimeOffset UpdatedAt { get; set; } = DateTimeOffset.UtcNow;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SOR.Database.Migrations.Catalog
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddTileBottomModels : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "tile_bottom_models",
|
||||
schema: "catalog",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||
CdnKey = table.Column<string>(type: "text", nullable: false),
|
||||
PublicUrl = table.Column<string>(type: "text", nullable: false),
|
||||
IsActive = table.Column<bool>(type: "boolean", nullable: false, defaultValue: true),
|
||||
UpdatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_tile_bottom_models", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_tile_bottom_models_IsActive",
|
||||
schema: "catalog",
|
||||
table: "tile_bottom_models",
|
||||
column: "IsActive");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "tile_bottom_models",
|
||||
schema: "catalog");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user