diff --git a/Assets/Scripts/ServerShared/Entity.cs b/Assets/Scripts/ServerShared/Entity.cs index ad645add4..e58abbac3 100644 --- a/Assets/Scripts/ServerShared/Entity.cs +++ b/Assets/Scripts/ServerShared/Entity.cs @@ -1060,12 +1060,12 @@ public abstract class Entity // record. The same PerceivesDestroyed Sense ends reveals by, applied to located mounts. private void RecordSeenDestroyed(Entity subject) { - _reveals.TryGetValue(subject, out var book); - var layout = LayoutOf(subject); - foreach (var item in subject.Equipment) + // Indexed, and the layout read only for an item actually perceived destroyed: Sense runs for every pair of ships every tick. + for (var i = 0; i < subject.Equipment.Count; i++) { + var item = subject.Equipment[i]; if (item.Hardpoint == null || !PerceivesDestroyed(subject, item)) continue; - if (!layout.Contains(item.Hardpoint) && (book == null || !book.ContainsKey(item))) continue; + if (!LayoutOf(subject).Contains(item.Hardpoint) && !(_reveals.TryGetValue(subject, out var book) && book.ContainsKey(item))) continue; if (!_seenDestroyed.TryGetValue(subject, out var seen)) _seenDestroyed[subject] = seen = new HashSet(); seen.Add(item.Hardpoint); }