using UnityEngine; namespace IdleSpectator; /// Registers relationship lifecycle interest candidates. public static class RelationshipInterestFeed { public static void Emit(string eventId, Actor subject, Actor related, string labelOverride = null) { if (AgentHarness.Busy || subject == null || !subject.isAlive()) { return; } DiscreteEventEntry entry = RelationshipEventCatalog.GetOrFallback(eventId); if (!entry.CreatesInterest) { return; } string a = EventFeedUtil.SafeName(subject); string b = EventFeedUtil.SafeName(related); string label = string.IsNullOrEmpty(labelOverride) ? entry.MakeLabel(a, b) : labelOverride; string key = "rel:" + entry.Id + ":" + EventFeedUtil.SafeId(subject) + ":" + EventFeedUtil.SafeId(related); EventFeedUtil.Register( key, "relationship", entry.Category, label, entry.Id, entry.EventStrength, entry.OwnsCamera, subject.current_position, subject); } public static void EmitFamily(string eventId, object family, Actor anchor) { if (AgentHarness.Busy) { return; } DiscreteEventEntry entry = RelationshipEventCatalog.GetOrFallback(eventId); Actor follow = anchor; if (follow == null || !follow.isAlive()) { follow = EventFeedUtil.AnyAliveUnit(); } if (follow == null) { return; } string name = ""; try { name = family?.GetType().GetMethod("getName")?.Invoke(family, null) as string ?? family?.GetType().GetProperty("name")?.GetValue(family, null) as string ?? ""; } catch { // ignore } string key = "rel:" + entry.Id + ":" + (name ?? "family"); EventFeedUtil.Register( key, "relationship", entry.Category, entry.MakeLabel(name, ""), entry.Id, entry.EventStrength, entry.OwnsCamera, follow.current_position, follow); } }