87 lines
3.2 KiB
C#
87 lines
3.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace IdleSpectator;
|
|
|
|
public sealed class DiscreteEventEntry
|
|
{
|
|
public string Id = "";
|
|
public float EventStrength = 50f;
|
|
public string Category = "Event";
|
|
public InterestOwnership OwnsCamera = InterestOwnership.Signal;
|
|
public bool CreatesInterest = true;
|
|
public string LabelTemplate = "{id}";
|
|
public bool IsFallback;
|
|
|
|
public string MakeLabel(string a, string b)
|
|
{
|
|
string template = string.IsNullOrEmpty(LabelTemplate) ? "{id}" : LabelTemplate;
|
|
return template
|
|
.Replace("{id}", Id ?? "")
|
|
.Replace("{a}", a ?? "")
|
|
.Replace("{b}", b ?? "");
|
|
}
|
|
}
|
|
|
|
/// <summary>Authored discrete relationship lifecycle events (not a live asset library).</summary>
|
|
public static class RelationshipEventCatalog
|
|
{
|
|
private static readonly Dictionary<string, DiscreteEventEntry> Entries =
|
|
new Dictionary<string, DiscreteEventEntry>(StringComparer.OrdinalIgnoreCase);
|
|
|
|
static RelationshipEventCatalog()
|
|
{
|
|
Add("set_lover", 72f, "Relationship", InterestOwnership.Signal, "Lovers: {a} + {b}");
|
|
Add("clear_lover", 55f, "Relationship", InterestOwnership.Signal, "Lover parted: {a}");
|
|
Add("add_child", 68f, "Relationship", InterestOwnership.Signal, "New child: {a} + {b}");
|
|
Add("new_family", 70f, "Relationship", InterestOwnership.Signal, "New family: {a}");
|
|
Add("family_removed", 50f, "Relationship", InterestOwnership.Ambient, "Family ended: {a}");
|
|
Add("find_lover", 45f, "Relationship", InterestOwnership.Ambient, "Seeking a lover: {a}");
|
|
Add("family_group_new", 60f, "Relationship", InterestOwnership.Signal, "Family pack forms: {a}");
|
|
Add("family_group_join", 48f, "Relationship", InterestOwnership.Ambient, "Joins family pack: {a}");
|
|
Add("family_group_leave", 48f, "Relationship", InterestOwnership.Ambient, "Leaves family pack: {a}");
|
|
Add("baby_created", 70f, "Relationship", InterestOwnership.Signal, "Baby born: {a}");
|
|
}
|
|
|
|
private static void Add(
|
|
string id,
|
|
float strength,
|
|
string category,
|
|
InterestOwnership owns,
|
|
string label)
|
|
{
|
|
Entries[id] = new DiscreteEventEntry
|
|
{
|
|
Id = id,
|
|
EventStrength = strength,
|
|
Category = category,
|
|
OwnsCamera = owns,
|
|
CreatesInterest = true,
|
|
LabelTemplate = label
|
|
};
|
|
}
|
|
|
|
public static IEnumerable<string> AuthoredIds => Entries.Keys;
|
|
|
|
public static bool HasAuthored(string id) =>
|
|
!string.IsNullOrEmpty(id) && Entries.ContainsKey(id.Trim());
|
|
|
|
public static DiscreteEventEntry GetOrFallback(string id)
|
|
{
|
|
if (!string.IsNullOrEmpty(id) && Entries.TryGetValue(id.Trim(), out DiscreteEventEntry entry))
|
|
{
|
|
return entry;
|
|
}
|
|
|
|
string key = string.IsNullOrEmpty(id) ? "unknown" : id.Trim();
|
|
return new DiscreteEventEntry
|
|
{
|
|
Id = key,
|
|
EventStrength = 40f,
|
|
Category = "Relationship",
|
|
OwnsCamera = InterestOwnership.Ambient,
|
|
LabelTemplate = "{id}: {a}",
|
|
IsFallback = true
|
|
};
|
|
}
|
|
}
|