acdream/tests/AcDream.App.Tests/Rendering/Vfx/EntityEffectProfileTests.cs
Erik 363e046112 feat(vfx): decode retail hooks and typed tables
Replace the incomplete package path with one DatCollection-backed compatibility seam for PhysicsScripts and Animations. Preserve CreateBlockingParticle's inherited payload and following cursor, route every production and audit consumer through the corrected loaders, and apply retail's post-UnPack StartTime ordering.

Add exact stored-order PhysicsScriptTable upper-threshold resolution, high-byte DID and embedded-ID validation, plus live effect profiles with Setup-to-PhysicsDesc precedence across top-level and attached entity lifetimes. Keep blocking execution deferred and narrow TS-11 accordingly.

Pin synthetic malformed/cursor/order fixtures, installed-DAT blocking and recall audits, high-index IDs, IEEE boundaries, profile teardown, and ordinary decoder parity; synchronize architecture, inventory, milestones, roadmap, research, and memory.

Co-Authored-By: Codex <noreply@openai.com>
2026-07-14 08:17:44 +02:00

83 lines
2.6 KiB
C#

using AcDream.App.Rendering.Vfx;
using AcDream.Core.Net.Messages;
using DatReaderWriter.DBObjs;
namespace AcDream.App.Tests.Rendering.Vfx;
public sealed class EntityEffectProfileTests
{
[Fact]
public void DatStatic_RetainsSetupDirectScriptAndTypedTable()
{
Setup setup = BuildSetup();
EntityEffectProfile profile = EntityEffectProfile.CreateDatStatic(setup);
Assert.Equal(0x330000AAu, profile.SetupDefaultScriptDid);
Assert.Equal(0x340000BBu, profile.CurrentPhysicsScriptTableDid);
Assert.False(profile.HasNetworkDescription);
}
[Fact]
public void LivePhysicsDescriptionWithoutPeTableClearsSetupTable()
{
EntityEffectProfile profile = EntityEffectProfile.CreateLive(
BuildSetup(),
default);
Assert.Equal(0x330000AAu, profile.SetupDefaultScriptDid);
Assert.Null(profile.CurrentPhysicsScriptTableDid);
Assert.Equal(0u, profile.RawDefaultScriptType);
Assert.Equal(0f, profile.DefaultScriptIntensity);
Assert.True(profile.HasNetworkDescription);
}
[Fact]
public void LivePhysicsDescriptionReplacesTableAndDrivesTypedDefault()
{
PhysicsSpawnData physics = default(PhysicsSpawnData) with
{
PhysicsScriptTableId = 0x340000CCu,
DefaultScriptType = 0xA5A5A5A5u,
DefaultScriptIntensity = 0.75f,
};
EntityEffectProfile profile = EntityEffectProfile.CreateLive(
BuildSetup(),
physics);
Assert.Equal(0x340000CCu, profile.CurrentPhysicsScriptTableDid);
Assert.Equal(0xA5A5A5A5u, profile.RawDefaultScriptType);
Assert.Equal(0.75f, profile.DefaultScriptIntensity);
}
[Fact]
public void LaterNetworkDescriptionWithPresentZeroDoesNotRestoreSetup()
{
EntityEffectProfile profile = EntityEffectProfile.CreateLive(
BuildSetup(),
default(PhysicsSpawnData) with
{
PhysicsScriptTableId = 0x340000CCu,
DefaultScriptType = 7u,
DefaultScriptIntensity = 1f,
});
profile.ApplyNetworkDescription(default(PhysicsSpawnData) with
{
PhysicsScriptTableId = 0u,
DefaultScriptType = 0u,
DefaultScriptIntensity = 0f,
});
Assert.Null(profile.CurrentPhysicsScriptTableDid);
Assert.Equal(0u, profile.RawDefaultScriptType);
Assert.Equal(0f, profile.DefaultScriptIntensity);
}
private static Setup BuildSetup() => new()
{
DefaultScript = 0x330000AAu,
DefaultScriptTable = 0x340000BBu,
};
}