import EventEmitter from 'eventemitter3'; import { ComponentType, Entity } from '@lastolivegames/becsy'; import { Commands } from './Commands'; import { Bundle } from '../components'; /** * A list of commands that will be run to modify an [entity](crate::entity). */ export declare class EntityCommands extends EventEmitter { entity: Entity; commands: Commands; constructor(entity: Entity, commands: Commands); /** * Returns the [`Entity`] id of the entity. * * @example * let entity_id = commands.spawn_empty().id(); */ id(): Entity; /** * Adds a [`Bundle`] of components to the entity. * This will overwrite any previous value(s) of the same component type. * * @example * commands * .entity(0) * .insert([Defense, { x: 10 }], [Transform, { translation } ]) * .insert([Bundle, { transform }]) */ insert(...bundles: (ComponentType | Bundle)[]): this; /** * Removes a [`Bundle`] of components from the entity. * @example * commands.entity(0).remove(Transform); */ remove(...bundles: (ComponentType | Bundle)[]): void; /** * Despawns the entity. */ despawn(): void; /** * Adds a single child. * If the children were previously children of another parent, * that parent's [`Children`] component will have those children removed from its list. * Removing all children from a parent causes its [`Children`] component to be removed from the entity. */ appendChild(child: EntityCommands): this; removeChild(child: EntityCommands): this; }