Persist entity contact state in typed snapshots
This commit is contained in:
parent
cb9c5ca21f
commit
1f8a1576f8
10 changed files with 160 additions and 4 deletions
|
|
@ -460,10 +460,28 @@ public static class AetheriaRuntimeCommitLogApplier
|
|||
DockingBayContents = ToCargoBays(entity.DockingBayContents),
|
||||
DockingBayAssignments = ToIntArray(entity.DockingBayAssignments),
|
||||
Visibility = entity.Visibility,
|
||||
VisibilitySourceCount = entity.VisibilitySourceCount
|
||||
VisibilitySourceCount = entity.VisibilitySourceCount,
|
||||
Contacts = ToEntityContacts(entity.Contacts, runId, zoneIndex)
|
||||
};
|
||||
}
|
||||
|
||||
private static AetheriaEntityContactSnapshot[] ToEntityContacts(
|
||||
IReadOnlyList<AetheriaRuntimeEntityContactCommit>? contacts,
|
||||
string runId,
|
||||
int zoneIndex)
|
||||
{
|
||||
return (contacts ?? Array.Empty<AetheriaRuntimeEntityContactCommit>())
|
||||
.Where(contact => contact.TargetEntityIndex >= 0)
|
||||
.Select(contact => new AetheriaEntityContactSnapshot
|
||||
{
|
||||
TargetEntityKey = EntityKey(runId, zoneIndex, contact.TargetEntityIndex).ToString(),
|
||||
InfoGathered = contact.InfoGathered,
|
||||
Hostile = contact.Hostile,
|
||||
Visible = contact.Visible
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
private static AetheriaBehaviorStateSnapshot[] ToBehaviorStates(
|
||||
IReadOnlyList<AetheriaRuntimeBehaviorStateCommit>? states)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue