Feature: model config (facing/scale/tint) + animation loop fix
SERVER - CardAsset gains ModelFacingDirection (string?), ModelScale (float?), ModelTintColor (string?), ModelTintMaskUrl (string?) columns. - CardAssetDto and ContentDtoMapper updated to expose them. - EF migration AddModelConfig applied to pg-forge-01 / SOR DB. CLIENT (game_screen.gd) Animation loop: - GLB standard: first 5 frames (ANIM_TRANSITION_SECS = 5/30s) are entry frames that blend from idle into the action. Looping animations now skip those frames on every iteration after the first, eliminating the bind-pose flash at the loop seam. - Manual loop management via animation_finished + CONNECT_ONE_SHOT replaces LOOP_LINEAR so the seek-past-transition trick works. - _idle_callbacks tracks active loop callables so they can be disconnected when a one-shot animation interrupts idle. - _idle_entry_done reset when a one-shot starts so the transition frames play correctly when returning to idle after the action. Model config: - _find_model3d_asset() replaces _find_model3d_url() — returns the full asset dict including the new fields. - ModelFacingDirection → _facing_to_base_angle() → rotation.y applied at load; stored in _model_base_angles for movement / idle reset. - ModelScale applied uniformly to model_node.scale on load. - ModelTintColor applied as multiplicative albedo_color tint to all StandardMaterial3D surfaces (materials duplicated per-instance). - ModelTintMaskUrl stored in DB/DTO; per-texel shader not yet wired. Movement facing: - _animate_unit_move pre-computes a facing angle per BFS step and snaps model_node.rotation.y at the start of each step so units face the direction they walk. - On movement end, rotation resets to the idle/team direction. Cleanup: - _rebuild_units removal loop erases _idle_entry_done, _idle_callbacks, _model_base_angles, _needs_face_rot for freed units. 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:
+457
@@ -0,0 +1,457 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using SOR.Database.Contexts;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SOR.Database.Migrations.Catalog
|
||||
{
|
||||
[DbContext(typeof(CatalogDbContext))]
|
||||
[Migration("20260316020112_AddModelConfig")]
|
||||
partial class AddModelConfig
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("catalog")
|
||||
.HasAnnotation("ProductVersion", "8.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAnimationBinding", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("ActionName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("AnimationCdnUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("AnimationTrackName")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("CardDefinitionId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("CastSoundCdnUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ImpactSoundCdnUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsAiGenerated")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CardDefinitionId", "ActionName")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("card_animation_bindings", "catalog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAsset", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AssetType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("CardDefinitionId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("CdnUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("IsAiGenerated")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("MimeType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ModelFacingDirection")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<float?>("ModelScale")
|
||||
.HasColumnType("real");
|
||||
|
||||
b.Property<string>("ModelTintColor")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ModelTintMaskUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CardDefinitionId", "AssetType");
|
||||
|
||||
b.ToTable("card_assets", "catalog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AbilitiesJson")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("abilities");
|
||||
|
||||
b.Property<string>("Affinity")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("AttackType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool?>("CanAttack")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool?>("CanBeAttacked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool?>("CanBeBlocked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool?>("CanBeObstructed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool?>("CanBeSacrificed")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool?>("CanDefend")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool?>("CanMove")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool?>("CanUseAbility")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("CardType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("CollectorNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int?>("Damage")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<long>("DefinitionVersion")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("bigint")
|
||||
.HasDefaultValue(0L);
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("EffectsJson")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("effects");
|
||||
|
||||
b.Property<string[]>("Genus")
|
||||
.HasColumnType("text[]");
|
||||
|
||||
b.Property<bool>("IsPublished")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsRetired")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("MaxAttackRange")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MaxChannelRange")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MaxDefense")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MaxHealth")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MinAttackRange")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MinChannelRange")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MovementPoints")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("MovementType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("OtherCostsJson")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("other_costs");
|
||||
|
||||
b.Property<Guid?>("PreviousTierId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Rarity")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool?>("RequiresLos")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<DateTimeOffset?>("RetiredAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("SetId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("SpCost")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("StCost")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("TerramorphaMode")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("Tier")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Affinity");
|
||||
|
||||
b.HasIndex("CardType");
|
||||
|
||||
b.HasIndex("DefinitionVersion");
|
||||
|
||||
b.HasIndex("Name");
|
||||
|
||||
b.HasIndex("PreviousTierId");
|
||||
|
||||
b.HasIndex("Rarity");
|
||||
|
||||
b.HasIndex("SetId");
|
||||
|
||||
b.HasIndex("IsPublished", "SetId");
|
||||
|
||||
b.ToTable("card_definitions", "catalog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardSet", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Code")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateOnly?>("ReleaseDate")
|
||||
.HasColumnType("date");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Code")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("card_sets", "catalog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CdnUploadRecord", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("ContentType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsAiGenerated")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("ObjectKey")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Prefix")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("PublicUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("UploadedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IsAiGenerated");
|
||||
|
||||
b.HasIndex("ObjectKey")
|
||||
.IsUnique();
|
||||
|
||||
b.HasIndex("Prefix");
|
||||
|
||||
b.ToTable("cdn_upload_records", "catalog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.GameAudioConfig", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Context")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("IsActive")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("TrackCdnUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TrackName")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Context");
|
||||
|
||||
b.HasIndex("IsActive");
|
||||
|
||||
b.ToTable("game_audio_configs", "catalog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.TileModelBinding", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("Affinity")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ModelCdnKey")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ModelPublicUrl")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("Shape")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Affinity", "Shape")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("tile_model_bindings", "catalog");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAnimationBinding", b =>
|
||||
{
|
||||
b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "CardDefinition")
|
||||
.WithMany("AnimationBindings")
|
||||
.HasForeignKey("CardDefinitionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CardDefinition");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardAsset", b =>
|
||||
{
|
||||
b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "CardDefinition")
|
||||
.WithMany("Assets")
|
||||
.HasForeignKey("CardDefinitionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CardDefinition");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b =>
|
||||
{
|
||||
b.HasOne("SOR.Database.Entities.Catalog.CardDefinition", "PreviousTier")
|
||||
.WithMany()
|
||||
.HasForeignKey("PreviousTierId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("SOR.Database.Entities.Catalog.CardSet", "Set")
|
||||
.WithMany("Cards")
|
||||
.HasForeignKey("SetId")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.Navigation("PreviousTier");
|
||||
|
||||
b.Navigation("Set");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardDefinition", b =>
|
||||
{
|
||||
b.Navigation("AnimationBindings");
|
||||
|
||||
b.Navigation("Assets");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Catalog.CardSet", b =>
|
||||
{
|
||||
b.Navigation("Cards");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SOR.Database.Migrations.Catalog
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddModelConfig : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ModelFacingDirection",
|
||||
schema: "catalog",
|
||||
table: "card_assets",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<float>(
|
||||
name: "ModelScale",
|
||||
schema: "catalog",
|
||||
table: "card_assets",
|
||||
type: "real",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ModelTintColor",
|
||||
schema: "catalog",
|
||||
table: "card_assets",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "ModelTintMaskUrl",
|
||||
schema: "catalog",
|
||||
table: "card_assets",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ModelFacingDirection",
|
||||
schema: "catalog",
|
||||
table: "card_assets");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ModelScale",
|
||||
schema: "catalog",
|
||||
table: "card_assets");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ModelTintColor",
|
||||
schema: "catalog",
|
||||
table: "card_assets");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "ModelTintMaskUrl",
|
||||
schema: "catalog",
|
||||
table: "card_assets");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,6 +86,18 @@ namespace SOR.Database.Migrations.Catalog
|
||||
b.Property<string>("MimeType")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ModelFacingDirection")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<float?>("ModelScale")
|
||||
.HasColumnType("real");
|
||||
|
||||
b.Property<string>("ModelTintColor")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("ModelTintMaskUrl")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CardDefinitionId", "AssetType");
|
||||
|
||||
Reference in New Issue
Block a user