fix #203: preserve animation on appearance updates
This commit is contained in:
parent
ff06aa3107
commit
c7607f019c
9 changed files with 237 additions and 22 deletions
|
|
@ -4,6 +4,9 @@ namespace AcDream.Core.World;
|
|||
|
||||
public sealed class WorldEntity
|
||||
{
|
||||
private PaletteOverride? _paletteOverride;
|
||||
private IReadOnlyList<PartOverride> _partOverrides = Array.Empty<PartOverride>();
|
||||
|
||||
public required uint Id { get; init; }
|
||||
/// <summary>
|
||||
/// Server-assigned GUID (from CreateObject). Zero for dat-hydrated
|
||||
|
|
@ -34,7 +37,11 @@ public sealed class WorldEntity
|
|||
/// colors, creature recolors (e.g. stone-colored drudge statue),
|
||||
/// and team colors. Non-palette-indexed textures ignore this field.
|
||||
/// </summary>
|
||||
public PaletteOverride? PaletteOverride { get; init; }
|
||||
public PaletteOverride? PaletteOverride
|
||||
{
|
||||
get => _paletteOverride;
|
||||
init => _paletteOverride = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// EnvCell or outdoor cell ID that owns this entity (room geometry, static
|
||||
|
|
@ -94,7 +101,30 @@ public sealed class WorldEntity
|
|||
/// <c>AnimatedEntityState</c>'s override map at spawn time. Empty for atlas-
|
||||
/// tier entities.
|
||||
/// </summary>
|
||||
public IReadOnlyList<PartOverride> PartOverrides { get; init; } = Array.Empty<PartOverride>();
|
||||
public IReadOnlyList<PartOverride> PartOverrides
|
||||
{
|
||||
get => _partOverrides;
|
||||
init => _partOverrides = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces the render-only appearance carried by an ObjDesc update while
|
||||
/// preserving this entity's identity, spatial state, and runtime owners.
|
||||
/// Retail performs the equivalent mutation through
|
||||
/// <c>CPhysicsObj::DoObjDescChangesFromDefault</c>.
|
||||
/// </summary>
|
||||
public void ApplyAppearance(
|
||||
IReadOnlyList<MeshRef> meshRefs,
|
||||
PaletteOverride? paletteOverride,
|
||||
IReadOnlyList<PartOverride> partOverrides)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(meshRefs);
|
||||
ArgumentNullException.ThrowIfNull(partOverrides);
|
||||
|
||||
MeshRefs = meshRefs;
|
||||
_paletteOverride = paletteOverride;
|
||||
_partOverrides = partOverrides;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bitmask of hidden Setup parts. Bit <c>i</c> set hides part <c>i</c> at
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue