diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index aa009168b..356c35b33 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -7758,8 +7758,6 @@ static void RequireMainMenuContinueRunState(string root) "ReplaceZoneEntitiesFromTypedSnapshots", "RestoreChildAndDockingRelationships", "RestoreCurrentEntityBinding", - "RestoreEntityContactsFromTypedSnapshot", - "entity.Target.Value = target", "RestoreCurrentEntityBinding(currentEntity, actionBarBindings)", "RestoreActiveConsumablesFromTypedEntitySnapshot(entity, entitySnapshot)", "RestoreRuntimeBehaviorStateFromTypedSnapshot(entity, entitySnapshot, restoredEntities)", @@ -7832,7 +7830,14 @@ static void RequireMainMenuContinueRunState(string root) "CurrentEntity == null || CurrentEntity.Parent != null", "return observer?.Target.Value;", "observer.EntityInfoGathered.TryGetValue(target, out var infoGathered)", - "return target != null && target.IsHostileTo(observer);" + "return target != null && target.IsHostileTo(observer);", + "RestoreEntityContactsFromTypedSnapshot", + "entity.Target.Value = target", + "entity.EntityInfoGathered[target]", + "entity.EntityHostility[target]", + "entity.VisibleEntities.Add(target)", + "entity.VisibleEnemies.Add(target)", + "entity.VisibleFriendlies.Add(target)" }; var forbiddenGameplayHits = forbiddenGameplaySymbols diff --git a/Assets/Scripts/Gameplay/ActionGameManager.cs b/Assets/Scripts/Gameplay/ActionGameManager.cs index 7df490e48..75f11f5fc 100644 --- a/Assets/Scripts/Gameplay/ActionGameManager.cs +++ b/Assets/Scripts/Gameplay/ActionGameManager.cs @@ -2711,26 +2711,6 @@ public class ActionGameManager : MonoBehaviour } RebuildObservedEntityFacadeIndex(); - foreach (var entity in _observedEntityFacadesByRecordKey.Values) - { - entity.EntityInfoGathered.Clear(); - entity.EntityHostility.Clear(); - entity.VisibleEntities.Clear(); - entity.VisibleEnemies.Clear(); - entity.VisibleFriendlies.Clear(); - entity.Target.Value = null; - } - - foreach (var entitySnapshot in entitySnapshots) - { - if (!_observedEntityFacadesByRecordKey.TryGetValue(entitySnapshot.RecordKey, out var entity)) - continue; - - RestoreEntityContactsFromTypedSnapshot(entity, entitySnapshot, _observedEntityFacadesByRecordKey); - if (_observedEntityFacadesByRecordKey.TryGetValue(entitySnapshot.TargetEntityKey, out var target)) - entity.Target.Value = target; - } - if (_observedEntityFacadesByRecordKey.TryGetValue(currentEntityKey, out var currentEntity) && CurrentEntity != currentEntity) { @@ -2789,9 +2769,6 @@ public class ActionGameManager : MonoBehaviour entity.RestoreThermalExposure((float)entitySnapshot.Heatstroke, (float)entitySnapshot.Hypothermia); RestoreActiveConsumablesFromTypedEntitySnapshot(entity, entitySnapshot); RestoreRuntimeBehaviorStateFromTypedSnapshot(entity, entitySnapshot, restoredEntities); - RestoreEntityContactsFromTypedSnapshot(entity, entitySnapshot, restoredEntities); - if (restoredEntities.TryGetValue(entitySnapshot.TargetEntityKey, out var target)) - entity.Target.Value = target; } _observedEntityFacadesByRecordKey.Clear(); @@ -2885,27 +2862,6 @@ public class ActionGameManager : MonoBehaviour .ToArray()); } - private void RestoreEntityContactsFromTypedSnapshot( - Entity entity, - AetheriaRuntimeEntitySnapshot snapshot, - IReadOnlyDictionary restoredEntities) - { - foreach (var contact in snapshot.Contacts) - { - if (!restoredEntities.TryGetValue(contact.TargetEntityKey, out var target)) - continue; - - entity.EntityInfoGathered[target] = (float)contact.InfoGathered; - entity.EntityHostility[target] = contact.Hostile; - if (contact.Visible && !entity.VisibleEntities.Contains(target)) - entity.VisibleEntities.Add(target); - if (contact.Visible && contact.Hostile && !entity.VisibleEnemies.Contains(target)) - entity.VisibleEnemies.Add(target); - if (contact.Visible && !contact.Hostile && !entity.VisibleFriendlies.Contains(target)) - entity.VisibleFriendlies.Add(target); - } - } - private static int EntityIndexFromRecordKey(string recordKey) { var match = Regex.Match(recordKey ?? "", @"\.entity\.(\d+)\.v1$");