Stop mirroring daemon contacts into facades
This commit is contained in:
parent
ff4916df26
commit
56440aedbf
2 changed files with 8 additions and 47 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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<string, Entity> 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$");
|
||||
|
|
|
|||
Loading…
Reference in a new issue