- Update building event patches to include completion notifications - Introduce earthquake event handling for ongoing seismic activity - Modify event catalog to reflect changes in ambient interest settings - Add new harness scenarios for library asset label validation - Increment version to 0.28.17 in mod.json
160 lines
4 KiB
C#
160 lines
4 KiB
C#
using UnityEngine;
|
|
|
|
namespace IdleSpectator;
|
|
|
|
/// <summary>Registers era and meta-genesis interest candidates.</summary>
|
|
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);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Ongoing earthquake while <see cref="Earthquake.isQuakeActive"/> - covers god-tool quakes
|
|
/// and disaster-spawned quakes (WorldLog may also fire for the latter).
|
|
/// </summary>
|
|
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);
|
|
}
|
|
}
|