worldbox-observer-mod/IdleSpectator/MetaInterestFeed.cs

73 lines
1.7 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.Busy)
{
return;
}
DiscreteEventEntry entry = EraInterestCatalog.GetOrFallback(eraId);
if (!entry.CreatesInterest)
{
return;
}
Actor follow = EventFeedUtil.AnyAliveUnit();
Vector3 pos = follow != null ? follow.current_position : Vector3.zero;
if (follow == null && pos == Vector3.zero)
{
return;
}
string key = "era:" + entry.Id;
EventFeedUtil.Register(
key,
"era",
entry.Category,
entry.MakeLabel("", ""),
entry.Id,
entry.EventStrength,
entry.OwnsCamera,
pos,
follow,
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;
if (follow == null || !follow.isAlive())
{
follow = EventFeedUtil.AnyAliveUnit();
}
if (follow == null)
{
return;
}
string key = "meta:" + eventId + ":" + EventFeedUtil.SafeId(follow);
EventFeedUtil.Register(
key,
"meta",
category,
label,
eventId,
strength,
owns,
follow.current_position,
follow);
}
}