@radcliffetech/symbolos-core
Version:
Core symbolic simulation and execution engine for Symbolos
27 lines (26 loc) • 1.51 kB
TypeScript
import { type SymbolicObject, type WorldFrame, type WorldInstance } from "../types";
/**
*
* Converts a WorldInstance to a WorldFrame symbolic object.
* This is useful for archiving or storing the world state.
*/
export declare function toWorldFrame(world: WorldInstance): WorldFrame;
/**
* Converts a WorldFrame symbolic object back to a WorldInstance.
* This is useful for restoring the world state from an archived frame.
*/
export declare function toWorldInstance(frame: WorldFrame): WorldInstance;
export declare function addToWorld(world: WorldInstance, obj: SymbolicObject | SymbolicObject[]): void;
/**
* Removes an object or objects from the world by their ID(s).
* If the object is not found, a warning is logged.
*
* @param world - The WorldInstance from which to remove the object(s).
* @param id - The ID(s) of the object(s) to remove. Can be a single ID, an array of IDs,
* or SymbolicObject(s) whose IDs will be extracted.
*/
export declare function removeFromWorld(world: WorldInstance, id: string | string[] | SymbolicObject | SymbolicObject[]): void;
export declare function hasType(world: WorldInstance, type: string): boolean;
export declare function getFromWorldByType<T extends SymbolicObject>(world: WorldInstance, type: string): T[];
export declare function getFromWorldById<T extends SymbolicObject>(world: WorldInstance, id: string): T | undefined;
export declare function getFromWorldByIds<T extends SymbolicObject>(world: WorldInstance, ids: string[]): T[];