using UnityEngine; namespace IdleSpectator; /// Registers era and meta-genesis interest candidates. public static class MetaInterestFeed { public static void EmitEra(string eraId) { if (!AgentHarness.LiveFeedsAllowed) { return; } DiscreteEventEntry entry = EventCatalog.Era.GetOrFallback(eraId); if (!EventCatalog.IsCameraWorthy(entry)) { InterestDropLog.Record("createsInterest=false", "meta"); 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, pos, follow: null, locationOnly: true, minWatch: 6f, maxWatch: 28f); } public static void EmitMeta(string eventId, string category, float strength, Actor anchor, string label) { if (!AgentHarness.LiveFeedsAllowed) { 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, follow.current_position, follow); } /// /// Ongoing earthquake while - covers god-tool quakes /// and disaster-spawned quakes (WorldLog may also fire for the latter). /// public static void EmitEarthquake(WorldTile tile) { if (!AgentHarness.LiveFeedsAllowed) { return; } Vector3 pos = Vector3.zero; try { if (tile != null) { pos = tile.posV3; } } catch { pos = Vector3.zero; } if (pos == Vector3.zero) { try { if (Camera.main != null) { Vector3 cam = Camera.main.transform.position; pos = new Vector3(cam.x, cam.y, 0f); } } catch { pos = new Vector3(1f, 1f, 0f); } } if (pos == Vector3.zero) { pos = new Vector3(1f, 1f, 0f); } Actor follow = WorldActivityScanner.FindNearestAliveUnit(pos, 80f); string label = EventReason.Earthquake(follow); EventFeedUtil.Register( "earthquake:active", "earthquake", "Disaster", label, "earthquake", 95f, pos, follow, locationOnly: follow == null, minWatch: 8f, maxWatch: 45f, completion: InterestCompletionKind.EarthquakeActive); } }