Skip to content

EntityNames

namespace Griff.Scenes;
public static class EntityNames

The one way a name finds an entity, in the running game, in renaming, in the Inspector’s flags and for agents, so the same text means the same entity everywhere. The rule: the name is trimmed and matched exactly; what is inside the entity that holds it comes first (a lever’s own “Hint”), then the scene; in the scene, one in the same part of it as the holder (the minigame being played, or outside them; without a holder, the minigame that has the screen) before another, and in a network game this machine’s player’s own before another; of what is left the first in the scene’s order, or the nearest (to the holder, not preferring the local player) when the component says so. A name that several match where the rule needs one is ambiguous (Ambiguous), and the Inspector, scene_tree and Output say so.

public static IReadOnlyList<Entity> All(Entity owner, string name, bool skipOwner = false, bool insideOnly = false)

Every entity the name can mean for a field on owner: those inside it (itself too, unless skipOwner) if there are any, otherwise, unless insideOnly, those in the scene called that, in the owner’s part of it if any are. A switch acts on all of them; a field that needs one has an ambiguous name when there are several.

public static IReadOnlyList<Entity> Ambiguous(Entity owner, string name, bool skipOwner = false, bool insideOnly = false)

The entities name can mean for a field on owner that needs one, when there are several (see All); empty when it is unambiguous or matches nothing.

public static int Count(Scene scene, string? name, Func<Entity, bool> where)

How many entities in the scene are called name (trimmed) and where accepts, without making garbage.

public static IReadOnlyList<Entity> Every(Scene scene, string? name)

Every entity in the scene called name (trimmed), for a field that acts on all of them.

public static Entity? Find(Scene scene, ReadOnlySpan<char> name, in NameLookup how = default)

The entity called name as how says, or null. Makes no garbage without Where or NearestTo.

public static Entity? Find(Scene scene, string? name, in NameLookup how = default)

Find for text.

public static bool Is(Entity entity, string? name)

Whether entity answers to name (trimmed, exact).

public static Entity? Resolve(Entity owner, string name, bool skipOwner = false, bool insideOnly = false)

The entity a field on owner means, when the name is not ambiguous: the one All gives. Null when nothing has the name or several do.