High-level wrapper around Flecs, a powerful ECS (Entity Component System) library, written in Zig language
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
5.5 KiB

//! Module with Flecs builtin components.
const c = @import("../c.zig");
/// Entity associated with world.
pub const World = struct {};
// Builtin components
/// Component that is added to entities which are components.
pub const Component: type = c.EcsComponent;
/// Component used for entity names, symbols, etc.
pub const Identifier: type = c.EcsIdentifier;
/// Used as `.{ Identifier, Name }` to store entity name.
pub const Name = struct {};
/// Used as `.{ Identifier, Symbol }` to store entity symbol.
pub const Symbol = struct {};
/// Used as `.{ Identifier, Alias }` to store entity alias.
pub const Alias = struct {};
/// Internal component to make (query) entities iterable.
pub const Iterable: type = c.EcsIterable;
/// Internal component that stores pointer to poly objects.
pub const Poly: type = c.EcsPoly;
// Builtin tags
/// Tag that is added to modules, which act as a container for logically
/// grouping tags, components, systems, other sub-modules and more.
pub const Module = struct {};
/// Tag that is added to prefabsm, which can be inherited from, and are ignored by queries (by default).
pub const Prefab = struct {};
/// Tag that added to disabled entities, which are ignored by queries (by default).
pub const Disabled = struct {};
/// Tag that is added to private components, which hides them in the explorer (by default).
pub const Private = struct {};
/// Tag that is added to query entities.
pub const Query = struct {};
/// Tag that is added to observer entities, which listen for events involving entities.
pub const Observer = struct {};
/// Internal tag for tracking IDs with special ID flags.
pub const Flag = struct {};
// Builtin relationships
/// Relationship used for expressing inheritance.
pub const IsA = struct {};
/// Relationship used for expressing hierarchies.
pub const ChildOf = struct {};
/// Relationship used for expressing dependencies.
pub const DependsOn = struct {};
/// Relationship used for expressing prefab slots.
pub const SlotOf = struct {};
// Relationship properties
/// Trait that enables transitive evaluation of relationships.
pub const Transitive = struct {};
/// Trait that enables reflexive evaluation of relationships.
pub const Reflexive = struct {};
/// Trait that indicates an entity cannot be inherited from.
pub const Final = struct {};
/// Trait that indicates it should not be inherited.
pub const DontInherit = struct {};
/// Trait that ensures a pair cannot contain a value.
pub const Tag = struct {};
/// Trait that indicates a relationship is acyclic.
pub const Acyclic = struct {};
/// Trait that indicates a relationship is traversable.
pub const Traversable = struct {};
/// Trait that ensures a relationship can only have one target.
pub const Exclusive = struct {};
/// Trait that causes a relationship to be two-way.
pub const Symmetric = struct {};
/// Trait for adding additional components when a component is added.
pub const With = struct {};
/// Trait that indicates a component should always be overridden.
pub const AlwaysOverride = struct {};
/// Trait for creating a non-fragmenting relationship.
pub const Union = struct {};
/// Trait that enforces target of relationship is a child of <specified>.
pub const OneOf = struct {};
// Builtin event tags
/// Event emitted when component is added.
pub const OnAdd = struct {};
/// Event emitted when component is removed.
pub const OnRemove = struct {};
/// Event emitted when component is set.
pub const OnSet = struct {};
/// Event emitted when component is unset.
pub const UnSet = struct {};
/// Event emitted when table is created.
pub const OnTableCreate = struct {};
/// Event emitted when table becomes empty.
pub const OnTableDelete = struct {};
/// Event emitted when table becomes empty.
pub const OnTableEmpty = struct {};
/// Event emitted when table becomes non-empty.
pub const OnTableFilled = struct {};
// Cleanup policies
// For example, components have `.{ OnDelete, Panic }` by default.
/// Cleanup trait for specifying what happens when component is deleted.
pub const OnDelete = struct {};
/// Cleanup trait for specifying what happens when pair target is deleted.
pub const OnDeleteTarget = struct {};
/// Cleanup action to delete entity from other entities. (default)
pub const Remove = struct {};
/// Cleanup action to delete all entities that have this entity.
pub const Delete = struct {};
/// Cleanup action to panic when entity is deleted.
pub const Panic = struct {};
// Query markers
// zig fmt: off
/// Query marker to express `$this` variable.
pub const This = struct { pub const name = "$"; };
/// Query marker to express match all wildcard (`*` in query DSL).
pub const Wildcard = struct { pub const name = "*"; };
/// Query marker to express match at least one wildcard (`_` in query DSL).
pub const Any = struct { pub const name = "_"; };
// zig fmt: on
/// Query marker to express `==` operator.
pub const PredEq = struct {};
/// Query marker to express `~=` operator.
pub const PredMatch = struct {};
/// Query marker to express by-name lookup.
pub const PredLookup = struct {};
/// Query marker to express scope open.
pub const ScopeOpen = struct {};
/// Query marker to express scope close.
pub const ScopeClose = struct {};
/// Tag used to indicate a query has no results.
pub const Empty = struct {};
// Misc
/// Internal component that stores information for flattened trees.
pub const Target: type = c.EcsTarget;
/// Tag that when added to assembly automatically flattens tree.
pub const Flatten = struct {};
/// Sets default component hint for children of entity.
pub const DefaultChildComponent = struct {};