Skip to content

EntityReferences

namespace Griff.Scenes;
public static class EntityReferences

Fields that name entities (properties marked EntityNameAttribute, a Switch’s Targets or a camera’s Follow target): renaming an entity renames it in them too, and a name that matches nothing can be flagged.

public static IReadOnlyList<string> Ambiguous(EntityReferences.Reference reference)

The names reference holds that several entities answer to where the field needs one (a camera’s Follow, a wire’s From; not a field that names several or means every one, or “*”): the game picks between them by its rule (see EntityNames), so the Inspector, scene_tree and Output say which names do. Empty for a field not used.

public static string AmbiguousProblem(EntityReferences.Reference reference, IReadOnlyList<string> names)

“Several entities in the scene are called “Door”: the game takes one, the nearest of them or this player’s own.”

public static IEnumerable<Entity> Candidates(Entity owner, EntityNameAttribute kind)

The entities a field on owner can name: what’s inside it for one like an attack’s Hitbox, otherwise the whole scene.

public static IEnumerable<EntityReferences.Link> From(Entity entity, ComponentRegistry registry)

The links out of entity: each entity its fields name (see Named), other than itself, once per field. Fields set aside by their Unless have none.

public static IReadOnlyList<Entity> Named(Entity owner, EntityNameAttribute kind, string name)

Every entity a field on owner can mean by name, as a switch finds its targets: those inside the owner with the name (itself too, unless the field names one inside it), otherwise every one in the scene with it.

public static IReadOnlyList<string> Names(object? value, EntityNameAttribute kind)

The names a field’s value holds: split at commas for one that names several, empty when it’s unset.

public static IEnumerable<EntityReferences.Reference> On(Entity entity, ComponentRegistry registry)

Every field on entity’s components that names entities.

public static Entity? Resolve(Entity owner, EntityNameAttribute kind, string name)

The entity a field on owner means by name, as the game finds it: one inside the owner first (a lever’s own “Hint”), otherwise the only one in the scene with that name. Null when nothing has the name, or several outside the owner do (the game picks between them as it plays).

public static IEnumerable<EntityReferences.Link> To(Entity entity, ComponentRegistry registry)

The links into entity: fields on the other entities in its scene that name it.

public static IReadOnlyList<string> Unmatched(EntityReferences.Reference reference, IReadOnlyCollection<string>? prefabs = null, bool inPrefab = false)

The names reference holds that match nothing: no entity it can name has that name, and neither does a prefab (one in prefabs), which a game can bring in while it runs. In a prefab on its own (inPrefab), only names of things inside the field’s entity can be checked: the rest name things in whatever scene the prefab is placed in.

public static IEnumerable<ValueTuple<EntityReferences.Reference, IReadOnlyList<string>>> UnmatchedIn(Scene scene, ComponentRegistry registry, IReadOnlyCollection<string>? prefabs = null, bool inPrefab = false)

Every field in the scene (or a prefab on its own, see Unmatched) that holds a name matching nothing, with the names it can’t find.