using UnityEngine; namespace IdleSpectator; /// Registers era and meta-genesis interest candidates. public static class MetaInterestFeed { public static void EmitEra(string eraId) { if (AgentHarness.Busy) { return; } DiscreteEventEntry entry = EraInterestCatalog.GetOrFallback(eraId); if (!entry.CreatesInterest) { return; } // Eras are world-scoped: location-only. Prefer camera center, else a known map tile. Vector3 pos = Vector3.zero; try { if (Camera.main != null) { Vector3 cam = Camera.main.transform.position; pos = new Vector3(cam.x, cam.y, 0f); } } catch { pos = Vector3.zero; } if (pos == Vector3.zero) { try { if (MapBox.instance != null) { // Non-zero placeholder so location-only Register accepts the candidate. pos = new Vector3(1f, 1f, 0f); } } catch { pos = new Vector3(1f, 1f, 0f); } } if (pos == Vector3.zero) { pos = new Vector3(1f, 1f, 0f); } string key = "era:" + entry.Id; EventFeedUtil.Register( key, "era", entry.Category, entry.MakeLabel("", ""), entry.Id, entry.EventStrength, entry.OwnsCamera, pos, follow: null, locationOnly: true, minWatch: 6f, maxWatch: 28f); } public static void EmitMeta(string eventId, string category, float strength, InterestOwnership owns, Actor anchor, string label) { if (AgentHarness.Busy) { return; } Actor follow = anchor != null && anchor.isAlive() ? anchor : null; if (follow == null) { // Meta genesis without a founder: skip unit dossier rather than invent a subject. return; } string key = "meta:" + eventId + ":" + EventFeedUtil.SafeId(follow); EventFeedUtil.Register( key, "meta", category, label, eventId, strength, owns, follow.current_position, follow); } }